Title: | open3d |
Notice: | Kits on notes 3 and 4; Documents note 223 |
Moderator: | WRKSYS::COULTER |
Created: | Wed Dec 09 1992 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 1306 |
Total number of notes: | 5260 |
<<< TURRIS::DISK$NOTES_PACK2:[NOTES$LIBRARY]DIGITAL_UNIX.NOTE;1 >>> -< DIGITAL UNIX >- ================================================================================ Note 9694.0 X Program Display problems No replies SWAM1::POIANI_MI 10 lines 1-MAY-1997 19:38 -------------------------------------------------------------------------------- I have a customer bringing some X widows code over from an SGI box. They have this question: The man pages (and the header files) indicate that a pixel is a 64-bit value (a long). If I allocate space for an W x H image do really need W*H*8 bytes? This seems awfully wasteful as no display servers support 64-bit pixel values (32 is typical). The problem is that I have a program which allocates W*H*sizeof(long) for the image. This works fine on the 32-bit machines but not on my DEC alpha (the image displays wrong). The question is are pixels 32 or 64 bit (int or long)?
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
1284.1 | You must use the variable types as specified | VESPER::VESPER | OpenGL Alpha Geek | Fri May 02 1997 10:00 | 23 |
> The man pages (and the header files) indicate that a pixel is a 64-bit > value (a long). If I allocate space for an W x H image do really need > W*H*8 bytes? This seems awfully wasteful as no display servers support > 64-bit pixel values (32 is typical). The problem is that I have a > program which allocates W*H*sizeof(long) for the image. This works > fine on the 32-bit machines but not on my DEC alpha (the image displays > wrong). The question is are pixels 32 or 64 bit (int or long)? In X11, a 'pixel value' is held in a 'long'. Anything that stores a pixel value must be declared long. However, it is not common to store an image as an array of pixel values. It is much more common to use an 8-bit byte for each of red, green and blue. The XImage structure allow you to specify how you have laid out your pixels, and the XPutImage function will do the right conversions. If the application is allocating W*H*sizeof(long) and storing 3 8-bit bytes per pixel, the application is incorrect. It should be allocating W*H*3*sizeof(char). Andy V |