1 #ifndef __palette_h__
2 #define __palette_h__
3 
4 /* +-------------------------------------------------------------------+ */
5 /* | Copyright 1992, David Koblas.                                     | */
6 /* | Copyright 1995, 1996 Torsten Martinsen (bullestock@dk-online.dk)  | */
7 /* |                                                                   | */
8 /* |   Permission to use, copy, modify, and distribute this software   | */
9 /* |   and its documentation for any purpose and without fee is hereby | */
10 /* |   granted, provided that the above copyright notice appear in all | */
11 /* |   copies and that both that copyright notice and this permission  | */
12 /* |   notice appear in supporting documentation.  This software is    | */
13 /* |   provided "as is" without express or implied warranty.           | */
14 /* +-------------------------------------------------------------------+ */
15 
16 /* $Id: palette.h,v 1.17 2005/03/20 20:15:32 demailly Exp $ */
17 
18 typedef struct paletteUserList_s {
19     Widget widget;
20     struct paletteUserList_s *next;
21 } paletteUserList;
22 
23 typedef struct {
24     int isGrey;
25     int isDefault;
26     int isMapped;
27     int ncolors;
28     /*
29     **
30      */
31     int readonly_;
32     Display *display;
33     Colormap cmap;
34     Visual *visual;
35     int depth;
36     void *htable, *ltable;
37     void *ctable;
38     Pixel mine;
39     /*
40     **  TrueColor visual support
41      */
42     int rShift, gShift, bShift;
43     int rRange, gRange, bRange;
44     /*
45     **  Free color entries
46      */
47     int nfree;
48     void *list;
49     /*
50     **  Cache the last request value here
51      */
52     void *last;
53 
54     /*
55     **  List of all widgets that are using this palette
56      */
57     paletteUserList *userList;
58 } Palette;
59 
60 Palette *PaletteCreate(Widget);
61 Pixel PaletteAlloc(Palette *, XColor *);
62 int PaletteAllocN(Palette *, XColor *, int, Pixel *);
63 Palette *PaletteFindDpy(Display *, Colormap);
64 Palette *PaletteFind(Widget, Colormap);
65 XColor *PaletteLookup(Palette *, Pixel);
66 void PaletteAddUser(Palette *, Widget);
67 void PaletteSetInvalid(Palette *, Pixel);
68 void PaletteDelete(Palette *);
69 Boolean PaletteLookupColor(Palette *, XColor *, Pixel *);
70 Boolean PaletteSetPixel(Palette *, Pixel, XColor *);
71 Palette *PaletteGetDefault(Widget);
72 Pixel PaletteGetUnused(Palette *);
73 
74 /*
75 **  Convenience
76  */
77 void PixmapInvert(Widget, Colormap, Pixmap);
78 
79 #endif				/* __palette_h__ */
80