[comp.windows.x] problems with R4 "bitmap" to construct Xview icons

rick@hanauma (Richard Ottolini) (02/28/90)

The bits within a byte are reversed when the output file of bitmap
is the value of SERVER_IMAGE_BITS for an Xview icon.
This is on a SPARC.
Any suggestion for getting the bits in the right order
without having to reverse them in my code?

hvr@kimba.Sun.COM (Heather Rose) (03/07/90)

In article <541@med.Stanford.EDU> rick@hanauma (Richard Ottolini) writes:
>
>The bits within a byte are reversed when the output file of bitmap
>is the value of SERVER_IMAGE_BITS for an Xview icon.
>This is on a SPARC.
>Any suggestion for getting the bits in the right order
>without having to reverse them in my code?

When using an X11 bitmap, use the attribute SERVER_IMAGE_X_BITS to create
the image.  I noticed that this attribute was not documented in the O'Reilly
manual.  Here's an example using an X11 bitmap as an icon image:

#include "icon.bm"

...
        Icon            icon;
        Server_image    icon_image;

	icon_image = (Server_image)xv_create(XV_NULL, SERVER_IMAGE,
                XV_WIDTH,               icon_width,
                XV_HEIGHT,              icon_height,
                SERVER_IMAGE_X_BITS,    icon_bits,
                NULL);

        icon = (Icon)xv_create(obj, ICON,
                ICON_IMAGE,     icon_image,
                NULL);
 
        xv_set(obj, FRAME_ICON, icon, NULL);

If you use SunView formatted icons, the same code would look very similar,
just use the attribute SERVER_IMAGE_BITS instead.  

Here's an example using a SunView style icon:

short open_bits[] =  {
#include "open.icon"
};

...

    Server_image        open_image;
    Icon                icon;

    open_image = (Server_image)xv_create(NULL, SERVER_IMAGE,
        XV_WIDTH,               64,
        XV_HEIGHT,              64,
        SERVER_IMAGE_BITS,      open_bits,
        NULL);

    icon = (Icon)xv_create(frame, ICON,
        ICON_IMAGE,             open_image,
	NULL);

    xv_set(obj, FRAME_ICON, icon, NULL);

Regards,

Heather