34 wxWindow* aWindow,
bool aShapeOnRight )
36 double scaleFactor = aWindow->GetDPIScaleFactor();
37 wxSize physSize( aWindow->ToPhys( aSize.GetWidth() ), aWindow->ToPhys( aSize.GetHeight() ) );
38 wxBitmap bitmap( physSize );
42 wxMemoryDC dc( bitmap );
44 dc.SetBackground( *wxTRANSPARENT_BRUSH );
47 int w = physSize.GetWidth();
48 int h = physSize.GetHeight();
50 int marginL =
KiROUND( h / 2.0 );
51 int marginR =
KiROUND( h / 2.0 );
52 int marginT =
KiROUND( h / 6.0 );
53 int marginB =
KiROUND( h / 6.0 );
55 int lineStartX = marginL;
56 int lineEndX = w - marginR;
57 int lineDrawStartX = lineStartX;
58 int lineDrawEndX = lineEndX;
62 int shapeHeight = h - marginT - marginB;
88 std::vector<VECTOR2I> polygon;
89 ending.
GetShapes( tip, tangent, fakeLineWidth, polygon );
91 if( !polygon.empty() )
93 std::vector<wxPoint> wxPts;
94 wxPts.reserve( polygon.size() );
97 wxPts.emplace_back( pt.x, pt.y );
102 lineDrawEndX = lineEndX - shortenDepth;
104 lineDrawStartX = lineStartX + shortenDepth;
106 dc.SetPen( wxPen( aForeground,
static_cast<int>( scaleFactor ) ) );
110 dc.SetBrush( *wxTRANSPARENT_BRUSH );
111 dc.SetPen( wxPen( aForeground, std::max( 1,
static_cast<int>( 1.5 * scaleFactor ) ) ) );
112 dc.DrawLines(
static_cast<int>( wxPts.size() ), wxPts.data() );
116 dc.SetBrush( wxBrush( aForeground ) );
117 dc.DrawPolygon(
static_cast<int>( wxPts.size() ), wxPts.data() );
122 dc.SetPen( wxPen( aForeground,
static_cast<int>( scaleFactor ) ) );
123 dc.DrawLine( lineDrawStartX, midY, lineDrawEndX, midY );
125 dc.SelectObject( wxNullBitmap );
126 bitmap.SetScaleFactor( scaleFactor );
void GetShapes(const VECTOR2I &aPoint, const EDA_ANGLE &aTangent, int aLineWidth, std::vector< VECTOR2I > &aPolygon) const
Generate ending geometry as polygon vertices at the given point and direction.
wxBitmap MakeLineEndingBitmap(LINE_ENDING_STYLE aStyle, const wxSize &aSize, const wxColour &aForeground, wxWindow *aWindow, bool aShapeOnRight)
Generate a DPI-aware bitmap icon showing a line ending style.