← Back to team overview

kicad-developers team mailing list archive

Graphics Abstraction Layer (was Re: wxDC & wxGraphicsContext Test)


--- In kicad-devel@xxxxxxxxxxxxxxx, "Torsten Hüter" <torstenhtr@...> wrote:
> Hi Dick,
> > > Ideas yes, but I'm sceptical about the integration into wxWidgets.
> > Another question is, if it's really better than a Cairo or Open GL
> > implementation.
> > >   
> > 
> > Well we'd have to define "better". Don't know yet. Please be sure 
> > and look at both parts, not just the API (of which we don't ask much), 
> > the second part was the graphics stack, i.e. what is it built on.
> "Better" means currently for me mainly the drawing speed and the quality of the needed method for KiCad. I've ported my benchmark to QT - and can say in general that the coding style, the documentation, features are indeed superiour to wxWidgets. Also you can mix OpenGL + 2D drawing.
> The drawing speed (of the software renderer) seems to be not better than Cairo/wxGC. I had for my line example 0.5 frames/s (Cairo: 0.8 frames/s andwxGC 0.5 frames/s). If I'd rewrite KiCad I'd surely choose QT. 
> (I'll test QPainter over OpenGL later ..)
> For KiCad I still think it's easier to use OpenGL directly & Cairo. 
> > Please look at the library stack, and do your benchmark. I would gladly 
> > live with a C++ wrapper over a nice C or C++ foundation, just to avoid C.
> Of course, AFAIK KiCad is a C++ project.
> > I wrote the 2nd Java virtual machine ever implemented, and did it in C++.
> Well, if I'd have to choose, I'd implement everything in Java ..
> ---
> OK, I've started already and I'll implement the new graphics backend(s) for KiCad. I'll use a "Graphics Abstraction Layer" that we can use multiple graphics libraries, like OpenGL directly or Cairo (wxGC). I've studied Computer Graphics at our university, thus I think it's an interesting project for me.
> I've attached a small example, how it could rougly look like, written in JavaScript. You need just an actual browser (Firefox or Chrome (faster)).
> My specification for the GAL:
> • Draw graphics primitives (world space):
> ∘ Line
> ∘ Polyline
> ∘ Rectangle (filled / unfilled)
> ∘ Circle (filled / unfilled)
> ∘ Convex / concave polygon (filled / unfilled)
> ∘ Arc
> ∘ Stroked Text
> • Draw the cross-hair cursor
> • Draw the grid
> • Handle zoom
> • Handle screen <-> world transformation
> • Independent vector/matrix operations
> • Resizing
> • Be compatible to: Windows, Linux, (MAC)


I previously mentioned that I would being willing to work on this after thenext release. I'm more than happy to let you take this on if you have theambition and the time. If you are going take this on, please make sure that you create a robust base GAL object first. If I still see the global pointer variable ActiveScreen anywhere, I would consider this a serious design flaw. The first class derived from your base GAL class should be one that incorporates the current drawing code which should be used as the defaultuntil the new and improved GAL objects are implemented and validated. Anynew GAL objects should be enabled at build time with an appropriate cmake option in order to keep SVN head usable and so it can be disabled in case performance is unacceptable. Good Doxygen comments are going to be important so that the rest of the developers know how to use this new GAL object. Thank you for your efforts.


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