| 1 |
/* |
| 2 |
* tkImgPmap.h -- |
| 3 |
* |
| 4 |
* Generic header file for the pixmap image type. This is NOT a public |
| 5 |
* header file! |
| 6 |
* |
| 7 |
* Copyright (c) 1996, Expert Interface Technologies |
| 8 |
* |
| 9 |
* See the file "license.terms" for information on usage and redistribution |
| 10 |
* of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 11 |
* |
| 12 |
*/ |
| 13 |
|
| 14 |
#ifndef _IMG_PMAP_H_ |
| 15 |
#define _IMG_PMAP_H_ |
| 16 |
|
| 17 |
/* |
| 18 |
* Constants |
| 19 |
*/ |
| 20 |
|
| 21 |
#define XPM_MONO 1 |
| 22 |
#define XPM_GRAY_4 2 |
| 23 |
#define XPM_GRAY 3 |
| 24 |
#define XPM_COLOR 4 |
| 25 |
#define XPM_SYMBOLIC 5 |
| 26 |
#define XPM_UNKNOWN 6 |
| 27 |
|
| 28 |
/* |
| 29 |
* The following data structure represents the master for a pixmap |
| 30 |
* image: |
| 31 |
*/ |
| 32 |
|
| 33 |
typedef struct PixmapMaster { |
| 34 |
Tk_ImageMaster tkMaster; /* Tk's token for image master. NULL means |
| 35 |
* the image is being deleted. */ |
| 36 |
Tcl_Interp *interp; /* Interpreter for application that is |
| 37 |
* using image. */ |
| 38 |
Tcl_Command imageCmd; /* Token for image command (used to delete |
| 39 |
* it when the image goes away). NULL means |
| 40 |
* the image command has already been |
| 41 |
* deleted. */ |
| 42 |
char *fileString; /* Value of -file option (malloc'ed). |
| 43 |
* valid only if the -file option is specified |
| 44 |
*/ |
| 45 |
char *dataString; /* Value of -data option (malloc'ed). |
| 46 |
* valid only if the -data option is specified |
| 47 |
*/ |
| 48 |
/* First in list of all instances associated |
| 49 |
* with this master. */ |
| 50 |
int size[2]; /* width and height */ |
| 51 |
int ncolors; /* number of colors */ |
| 52 |
int cpp; /* characters per pixel */ |
| 53 |
char ** data; /* The data that defines this pixmap |
| 54 |
* image (array of strings). It is |
| 55 |
* converted into an X Pixmap when this |
| 56 |
* image is instanciated |
| 57 |
*/ |
| 58 |
int isDataAlloced; /* False iff the data is got from |
| 59 |
* the -id switch */ |
| 60 |
struct PixmapInstance *instancePtr; |
| 61 |
} PixmapMaster; |
| 62 |
|
| 63 |
typedef struct ColorStruct { |
| 64 |
char c; /* This is used if CPP is one */ |
| 65 |
char * cstring; /* This is used if CPP is bigger than one */ |
| 66 |
XColor * colorPtr; |
| 67 |
} ColorStruct; |
| 68 |
|
| 69 |
/*---------------------------------------------------------------------- |
| 70 |
* PixmapInstance -- |
| 71 |
* |
| 72 |
* Represents all of the instances of an image that lie within a |
| 73 |
* particular window: |
| 74 |
* |
| 75 |
* %% ToDo |
| 76 |
* Currently one instance is created for each window that uses |
| 77 |
* this pixmap. This is usually OK because pixmaps are usually |
| 78 |
* not shared or only shared by a small number of windows. To |
| 79 |
* improve resource allocation, we can create an instance for |
| 80 |
* each (Display x Visual x Depth) combo. This will usually |
| 81 |
* reduce the number of instances to one. |
| 82 |
*---------------------------------------------------------------------- |
| 83 |
*/ |
| 84 |
typedef struct PixmapInstance { |
| 85 |
int refCount; /* Number of instances that share this |
| 86 |
* data structure. */ |
| 87 |
PixmapMaster *masterPtr; /* Pointer to master for image. */ |
| 88 |
Tk_Window tkwin; /* Window in which the instances will be |
| 89 |
* displayed. */ |
| 90 |
Pixmap pixmap; /* The pixmap to display. */ |
| 91 |
struct PixmapInstance *nextPtr; |
| 92 |
/* Next in list of all instance structures |
| 93 |
* associated with masterPtr (NULL means |
| 94 |
* end of list). |
| 95 |
*/ |
| 96 |
ColorStruct * colors; |
| 97 |
ClientData clientData; /* Place holder for platform specific |
| 98 |
* instance data */ |
| 99 |
} PixmapInstance; |
| 100 |
|
| 101 |
|
| 102 |
EXTERN void ImgInitPixmapInstance _ANSI_ARGS_(( |
| 103 |
PixmapMaster *masterPtr, |
| 104 |
PixmapInstance *instancePtr)); |
| 105 |
EXTERN void ImgXpmAllocTmpBuffer _ANSI_ARGS_(( |
| 106 |
PixmapMaster * masterPtr, |
| 107 |
PixmapInstance * instancePtr, |
| 108 |
XImage ** imagePtr, XImage ** maskPtr)); |
| 109 |
EXTERN void ImgXpmFreeTmpBuffer _ANSI_ARGS_(( |
| 110 |
PixmapMaster * masterPtr, |
| 111 |
PixmapInstance * instancePtr, |
| 112 |
XImage * image, XImage * mask)); |
| 113 |
EXTERN void ImgXpmSetPixel _ANSI_ARGS_(( |
| 114 |
PixmapInstance * instancePtr, XImage * image, |
| 115 |
XImage * mask, int x, int y, XColor * colorPtr, |
| 116 |
int * isTranspPtr)); |
| 117 |
EXTERN void ImgXpmRealizePixmap _ANSI_ARGS_(( |
| 118 |
PixmapMaster * masterPtr, |
| 119 |
PixmapInstance * instancePtr, |
| 120 |
XImage * image, XImage * mask, int isTransp)); |
| 121 |
EXTERN void ImgXpmFreeInstanceData _ANSI_ARGS_(( |
| 122 |
PixmapInstance *instancePtr, int delete)); |
| 123 |
EXTERN void ImgpXpmDisplay _ANSI_ARGS_((ClientData clientData, |
| 124 |
Display *display, Drawable drawable, |
| 125 |
int imageX, int imageY, int width, int height, |
| 126 |
int drawableX, int drawableY)); |
| 127 |
|
| 128 |
#endif |