palette.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/x11/palette.h
  3. // Purpose: wxPalette class
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 17/09/98
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_PALETTE_H_
  11. #define _WX_PALETTE_H_
  12. #include "wx/list.h"
  13. class WXDLLIMPEXP_FWD_CORE wxPalette;
  14. // Palette for one display
  15. class wxXPalette : public wxObject
  16. {
  17. DECLARE_DYNAMIC_CLASS(wxXPalette)
  18. public:
  19. wxXPalette();
  20. WXDisplay* m_display;
  21. int m_pix_array_n;
  22. unsigned long* m_pix_array;
  23. WXColormap m_cmap;
  24. bool m_destroyable;
  25. };
  26. class WXDLLIMPEXP_CORE wxPaletteRefData: public wxGDIRefData
  27. {
  28. friend class WXDLLIMPEXP_FWD_CORE wxPalette;
  29. public:
  30. wxPaletteRefData();
  31. virtual ~wxPaletteRefData();
  32. protected:
  33. wxList m_palettes;
  34. };
  35. #define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
  36. class WXDLLIMPEXP_CORE wxPalette : public wxPaletteBase
  37. {
  38. DECLARE_DYNAMIC_CLASS(wxPalette)
  39. public:
  40. wxPalette();
  41. wxPalette(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
  42. virtual ~wxPalette();
  43. bool Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
  44. int GetPixel(unsigned char red, unsigned char green, unsigned char blue) const;
  45. bool GetRGB(int pixel, unsigned char *red, unsigned char *green, unsigned char *blue) const;
  46. // X-specific
  47. WXColormap GetXColormap(WXDisplay* display = NULL) const;
  48. bool TransferBitmap(void *data, int depth, int size);
  49. bool TransferBitmap8(unsigned char *data, unsigned long size, void *dest, unsigned int bpp);
  50. unsigned long *GetXPixArray(WXDisplay* display, int *pix_array_n);
  51. void PutXColormap(WXDisplay* display, WXColormap cmap, bool destroyable);
  52. protected:
  53. virtual wxGDIRefData *CreateGDIRefData() const;
  54. virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
  55. };
  56. #endif // _WX_PALETTE_H_