/******************************************************************************* * * * pixmaps.c -- Register bitmaps for rotation buttons * * * * Copyright (c) 1991 Universities Research Association, Inc. * * All rights reserved. * * * * This material resulted from work developed under a Government Contract and * * is subject to the following license: The Government retains a paid-up, * * nonexclusive, irrevocable worldwide license to reproduce, prepare derivative * * works, perform publicly and display publicly by or for the Government, * * including the right to distribute to other Government contractors. Neither * * the United States nor the United States Department of Energy, nor any of * * their employees, makes any warrenty, express or implied, or assumes any * * legal liability or responsibility for the accuracy, completeness, or * * usefulness of any information, apparatus, product, or process disclosed, or * * represents that its use would not infringe privately owned rights. * * * * Fermilab Nirvana GUI Library * * August 15, 1991 * * * * Written by Mark Edel * * * *******************************************************************************/ static char SCCSID[] = "@(#)pixmaps.c 1.1 4/6/92"; #include #include #include "pixmaps.h" static unsigned char viewRotXPosBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0xc3, 0x00, 0x01, 0x00, 0x80, 0x01, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x07, 0xff, 0x5c, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x01, 0xe0, 0x80, 0x01, 0x80, 0x80, 0x01, 0x43, 0x00, 0x01, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char viewRotXNegBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3c, 0x00, 0x01, 0x43, 0x00, 0x01, 0x80, 0x80, 0x01, 0xe0, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x07, 0xff, 0x5c, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x01, 0x00, 0x80, 0x01, 0x00, 0x80, 0x00, 0xc3, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char viewRotYPosBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x88, 0xf0, 0x02, 0x08, 0xc0, 0x02, 0x08, 0xa0, 0x04, 0x08, 0x90, 0x04, 0x08, 0x10, 0x04, 0x08, 0x10, 0x04, 0x08, 0x10, 0x02, 0x08, 0x20, 0x02, 0x08, 0x20, 0x01, 0x80, 0xc0, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char viewRotYNegBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x07, 0x88, 0xc0, 0x01, 0x88, 0x20, 0x02, 0x88, 0x20, 0x04, 0x08, 0x10, 0x04, 0x08, 0x10, 0x04, 0x08, 0x10, 0x04, 0x08, 0x10, 0x02, 0x08, 0x20, 0x02, 0x08, 0x20, 0x01, 0x80, 0xc0, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char viewRotZPosBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0xc3, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x04, 0x00, 0x20, 0x0e, 0x18, 0x20, 0x15, 0x18, 0x20, 0x04, 0x00, 0x20, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x01, 0x00, 0x80, 0x00, 0xc3, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char viewRotZNegBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0xc3, 0x00, 0x01, 0x00, 0x80, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x20, 0x04, 0x18, 0x70, 0x04, 0x18, 0xa8, 0x04, 0x00, 0x20, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x01, 0x00, 0x80, 0x00, 0xc3, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char coordRotXPosBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x83, 0x80, 0x00, 0x84, 0x40, 0x00, 0x88, 0x20, 0x00, 0x88, 0x00, 0x00, 0x88, 0x00, 0x00, 0xeb, 0x20, 0x01, 0x08, 0x70, 0x02, 0x08, 0xa8, 0x04, 0x08, 0x20, 0x08, 0x04, 0x40, 0x10, 0x04, 0x40, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char coordRotXNegBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x83, 0x80, 0x00, 0x84, 0x40, 0x00, 0x88, 0x20, 0x00, 0x88, 0xa8, 0x00, 0x88, 0x70, 0x00, 0xeb, 0x20, 0x01, 0x08, 0x00, 0x02, 0x08, 0x00, 0x04, 0x08, 0x20, 0x08, 0x04, 0x40, 0x10, 0x04, 0x40, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char coordRotYPosBM[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x4f, 0x00, 0x01, 0x84, 0xc0, 0x02, 0x02, 0x20, 0x02, 0x08, 0x20, 0x02, 0x08, 0x20, 0x01, 0x80, 0xc0, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x07, 0xf8, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00}; static unsigned char coordRotYNegBM[] = { 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x00, 0xf2, 0x00, 0x01, 0x21, 0xc0, 0x02, 0x40, 0x20, 0x02, 0x08, 0x20, 0x02, 0x08, 0x20, 0x01, 0x80, 0xc0, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x07, 0xf8, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00}; static unsigned char coordRotZPosBM[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x7a, 0x00, 0x01, 0x86, 0x00, 0x02, 0x03, 0xfc, 0x02, 0x05, 0x00, 0x04, 0x08, 0x80, 0x04, 0x11, 0xc0, 0x04, 0x22, 0xa0, 0x04, 0x00, 0x80, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x86, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00}; static unsigned char coordRotZNegBM[] = { 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x7a, 0x00, 0x01, 0x86, 0x00, 0x00, 0x03, 0xfc, 0x00, 0x05, 0x00, 0x04, 0x08, 0x80, 0x0e, 0x10, 0x80, 0x15, 0x20, 0x80, 0x04, 0x00, 0x80, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x86, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00}; static unsigned char scaleDownBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x18, 0x03, 0x00, 0x60, 0x00, 0xc1, 0x80, 0x00, 0x36, 0x00, 0x00, 0x08, 0x00, 0x00, 0x80, 0x80, 0x00, 0x41, 0x00, 0x00, 0x22, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char scaleUpBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x36, 0x00, 0x00, 0xc1, 0x80, 0x03, 0x00, 0x60, 0x0c, 0x00, 0x18, 0x00, 0x08, 0x00, 0x00, 0x14, 0x00, 0x00, 0x22, 0x00, 0x00, 0x41, 0x00, 0x00, 0x80, 0x80, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static unsigned char resetRotationBM[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static void registerBM(Screen *screen, char *name, unsigned char *bits, int width, int height); void RegisterPhaseBitmaps(Screen *screen) { registerBM(screen, "viewRotXPos", viewRotXPosBM, 24, 19); registerBM(screen, "viewRotXNeg", viewRotXNegBM, 24, 19); registerBM(screen, "viewRotYPos", viewRotYPosBM, 24, 19); registerBM(screen, "viewRotYNeg", viewRotYNegBM, 24, 19); registerBM(screen, "viewRotZPos", viewRotZPosBM, 24, 19); registerBM(screen, "viewRotZNeg", viewRotZNegBM, 24, 19); registerBM(screen, "coordRotXPos", coordRotXPosBM, 24, 19); registerBM(screen, "coordRotXNeg", coordRotXNegBM, 24, 19); registerBM(screen, "coordRotYPos", coordRotYPosBM, 24, 19); registerBM(screen, "coordRotYNeg", coordRotYNegBM, 24, 19); registerBM(screen, "coordRotZPos", coordRotZPosBM, 24, 19); registerBM(screen, "coordRotZNeg", coordRotZNegBM, 24, 19); registerBM(screen, "scaleUp", scaleUpBM, 24, 19); registerBM(screen, "scaleDown", scaleDownBM, 24, 19); registerBM(screen, "resetRotation", resetRotationBM, 24, 19); } static void registerBM(Screen *screen, char *name, unsigned char *bits, int width, int height) { XImage *image; /* There is something very wrong with XCreateImage. It does seem rather stupid to use server information to fill in client dependent information. Motif does not use XCreateImage internally, rather it just fills in the image data structure itself and hopes for pity in future Xlib versions. The X recommended code results in byte-swapped pixmaps on many machines: image=XCreateImage(DisplayOfScreen(screen), DefaultVisualOfScreen(screen), 1, XYBitmap, 0, bits, width, height, 8, 0); The following code, copied from the motif source, just initializes the structure to all zeros and fills in the data we know about. */ image = (XImage *)XtCalloc(1, sizeof(XImage)) ; image->width = width ; image->height = height ; image->data = (char *)bits ; image->depth = 1 ; image->xoffset = 0 ; image->format = XYBitmap ; image->byte_order = LSBFirst ; image->bitmap_unit = 8 ; image->bitmap_bit_order = MSBFirst ; image->bitmap_pad = 8 ; image->bytes_per_line = (width + 7) >> 3 ; XmInstallImage(image, name); }