/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "palette.h"
#endif
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "palette.h"
#endif
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
- UnRef();
-
- m_refData = new wxPaletteRefData;
-
- M_PALETTEDATA->m_count = n ;
- M_PALETTEDATA->m_palette = new wxColour[n] ;
-
- for ( int i = 0 ; i < n ; ++i)
- {
- M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
- }
-
- return FALSE;
+ UnRef();
+
+ m_refData = new wxPaletteRefData;
+
+ M_PALETTEDATA->m_count = n ;
+ M_PALETTEDATA->m_palette = new wxColour[n] ;
+
+ for ( int i = 0 ; i < n ; ++i)
+ {
+ M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
+ }
+
+ return FALSE;
}
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
{
if ( !m_refData )
}
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
{
if ( !m_refData )
- const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
- currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue ) ;
- if ( currentdiff < bestdiff )
- {
- bestdiff = currentdiff ;
- bestpos = i ;
- if ( bestdiff == 0 )
- break ;
- }
+ const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
+ currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue ) ;
+ if ( currentdiff < bestdiff )
+ {
+ bestdiff = currentdiff ;
+ bestpos = i ;
+ if ( bestdiff == 0 )
+ break ;
+ }
bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
{
if ( !m_refData )
bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
{
if ( !m_refData )