+ if ( M_PALETTEDATA && M_PALETTEDATA->m_hPalette)
+ {
+ ::GpiSelectPalette(M_PALETTEDATA->m_hPS, NULLHANDLE);
+ ::GpiDeletePalette((HPAL)M_PALETTEDATA->m_hPalette);
+ }
+ return TRUE;
+} // end of wxPalette::FreeResource
+
+bool wxPalette::Create(
+ int n
+, const unsigned char* pRed
+, const unsigned char* pGreen
+, const unsigned char* pBlue
+)
+{
+ PULONG pualTable;
+
+ UnRef();
+
+ m_refData = new wxPaletteRefData;
+ pualTable = new ULONG[n];
+ if (!pualTable)
+ return(FALSE);
+
+ for (int i = 0; i < n; i ++)
+ {
+ pualTable[i] = (PC_RESERVED * 16777216) + ((int)pRed[i] * 65536) + ((int)pGreen[i] * 256) + (int)pBlue[i];
+ }
+ M_PALETTEDATA->m_hPalette = (WXHPALETTE)::GpiCreatePalette( vHabmain
+ ,LCOL_PURECOLOR
+ ,LCOLF_CONSECRGB
+ ,(LONG)n
+ ,pualTable
+ );
+ delete [] pualTable;
+ return TRUE;
+} // end of wxPalette::Create
+
+int wxPalette::GetPixel(
+ const unsigned char cRed
+, const unsigned char cGreen
+, const unsigned char cBlue
+) const
+{
+ bool bFound = FALSE;
+ PULONG pualTable = NULL;
+ ULONG ulNumEntries;
+ ULONG ulRGB = (PC_RESERVED * 16777216) +
+ ((int)cRed * 65536) +
+ ((int)cGreen * 256) +
+ (int)cBlue;
+
+ if (!m_refData)
+ return FALSE;