From: Vadim Zeitlin Date: Sat, 9 Mar 2013 15:08:25 +0000 (+0000) Subject: Implement support for pen cap and join in wxPostScriptDC. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bde7eee92ecf2f55965639013c5e872ba5500d9e Implement support for pen cap and join in wxPostScriptDC. Use PostScript "setlinecap" and "setlinejoin" commands to do it. Closes #1244. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 61946d5174..2c8e9c3339 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1136,8 +1136,12 @@ void wxPostScriptDCImpl::SetPen( const wxPen& pen ) if (!pen.IsOk()) return; int oldStyle = m_pen.IsOk() ? m_pen.GetStyle() : wxPENSTYLE_INVALID; + wxPenCap oldCap = m_pen.IsOk() ? m_pen.GetCap() : wxCAP_INVALID; + wxPenJoin oldJoin = m_pen.IsOk() ? m_pen.GetJoin() : wxJOIN_INVALID; m_pen = pen; + wxPenCap cap = m_pen.IsOk() ? m_pen.GetCap() : wxCAP_INVALID; + wxPenJoin join = m_pen.IsOk() ? m_pen.GetJoin() : wxJOIN_INVALID; double width; @@ -1201,6 +1205,35 @@ void wxPostScriptDCImpl::SetPen( const wxPen& pen ) PsPrint( " setdash\n" ); } + if ( cap != wxCAP_INVALID && cap != oldCap ) + { + switch ( cap ) + { + case wxCAP_ROUND: buffer = "1"; break; + case wxCAP_PROJECTING: buffer = "2"; break; + case wxCAP_BUTT: buffer = "0"; break; + + // This case is just to fix compiler warning, this is impossible + // due to the test above. + case wxCAP_INVALID: break; + } + buffer << " setlinecap\n"; + PsPrint( buffer ); + } + + if ( join != wxJOIN_INVALID && join != oldJoin ) + { + switch ( join ) + { + case wxJOIN_BEVEL: buffer = "2"; break; + case wxJOIN_ROUND: buffer = "1"; break; + case wxJOIN_MITER: buffer = "0"; break; + case wxJOIN_INVALID: break; + } + buffer << " setlinejoin\n"; + PsPrint( buffer ); + } + // Line colour unsigned char red = m_pen.GetColour().Red(); unsigned char blue = m_pen.GetColour().Blue();