+ //
+ // Set the color table to RGB mode
+ //
+ if (!::GpiCreateLogColorTable( (HPS)M_PENDATA->m_hPen
+ ,0L
+ ,LCOLF_RGB
+ ,0L
+ ,0L
+ ,NULL
+ ))
+ {
+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError("Unable to set current color table to RGB mode. Error: %s\n", sError);
+ return FALSE;
+ }
+ if (M_PENDATA->m_nStyle == wxTRANSPARENT)
+ {
+ return TRUE;
+ }
+
+ COLORREF vPmColour = 0L;
+ USHORT uLineType = wx2os2PenStyle(M_PENDATA->m_nStyle);
+
+ vPmColour = M_PENDATA->m_vColour.GetPixel();
+
+ USHORT uJoin = 0L;
+
+ switch(M_PENDATA->m_nJoin)
+ {
+ case wxJOIN_BEVEL:
+ uJoin = LINEJOIN_BEVEL;
+ break;
+
+ case wxJOIN_MITER:
+ uJoin = LINEJOIN_MITRE;
+ break;
+
+ case wxJOIN_ROUND:
+ uJoin = LINEJOIN_ROUND;
+ break;
+ }
+
+ USHORT uCap = 0L;
+
+ switch(M_PENDATA->m_nCap)
+ {
+ case wxCAP_PROJECTING:
+ uCap = LINEEND_SQUARE;
+ break;
+
+ case wxCAP_BUTT:
+ uCap = LINEEND_FLAT;
+ break;
+
+ case wxCAP_ROUND:
+ uCap = LINEEND_ROUND;
+ break;
+ }
+ m_vLineBundle.lColor = (LONG)vPmColour;
+ m_vLineBundle.usMixMode = FM_OVERPAINT;
+ m_vLineBundle.fxWidth = M_PENDATA->m_nWidth;
+ m_vLineBundle.lGeomWidth = M_PENDATA->m_nWidth;
+ m_vLineBundle.usType = uLineType;
+ m_vLineBundle.usEnd = uCap;
+ m_vLineBundle.usJoin = uJoin;
+
+ bOk = ::GpiSetAttrs( M_PENDATA->m_hPen
+ ,PRIM_LINE
+ ,LBB_COLOR | LBB_MIX_MODE | LBB_WIDTH | LBB_GEOM_WIDTH | LBB_TYPE | LBB_END | LBB_JOIN
+ ,0L
+ ,&m_vLineBundle
+ );
+ if (!bOk)
+ {
+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError("Can't set Gpi attributes for a LINEBUNDLE. Error: %s\n", sError);
+ return FALSE;
+ }
+
+ switch(M_PENDATA->m_nStyle)
+ {
+ case wxSTIPPLE:
+ ::GpiSetBitmapId( M_PENDATA->m_hPen
+ ,(USHORT)M_PENDATA->m_vStipple.GetHBITMAP()
+ ,(USHORT)M_PENDATA->m_vStipple.GetId()
+ );
+ ::GpiSetPatternSet( M_PENDATA->m_hPen
+ ,(USHORT)M_PENDATA->m_vStipple.GetId()
+ );
+ break;
+
+ case wxBDIAGONAL_HATCH:
+ m_vAreaBundle.usSymbol = PATSYM_DIAG3;
+ m_vAreaBundle.usSet = LCID_DEFAULT;
+ break;
+
+ case wxCROSSDIAG_HATCH:
+ m_vAreaBundle.usSymbol = PATSYM_DIAGHATCH;
+ m_vAreaBundle.usSet = LCID_DEFAULT;
+ break;
+
+ case wxFDIAGONAL_HATCH:
+ m_vAreaBundle.usSymbol = PATSYM_DIAG1;
+ m_vAreaBundle.usSet = LCID_DEFAULT;
+ break;
+
+ case wxCROSS_HATCH:
+ m_vAreaBundle.usSymbol = PATSYM_HATCH;
+ m_vAreaBundle.usSet = LCID_DEFAULT;
+ break;
+
+ case wxHORIZONTAL_HATCH:
+ m_vAreaBundle.usSymbol = PATSYM_HORIZ;
+ m_vAreaBundle.usSet = LCID_DEFAULT;
+ break;
+
+ case wxVERTICAL_HATCH:
+ m_vAreaBundle.usSymbol = PATSYM_VERT;
+ m_vAreaBundle.usSet = LCID_DEFAULT;
+ break;
+
+ default:
+ m_vAreaBundle.usSymbol = PATSYM_SOLID;
+ m_vAreaBundle.usSet = LCID_DEFAULT;
+ break;
+ }
+
+ m_vAreaBundle.lColor = vPmColour;
+ m_vAreaBundle.lBackColor = RGB_WHITE;
+ m_vAreaBundle.usMixMode = FM_OVERPAINT;
+ m_vAreaBundle.usBackMixMode = BM_OVERPAINT;
+
+ bOk = ::GpiSetAttrs( M_PENDATA->m_hPen
+ ,PRIM_AREA
+ ,ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE |
+ ABB_SET | ABB_SYMBOL
+ ,ABB_REF_POINT
+ ,&m_vAreaBundle
+ );
+ if (!bOk)
+ {
+ vError = ::WinGetLastError(vHabmain);
+ sError = wxPMErrorToStr(vError);
+ wxLogError("Can't set Gpi attributes for an AREABUNDLE. Error: %s\n", sError);
+ }
+ return bOk;
+ }
+ return FALSE;
+} // end of wxPen::RealizeResource
+
+WXHANDLE wxPen::GetResourceHandle()
+{
+ if (!M_PENDATA)
+ return 0;