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