Line drawing correction.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
107a178768
commit
d4aa3a4b86
@ -584,15 +584,20 @@ void MyCanvas::DrawDefault(wxDC& dc)
|
||||
memdc.DrawRectangle(0,0,20,70);
|
||||
memdc.DrawLine( 10,0,10,70 );
|
||||
|
||||
// to the right
|
||||
memdc.SetPen(*wxRED_PEN);
|
||||
memdc.DrawLine( 10, 5,10, 5 );
|
||||
memdc.DrawLine( 10,10,11,10 );
|
||||
memdc.DrawLine( 10,15,12,15 );
|
||||
memdc.DrawLine( 10,20,13,20 );
|
||||
|
||||
/*
|
||||
memdc.SetPen(*wxRED_PEN);
|
||||
memdc.DrawLine( 12, 5,12, 5 );
|
||||
memdc.DrawLine( 12,10,13,10 );
|
||||
memdc.DrawLine( 12,15,14,15 );
|
||||
memdc.DrawLine( 12,20,15,20 );
|
||||
*/
|
||||
|
||||
// same to the left
|
||||
memdc.DrawLine( 10,25,10,25 );
|
||||
@ -601,6 +606,7 @@ void MyCanvas::DrawDefault(wxDC& dc)
|
||||
memdc.DrawLine( 10,40, 7,40 );
|
||||
|
||||
// XOR draw lines
|
||||
dc.SetPen(*wxWHITE_PEN);
|
||||
memdc.SetLogicalFunction( wxINVERT );
|
||||
memdc.SetPen( *wxWHITE_PEN );
|
||||
memdc.DrawLine( 10,50,10,50 );
|
||||
|
@ -1133,17 +1133,31 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
GdkCapStyle capStyle = GDK_CAP_ROUND;
|
||||
switch (m_pen.GetCap())
|
||||
{
|
||||
case wxCAP_ROUND: { capStyle = (width <= 1) ? GDK_CAP_NOT_LAST : GDK_CAP_ROUND; break; }
|
||||
case wxCAP_PROJECTING: { capStyle = GDK_CAP_PROJECTING; break; }
|
||||
case wxCAP_BUTT: { capStyle = GDK_CAP_BUTT; break; }
|
||||
case wxCAP_ROUND:
|
||||
default:
|
||||
{
|
||||
if (width <= 1)
|
||||
{
|
||||
width = 0;
|
||||
capStyle = GDK_CAP_NOT_LAST;
|
||||
}
|
||||
else
|
||||
{
|
||||
capStyle = GDK_CAP_ROUND;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GdkJoinStyle joinStyle = GDK_JOIN_ROUND;
|
||||
switch (m_pen.GetJoin())
|
||||
{
|
||||
case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; }
|
||||
case wxJOIN_ROUND: { joinStyle = GDK_JOIN_ROUND; break; }
|
||||
case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; }
|
||||
case wxJOIN_ROUND:
|
||||
default: { joinStyle = GDK_JOIN_ROUND; break; }
|
||||
}
|
||||
|
||||
gdk_gc_set_line_attributes( m_penGC, width, lineStyle, capStyle, joinStyle );
|
||||
|
@ -1133,17 +1133,31 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
GdkCapStyle capStyle = GDK_CAP_ROUND;
|
||||
switch (m_pen.GetCap())
|
||||
{
|
||||
case wxCAP_ROUND: { capStyle = (width <= 1) ? GDK_CAP_NOT_LAST : GDK_CAP_ROUND; break; }
|
||||
case wxCAP_PROJECTING: { capStyle = GDK_CAP_PROJECTING; break; }
|
||||
case wxCAP_BUTT: { capStyle = GDK_CAP_BUTT; break; }
|
||||
case wxCAP_ROUND:
|
||||
default:
|
||||
{
|
||||
if (width <= 1)
|
||||
{
|
||||
width = 0;
|
||||
capStyle = GDK_CAP_NOT_LAST;
|
||||
}
|
||||
else
|
||||
{
|
||||
capStyle = GDK_CAP_ROUND;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GdkJoinStyle joinStyle = GDK_JOIN_ROUND;
|
||||
switch (m_pen.GetJoin())
|
||||
{
|
||||
case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; }
|
||||
case wxJOIN_ROUND: { joinStyle = GDK_JOIN_ROUND; break; }
|
||||
case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; }
|
||||
case wxJOIN_ROUND:
|
||||
default: { joinStyle = GDK_JOIN_ROUND; break; }
|
||||
}
|
||||
|
||||
gdk_gc_set_line_attributes( m_penGC, width, lineStyle, capStyle, joinStyle );
|
||||
|
Loading…
Reference in New Issue
Block a user