kicad-developers team mailing list archive
Mailing list archive
Re: Small update about the graphics backends [1 Attachment]
Alain Mouette <alainm@...>
Mon, 15 Mar 2010 23:17:53 -0300
Thunderbird 184.108.40.206 (X11/20090817)
Torsten Hüter escreveu:
I'd just like to post a small update about the progress of the graphics abstraction layer.
Thanks for your work :)
Drawing primitives like lines, polylines, circles, rectangles, polygons work so far - for both Cairo and Opengl. My implementation draws also a grid and handles the transformation world <-> screen. Also panning and zooming is working with the test examples. I've tested it with Linux/Windows and wxWidgets 2.9.
I've declared a base class called GRAPHICS_ABSTRACTION_LAYER, this is an abstract class, containing mainly pure virtual methods. From this class are OPENGL_GAL and CAIRO_GAL derived, these classes have also the class wxWindow as parent.
Drawing works this way, first you create an instance of the GAL inside a frame constructor:
gal = new CAIRO_GAL( this, size );
It it reaosonable to supose that you will have a function somehat like this:
GRAPHICS_ABSTRACTION_LAYER* MakeNewGal( [...] )
return (new CAIRO_GAL( this, size ));
So that all configurations are treated in a singel place?
Then you can use it for drawing, for example:
gal -> BeginDrawing();
gal -> SetStrokeColor( COLOR4D( 1, 0, 1, 0.6 ) );
gal -> SetLineWidth( 10.0 );
gal -> DrawPolyline( pointList );
gal -> EndDrawing();
That's roughly how it's used - there are of course much more methods for setting up the transformation, grid etc.
My next goal is to implement a grouping function - that's in OpenGL simply a display list - for Cairo I'll implement a miniature VM for repeating the commands (this works already for a simple group). This function should give a good speedup. Paths are currently handled automatically - a new path is created if you're changing an attribute like the pen size.
My goal is to get an easy to use graphics backend for KiCad, which supports software and hardware rendering as well. When I'm happy with all tests, I'd start for instance with the Gerber viewer. But I guess this needs some time.
I believe that your job will be most usefull for many applications :)
I've attached a screenshot of some tests (hope the attachment is not too large, left Cairo, right OpenGL) - of course all created windows are usable simultaneous.
No attachments received here :(