← Back to team overview

kicad-developers team mailing list archive

Re: Small update about the graphics backends

 

On 3/16/2010 6:11 PM, Dick Hollenbeck wrote:
> Torsten Hüter wrote:
>> Hi,
>>
>> I'd just like to post a small update about the progress of the graphics abstraction layer.
>>
>> 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 );
>>
>> 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'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.
>>
>> Bye ..
>> Torsten
>> 
> 
> 
> Torsten,
> 
> 
> This looks a significant expenditure of time and effort, and probably 
> money. The API looks clean, and usable.
> 
> This is your work, make sure you have your copyright on everything. 
> Then if you are willing to distribute it under the Kicad GPL say that in 
> each file also by including our copyright.h at the top.
> 
> 
> 
> What I personally would enjoy seeing is:
> 
> 
> 1) a CMake script which lets us build:
> 
> A) a static library containing the core functions/classes.
> B) some test applications, for benchmarking and concept testing, 
> e.g. rubber banding alternatives. Things that other folks want to play 
> with, not just you.
> 
> 
> 2) submission to your own repo branch at https://launchpad.net/kicad-newlib
> since we are switching to bazaar soon anyway. This could be your 
> tree initially, just join that project and create the branch. When the 
> code is ready and accepted, we can merge into the main branch.
> 
> 
> I think it would be prudent for you to get some feedback (and some 
> congrats?) before trying to actually integrate something this 
> significant into one of the Kicad apps.

Dick,

We could just override the ::Draw() method for each drawable object to
take a pointer or reference to the GRAPHICS_ABSTRACTION_LAYER object to
test out the library in one of the Kicad applications. It would also
require overriding the background drawing methods in DrawPanel(). Then
have a compile time option to enable the new graphics layer.

> Having more eyes on the work will be good for the work, and hopefully 
> for you too. But realize the pay is low around here, and everyone has a 
> somewhat different set of priorities. Near the top of everyone's list 
> of priorities is speed however. 
> 
> 
> If the work is good, my bet is that it will be very much appreciated. 
> But whether that will retroactively make for a profitable hourly wage or 
> not remains to be seen :)

I second that. Thanks for your effort Torsten. Although, I wouldn't
count on the profitability. I'm still waiting for my first check ;)

Wayne

> 
> 
> Thanks!
> 
> Dick






References