Re: XForms: Code and clarifying - pixmap revisited...

Trent Piepho (xyzzy@u.washington.edu)
Fri, 13 Nov 1998 09:05:42 -0800 (PST)

# To subscribers of the xforms list from Trent Piepho <xyzzy@u.washington.edu> :

On Thu, 12 Nov 1998, Joao Filipe Ferreira wrote:
> Trent Piepho -
>
> Now here's some interesting piece of code - if everything else
> fails, you can be sure I'll use it!
>
> There is a piece of information missing, though. Where is the
> size_of_pixmap routine?

I suppose that might be usefull too. I think I got most of it from the XV
sources. In order to find the size of the pixmap, you need to get the
PixmapFormat list, find the format with the same depth as you want, and make
sure each line is padded to a multiple of the some amount (32 bits usually).

int size_of_pixmap(int depth)
{
int count;
int bits;
XPixmapFormatValues *pfv;

pfv=XListPixmapFormats(dpy, &count);
for(count--;count>0;count--) {
if(pfv[count].depth!=depth) continue;
bits = WIDTH * pfv[count].bits_per_pixel;
if(bits%pfv[count].scanline_pad) {
bits -= bits%pfv[count].scanline_pad;
bits += pfv[count].scanline_pad;
};
XFree(pfv);
return (bits/8)*HEIGHT;
};
return 0;
}

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/