[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bgsdev::open3d

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

1284.0. "X programming problem" by SWAM1::POIANI_MI () Thu May 01 1997 23:04

       <<< 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.RTitleUserPersonal
Name
DateLines
1284.1You must use the variable types as specifiedVESPER::VESPEROpenGL Alpha GeekFri May 02 1997 10:0023
>    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