← Back to team overview

kicad-developers team mailing list archive

Re: Graphics Abstraction Layer (was Re: wxDC &

 

Hi Wayne,

>Take a look at 
>wxDCBase in the wxWidgets source for a good example of how to implement 
>the base GAL class. Notice that the public non-virtual drawing 
>functions do nothing more than call the private virtual functions ( 
>public DrawLine() calls private DoDrawLine() ). All the work is done by 
>the DoDrawLine() method for each derived class.

Just another example how dirty the wxWidgets code is, in my opinion that's against the principles of object-oriented programming.
Like Dick etc. has written, calling virtual methods needs perhaps a few table lookups - that's fast and compared to the mathematical operations insignificant.

> I apologize for the incorrect information but I just realized this
> solution is not going to work. Replacing wxDC in the Kicad drawing code will
> break printing and postscript output. Your GAL object will have to be based on
> wxDC (similar to how wxGCDC is designed) or you will have to write
> separate drawing code for screen output and use the current drawing code for
> printing and postscript output.

This shouldn't be a problem, because Cairo is able to handle PDF, SVG and PS surfaces. I'd just create a second Draw(..) method and keep the old one intact (thus you have always a fall back solution). I could also write a direct postscript driver, because the commands are very similar compared to Cairo.

--

I've found printing so far a bit redundant, because it doesn't seem to work well at the moment (?) At least the stroke fonts look very strange - I've always used plotting to PostScript.

Bye ..
Torsten
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01






Follow ups

References