GraphicsContext and blurry odd-width vert/horiz lines

Hi,

I am using wxPython 2.8.7.1 on Ubuntu 8.04 and Windows XP SP2. When drawing vertical and horizontal lines with odd number widths (usually 1 pixel) I found in wxGTK that I have to offset them by 0.5 to prevent them from being blurred. However, in Windows, adding the offset will make them blurry - they are crisp without the offset.

I found a wxWidgets bug report about this
http://trac.wxwidgets.org/ticket/4187

and it looks like it was supposed to be fixed in wxPython 2.8.6.1
http://wxpython.org/recentchanges.php

Is the behavior here supposed to be the same across platforms? Are you supposed to have to offset these lines manually on all platforms, or on some, or none? I was thinking of working around it by doing something like this:

if platform==wxGTK:
  offset=0.5
elif platform==wxMSW:
  offset=0
else
  ??? (what about Mac?)

and then adding offset to all such lines. Is there anything better?

Thanks,
Ben

Ben Saylor wrote:

Hi,

I am using wxPython 2.8.7.1 on Ubuntu 8.04 and Windows XP SP2. When drawing vertical and horizontal lines with odd number widths (usually 1 pixel) I found in wxGTK that I have to offset them by 0.5 to prevent them from being blurred. However, in Windows, adding the offset will make them blurry - they are crisp without the offset.

I found a wxWidgets bug report about this
http://trac.wxwidgets.org/ticket/4187

and it looks like it was supposed to be fixed in wxPython 2.8.6.1
http://wxpython.org/recentchanges.php

Is the behavior here supposed to be the same across platforms?

Yes, it is. Please double check with 2.8.8.1 and if it still has the problem you can add a comment to that bug report with the details you discover.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Ben Saylor wrote:

Hi,

I am using wxPython 2.8.7.1 on Ubuntu 8.04 and Windows XP SP2. When drawing vertical and horizontal lines with odd number widths (usually 1 pixel) I found in wxGTK that I have to offset them by 0.5 to prevent them from being blurred. However, in Windows, adding the offset will make them blurry - they are crisp without the offset.

I found a wxWidgets bug report about this
http://trac.wxwidgets.org/ticket/4187

and it looks like it was supposed to be fixed in wxPython 2.8.6.1
http://wxpython.org/recentchanges.php

Is the behavior here supposed to be the same across platforms?

Yes, it is. Please double check with 2.8.8.1 and if it still has the problem you can add a comment to that bug report with the details you discover.

Thanks - it's the same with 2.8.8.1. I've added a comment and example code to the bug report.

Ben