/* Wolfram Gloger <u7y22ab@sunmail.lrz-muenchen.de>
I have implemented basic colormap support for the X11 versions of
/* Wolfram Gloger <u7y22ab@sunmail.lrz-muenchen.de>
I have implemented basic colormap support for the X11 versions of
allocate additional read-only color cells in the default colormap. In
general you will get arbitrary pixel values assigned to these new
allocate additional read-only color cells in the default colormap. In
general you will get arbitrary pixel values assigned to these new
which maps the pixel values 0..n to the real ones obtained with
Create(). This is only implemented for the popular case of 8-bit
depth.
which maps the pixel values 0..n to the real ones obtained with
Create(). This is only implemented for the popular case of 8-bit
depth.
IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxXPalette, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxXPalette, wxObject)
-
- wxNode *node, *next;
-
- for (node = m_palettes.First(); node; node = next) {
- wxXPalette *c = (wxXPalette *)node->Data();
+
+ wxList::compatibility_iterator node, next;
+
+ for (node = m_palettes.GetFirst(); node; node = next) {
+ wxXPalette *c = (wxXPalette *)node->GetData();
unsigned long *pix_array = c->m_pix_array;
Colormap cmap = (Colormap) c->m_cmap;
bool destroyable = c->m_destroyable;
int pix_array_n = c->m_pix_array_n;
display = (Display*) c->m_display;
unsigned long *pix_array = c->m_pix_array;
Colormap cmap = (Colormap) c->m_cmap;
bool destroyable = c->m_destroyable;
int pix_array_n = c->m_pix_array_n;
display = (Display*) c->m_display;
if (pix_array_n > 0)
{
// XFreeColors(display, cmap, pix_array, pix_array_n, 0);
if (pix_array_n > 0)
{
// XFreeColors(display, cmap, pix_array, pix_array_n, 0);
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
UnRef();
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
UnRef();
- xcol.red = (unsigned short)red[i] << 8;
- xcol.green = (unsigned short)green[i] << 8;
- xcol.blue = (unsigned short)blue[i] << 8;
+ xcol.red = (unsigned short)(red[i] << 8);
+ xcol.green = (unsigned short)(green[i] << 8);
+ xcol.blue = (unsigned short)(blue[i] << 8);
c->m_pix_array_n = pix_array_n;
c->m_pix_array = pix_array;
c->m_cmap = (WXColormap) cmap;
c->m_display = (WXDisplay*) display;
c->m_pix_array_n = pix_array_n;
c->m_pix_array = pix_array;
c->m_cmap = (WXColormap) cmap;
c->m_display = (WXDisplay*) display;
-int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
+int wxPalette::GetPixel(unsigned char WXUNUSED(red),
+ unsigned char WXUNUSED(green),
+ unsigned char WXUNUSED(blue)) const
-bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
+bool wxPalette::GetRGB(int index, unsigned char *WXUNUSED(red), unsigned char *WXUNUSED(green), unsigned char *WXUNUSED(blue)) const
c->m_pix_array_n = pix_array_n;
c->m_pix_array = new unsigned long[pix_array_n];
c->m_display = display;
c->m_cmap = wxTheApp->GetMainColormap(display);
c->m_pix_array_n = pix_array_n;
c->m_pix_array = new unsigned long[pix_array_n];
c->m_display = display;
c->m_cmap = wxTheApp->GetMainColormap(display);
xcol.flags = DoRed | DoGreen | DoBlue;
int i;
for (i = 0; i < pix_array_n; i++)
{
xcol.pixel = first->m_pix_array[i];
xcol.flags = DoRed | DoGreen | DoBlue;
int i;
for (i = 0; i < pix_array_n; i++)
{
xcol.pixel = first->m_pix_array[i];
- XQueryColor((Display*) first->m_display, (Colormap) first->m_cmap, &xcol);
+ XQueryColor((Display*) first->m_display,
+ (Colormap) first->m_cmap, &xcol);
struct rgb24 { unsigned char r, g, b; } *dptr = (struct rgb24 *)dest;
while(sz-- > 0) {
if((int)*data < pix_array_n) {
struct rgb24 { unsigned char r, g, b; } *dptr = (struct rgb24 *)dest;
while(sz-- > 0) {
if((int)*data < pix_array_n) {
- dptr->r = pix_array[*data] & 0xFF;
- dptr->g = (pix_array[*data] >> 8) & 0xFF;
- dptr->b = (pix_array[*data] >> 16) & 0xFF;
+ dptr->r = (unsigned char)(pix_array[*data] & 0xFF);
+ dptr->g = (unsigned char)((pix_array[*data] >> 8) & 0xFF);
+ dptr->b = (unsigned char)((pix_array[*data] >> 16) & 0xFF);
}
unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
{
if (!M_PALETTEDATA)
return (unsigned long*) 0;
}
unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
{
if (!M_PALETTEDATA)
return (unsigned long*) 0;
/* Not found; call GetXColormap, which will create it, then this again */
if (GetXColormap(display))
return GetXPixArray(display, n);
/* Not found; call GetXColormap, which will create it, then this again */
if (GetXColormap(display))
return GetXPixArray(display, n);