1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxPalette class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_PALETTE_H_
13 #define _WX_PALETTE_H_
16 #pragma interface "palette.h"
19 #include "wx/gdiobj.h"
22 class WXDLLEXPORT wxPalette
;
24 // Palette for one display
25 class wxXPalette
: public wxObject
27 DECLARE_DYNAMIC_CLASS(wxXPalette
)
34 unsigned long* m_pix_array
;
39 class WXDLLEXPORT wxPaletteRefData
: public wxGDIRefData
41 friend class WXDLLEXPORT wxPalette
;
50 #define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
52 class WXDLLEXPORT wxPalette
: public wxGDIObject
54 DECLARE_DYNAMIC_CLASS(wxPalette
)
58 inline wxPalette(const wxPalette
& palette
) { Ref(palette
); }
59 inline wxPalette(const wxPalette
* palette
) { UnRef(); if (palette
) Ref(*palette
); }
61 wxPalette(int n
, const unsigned char *red
, const unsigned char *green
, const unsigned char *blue
);
63 bool Create(int n
, const unsigned char *red
, const unsigned char *green
, const unsigned char *blue
);
64 int GetPixel(const unsigned char red
, const unsigned char green
, const unsigned char blue
) const;
65 bool GetRGB(int pixel
, unsigned char *red
, unsigned char *green
, unsigned char *blue
) const;
67 virtual bool Ok() const { return (m_refData
!= NULL
) ; }
69 inline wxPalette
& operator = (const wxPalette
& palette
) { if (*this == palette
) return (*this); Ref(palette
); return *this; }
70 inline bool operator == (const wxPalette
& palette
) { return m_refData
== palette
.m_refData
; }
71 inline bool operator != (const wxPalette
& palette
) { return m_refData
!= palette
.m_refData
; }
74 WXColormap
GetXColormap(WXDisplay
* display
= NULL
) const;
75 bool TransferBitmap(void *data
, int depth
, int size
);
76 bool TransferBitmap8(unsigned char *data
, unsigned long size
, void *dest
, unsigned int bpp
);
77 unsigned long *GetXPixArray(WXDisplay
* display
, int *pix_array_n
);
78 void PutXColormap(WXDisplay
* display
, WXColormap cmap
, bool destroyable
);