+ // scan the bitmap for the transparent colour and set
+ // the corresponding pixels in the mask to BLACK and
+ // the rest to WHITE
+ COLORREF vMaskColour = OS2RGB(rColour.Red(), rColour.Green(), rColour.Blue());
+
+ vHeader.cbFix = sizeof(vHeader);
+ vHeader.cx = (USHORT)rBitmap.GetWidth();
+ vHeader.cy = (USHORT)rBitmap.GetHeight();
+ vHeader.cPlanes = 1;
+ vHeader.cBitCount = 1;
+
+ m_hMaskBitmap = (WXHBITMAP) ::GpiCreateBitmap( m_hPs
+ ,&vHeader
+ ,0L
+ ,NULL
+ ,NULL
+ );
+
+ HPS srcPS = ::GpiCreatePS(vHabmain, m_hDc, &vSize, PU_PELS | GPIT_MICRO | GPIA_ASSOC);
+ ::GpiSetBitmap(srcPS, (HBITMAP)rBitmap.GetHBITMAP());
+ HPS destPS = ::GpiCreatePS(vHabmain, m_hDc, &vSize, PU_PELS | GPIT_MICRO | GPIA_ASSOC);
+ ::GpiSetBitmap(srcPS, (HBITMAP)m_hMaskBitmap);
+
+ // this is not very efficient, but I can't think
+ // of a better way of doing it
+ for (int w = 0; w < rBitmap.GetWidth(); w++)
+ {
+ for (int h = 0; h < rBitmap.GetHeight(); h++)
+ {
+ POINTL vPoint;
+
+ vPoint.x = w;
+ vPoint.y = h;
+
+ COLORREF col = ::GpiQueryPel(srcPS, &vPoint);
+
+ if (col == vMaskColour)
+ {
+ ::GpiSetColor(destPS, CLR_WHITE);
+ ::GpiSetPel(destPS, &vPoint);
+ }
+ else
+ {
+ ::GpiSetColor(destPS, CLR_BLACK);
+ ::GpiSetPel(destPS, &vPoint);
+ }
+ }
+ }
+ ::GpiDestroyPS(srcPS);
+ ::GpiDestroyPS(destPS);
+ return(TRUE);
+}
+
+// ----------------------------------------------------------------------------
+// wxBitmapHandler
+// ----------------------------------------------------------------------------
+
+bool wxBitmapHandler::Create(
+ wxGDIImage* pImage
+, void* pData
+, long lFlags
+, int nWidth
+, int nHeight
+, int nDepth
+)
+{
+ wxBitmap* pBitmap = wxDynamicCast( pImage
+ ,wxBitmap
+ );
+
+ return(pBitmap ? Create( pBitmap
+ ,pData
+ ,nWidth
+ ,nHeight
+ ,nDepth
+ ) : FALSE);
+}
+
+bool wxBitmapHandler::Load(
+ wxGDIImage* pImage
+, const wxString& rName
+, HPS hPs
+, long lFlags
+, int nWidth
+, int nHeight
+)
+{
+ wxBitmap* pBitmap = wxDynamicCast( pImage
+ ,wxBitmap
+ );
+
+ return(pBitmap ? LoadFile( pBitmap
+ ,rName
+ ,hPs
+ ,lFlags
+ ,nWidth
+ ,nHeight
+ ) : FALSE);
+}
+
+bool wxBitmapHandler::Save(
+ wxGDIImage* pImage
+, const wxString& rName
+, int lType
+)
+{
+ wxBitmap* pBitmap = wxDynamicCast( pImage
+ ,wxBitmap
+ );
+
+ return(pBitmap ? SaveFile( pBitmap
+ ,rName
+ ,lType
+ ) : FALSE);
+}
+
+bool wxBitmapHandler::Create(
+ wxBitmap* WXUNUSED(pBitmap)
+, void* WXUNUSED(pData)
+, long WXUNUSED(lType)
+, int WXUNUSED(nWidth)
+, int WXUNUSED(nHeight)
+, int WXUNUSED(nDepth)
+)
+{
+ return(FALSE);
+}
+
+bool wxBitmapHandler::LoadFile(
+ wxBitmap* WXUNUSED(pBitmap)
+, const wxString& WXUNUSED(rName)
+, HPS WXUNUSED(hPs)
+, long WXUNUSED(lType)
+, int WXUNUSED(nDesiredWidth)
+, int WXUNUSED(nDesiredHeight)
+)
+{
+ return(FALSE);
+}
+
+bool wxBitmapHandler::SaveFile(
+ wxBitmap* WXUNUSED(pBitmap)
+, const wxString& WXUNUSED(rName)
+, int WXUNUSED(nType)
+, const wxPalette* WXUNUSED(pPalette)
+)
+{
+ return(FALSE);