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