alexpana / wxWidgets

Read-only mirror of the wxWidgets SVN repo (automatically updated). Report issues here: http://trac.wxwidgets.org/
http://www.wxwidgets.org/
3 stars 0 forks source link

Lines with width 0 are not drawn #18

Open vadz opened 9 years ago

vadz commented 9 years ago

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

alexpana commented 9 years ago

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 9 years ago

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.

alexpana commented 9 years ago

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.

csomor commented 9 years ago

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;

alexpana commented 9 years ago

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

csomor commented 9 years ago

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