gEDA-dev: Gschem and Cairo graphics library
Tomaz Solc
tomaz.solc at tablix.org
Sun Jul 30 07:16:53 EDT 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi everyone
I've been experimenting with the Cairo graphics library.
Cairo is a free 2D graphics library that provides drawing operations
similar to PostScript. It can draw beautifully anti-aliased output to
the screen or to a PostScript or SVG file. It is already integrated into
GTK+ 2.8 and in the future it will also support hardware acceleration
(See http://cairographics.org)
I've made a proof-of-concept patch that uses Cairo instead of plain GDK
to draw solid line objects to the screen. Since solid line seems to be
the most-used object in Gschem (it is used to draw text for example) I
think this is a pretty good demonstration of Cairo's capabilities. You
can find the patch and screenshots at the following address:
http://www.tablix.org/~avian/gschem-cairo
Some notes about the patch:
o Antialiasing helps to make schematics and labels readable at smaller
zoom factors (see screenshots). It also creates some new problems: when
antialiased objects are deleted from the screen (for example: a green
line is overwritten by a black line), a dim outline remains.
o On my computer (Athlon XP 2500+) GSchem becomes too slow to be useful
with this patch. Possible optimizations: Don't create a new Cairo
context when drawing each line (trivial, doesn't help much). Use
optimized Cairo text renderer instead of custom font made with line
segments (complicated).
o Less code duplication: with Cairo it would be possible to use a single
drawing function for PostScript and screen output. It is fairly simple
to convert code that uses GDK to Cairo.
o Currently, all screen coordinates are stored as integers. I had to
modify libgeda to get coordinates as floating point numbers. If Cairo
would be used throughout GSchem, I believe some non-trivial
modifications to libgeda would have to be made.
o Breaks compatibility with older GTK versions.
Best regards
Tomaz Solc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFEzJUlsAlAlRhL9q8RAlVWAKCswdJHritEJusIPbHH0RWJlMh42QCfXqEd
ApKzFDT3JOVBYaFQq4con+4=
=8FmM
-----END PGP SIGNATURE-----
More information about the geda-dev
mailing list