home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / xpaint-247 / palette.h < prev    next >
C/C++ Source or Header  |  1997-01-03  |  2KB  |  84 lines

  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.3 1996/04/15 14:16:01 torsten 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. #ifndef VMS
  32.     int readonly;
  33. #else
  34.     int Readonly;
  35. #endif
  36.     Display *display;
  37.     Colormap cmap;
  38.     Visual *visual;
  39.     int depth;
  40.     void *htable, *ltable;
  41.     void *ctable;
  42.     Pixel mine;
  43.     /*
  44.     **  TrueColor visual support
  45.      */
  46.     int rShift, gShift, bShift;
  47.     int rRange, gRange, bRange;
  48.     /*
  49.     **  Free color entries
  50.      */
  51.     int nfree;
  52.     void *list;
  53.     /*
  54.     **  Cache the last request value here
  55.      */
  56.     void *last;
  57.  
  58.     /*
  59.     **  List of all widgets that are using this palette
  60.      */
  61.     paletteUserList *userList;
  62. } Palette;
  63.  
  64. Palette *PaletteCreate(Widget);
  65. Pixel PaletteAlloc(Palette *, XColor *);
  66. int PaletteAllocN(Palette *, XColor *, int, Pixel *);
  67. Palette *PaletteFindDpy(Display *, Colormap);
  68. Palette *PaletteFind(Widget, Colormap);
  69. XColor *PaletteLookup(Palette *, Pixel);
  70. void PaletteAddUser(Palette *, Widget);
  71. void PaletteSetInvalid(Palette *, Pixel);
  72. void PaletteDelete(Palette *);
  73. Boolean PaletteLookupColor(Palette *, XColor *, Pixel *);
  74. Boolean PaletteSetPixel(Palette *, Pixel, XColor *);
  75. Palette *PaletteGetDefault(Widget);
  76. Pixel PaletteGetUnused(Palette *);
  77.  
  78. /*
  79. **  Convenience
  80.  */
  81. void PixmapInvert(Widget, Colormap, Pixmap);
  82.  
  83. #endif                /* __palette_h__ */
  84.