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
This commit is contained in:
Vadim Zeitlin 2013-03-09 15:08:25 +00:00
parent ccb2be5b12
commit bde7eee92e

View File

@ -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();