kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #02032
antialiased graphics
--=-St4vmHE6N2fQWk7P0vN2 Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
I made some very simple tests for antialiasing graphics on wxGTK. Mostly
I experimented with wxpython demo package to get a grip how stuff is
done. Attached is two line patch and results with wxGCDC wrapper. It
seems there is quite a work to do for proper future proof graphics
update. Currently there is no caching so it takes a long time to draw
all primitives and for high quality, drawing needs to be ported to some
path based api. From the screenshot it can be clearly seen that every
path style primitives (circles, boxes) draw nicely, but (font)
connections get messed because of rounding errors or something. Redraw
is not implemented, so to get antialiased display minimizeâmaximize
cycle or 'painting' with other window has to be done. Also dot grid is
messed like fonts.
Some links I used for inspiration:
http://chandlerproject.org/bin/view/Projects/WxPythonGraphicsContext
http://docs.wxwidgets.org/trunk/classwx_graphics_context.html
http://wxforum.shadonet.com/viewtopic.php?t=17122
http://repo.or.cz/w/geda-gaf/pcjc2.git
The last one as an example of what caching gives and
http://www.cairographics.org/ capabilities demo, which is used on wxGTK.
Bug http://trac.wxwidgets.org/ticket/4187 almost got me â I saw what was
going on, but didn't know why.
-Vesa
--=-St4vmHE6N2fQWk7P0vN2 Content-Disposition: attachment; filename="kicad_antialiasing_test.patch"
Content-Type: text/x-patch; name="kicad_antialiasing_test.patch"; charset="UTF-8"
Content-Transfer-Encoding: 7bit
Index: ../common/drawpanel.cpp
===================================================================
--- ../common/drawpanel.cpp (revision 1489)
+++ ../common/drawpanel.cpp (working copy)
@@ -584,7 +584,10 @@
void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
/***************************************************/
{
- wxPaintDC paintDC( this );
+ wxPaintDC pDC( this );
+ wxGCDC paintDC(pDC); // Following line should be disabled on MSW and OS X
+ paintDC.GetGraphicsContext()->Translate(0.5, 0.5); // Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
+
EDA_Rect tmp;
wxRect PaintClipBox;
wxPoint org;
--=-St4vmHE6N2fQWk7P0vN2 Content-Disposition: attachment; filename="kicad_antialiasing_test.png"
Content-Type: image/png; name="kicad_antialiasing_test.png"
Content-Transfer-Encoding: base64
[Attachment content not displayed.] --=-St4vmHE6N2fQWk7P0vN2--
Follow ups