← Back to team overview

kicad-developers team mailing list archive

Re: Graphics Abstraction Layer (was Re: wxDC &

 

Torsten Hüter wrote:
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.

What is the status of Cairo on OSX? I know Cairo is workable solution on Linux and Windows. Any new dependencies you add, must be usable on at least these three platforms.


--

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.

The printing on Linux is a problem. I'm not sure why the stroke fonts in Kicad look so bad when printing on Linux. They print fine on Windows. I haven't heard any complaints from the MAC folks so I'm guessing that it works OK there. Maybe Cairo will improve the Linux printing problem.

Wayne


Bye ..
Torsten






Follow ups

References