/////////////////////////////////////////////////////////////////////////////
-// Name: palette.cpp
+// Name: src/x11/palette.cpp
// Purpose: wxPalette
// Author: Julian Smart
// Modified by:
// Created: 17/09/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/*
wxWidgets, notably wxPalette::Create(). The way I did it is to
allocate additional read-only color cells in the default colormap. In
general you will get arbitrary pixel values assigned to these new
-cells and therefore I added a method wxColourMap::TransferBitmap()
+cells and therefore I added a method wxPalette::TransferBitmap()
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.
not the functionality that wxPalette::Create() aims to provide.
*/
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "palette.h"
-#endif
-
#include "wx/palette.h"
#include "wx/window.h"
#include "wx/app.h"
m_pix_array_n = 0;
m_pix_array = (unsigned long*) 0;
m_display = (WXDisplay*) 0;
- m_destroyable = FALSE;
+ m_destroyable = false;
}
wxPaletteRefData::wxPaletteRefData()
#endif
delete [] pix_array;
}
-
+
if (destroyable)
XFreeColormap(display, cmap);
UnRef();
if (!n) {
- return FALSE;
+ return false;
}
m_refData = new wxPaletteRefData;
pix_array = new unsigned long[n];
if (!pix_array)
- return FALSE;
+ return false;
pix_array_n = n;
xcol.flags = DoRed | DoGreen | DoBlue;
c->m_pix_array = pix_array;
c->m_cmap = (WXColormap) cmap;
c->m_display = (WXDisplay*) display;
- c->m_destroyable = FALSE;
+ c->m_destroyable = false;
M_PALETTEDATA->m_palettes.Append(c);
- return TRUE;
+ return true;
}
-int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
+int wxPalette::GetPixel(unsigned char red, unsigned char green, unsigned char blue) const
{
if ( !m_refData )
- return FALSE;
+ return wxNOT_FOUND;
// TODO
- return FALSE;
+ return wxNOT_FOUND;
}
bool wxPalette::GetRGB(int index, unsigned char *WXUNUSED(red), unsigned char *WXUNUSED(green), unsigned char *WXUNUSED(blue)) const
{
if ( !m_refData )
- return FALSE;
+ return false;
if (index < 0 || index > 255)
- return FALSE;
+ return false;
// TODO
- return FALSE;
+ return false;
}
WXColormap wxPalette::GetXColormap(WXDisplay* display) const
c->m_pix_array = new unsigned long[pix_array_n];
c->m_display = display;
c->m_cmap = wxTheApp->GetMainColormap(display);
- c->m_destroyable = FALSE;
+ c->m_destroyable = false;
xcol.flags = DoRed | DoGreen | DoBlue;
int i;
uptr++;
}
- return TRUE;
+ return true;
}
default:
- return FALSE;
+ return false;
}
}
break;
}
default:
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
M_PALETTEDATA->m_palettes.Append(c);
}
-