alexpana/wxWidgets

Lines with width 0 are not drawn

Opened this issue · 6 comments

vadz commented

The lines screen in the drawing samples shows that the lines with 0 width are not drawn at all.

This is intentional. If the width is 0, why should there be a line drawn? It is also the implicit behavior of Direct2D.

vadz commented

Width 0 means "use physical pen" for GDI, i.e. it always draws a line one pixel wide independently of the current scaling etc. If this is too difficult to implement with D2D, it should at least be the same as using width 1.

Thanks for the explanation. Is this behavior consistent across platforms? In any case, I'll have a look at how to achieve the same effect in Direct2D.

yes, actually in graphics.cpp on OSX I fix it at 0.1 pt:
wxMacCoreGraphicsPenData::wxMacCoreGraphicsPenData( wxGraphicsRenderer* renderer, const wxPen& pen) I do
m_width = pen.GetWidth();
if (m_width <= 0.0)
m_width = (CGFloat) 0.1;

But is that independent of scaling? If I use x20 scaling (x & y), wouldn't it draw a 2 pixel width line?

actually that's what I inteded, to have a 'fine line' the convention for dc was a pen with width 0,eg like in a technical drawing, so if things are scaled 20x having a 2pt is fine IMHO