[Kde-graphics-devel] Re: [cairo] Qt example in cairo-demo

Zack Rusin zack at kde.org
Wed Jan 26 17:17:09 CET 2005


Before we get too much into this discussion I'll move it to 
kde-graphics-devel where more people can read about it :)

On Wednesday 26 January 2005 10:36, you wrote:
> You talk about adding a QPaintDevice using Cairo, don't you?

No. I'm talking about Qt4, where it is QPaintEngine. QPaintDevice would 
stay basically identical to the x11 one.

> I would also like to see a QPainter which implements more of the
> actual Cairo semantics (with implicit paths and full statefull
> rendering). Basically I would like to add methods like

There are two problems/questions here:
1) QPainter is not a derivable class. Meaning QCairoPainter (or whatever 
we'd call it) wouldn't be a class you could just pass to a method 
taking a QPainter. 
2) Because of 1 that means that we'd be looking into just creating a 
class that abstracts Cairo calls. But the question is: is it really 
easier to do:
QCairoPainter painter(cairo);
painter.moveto(20,0);
painter.relLineTo(40, 40);
painter.relLineTo(-40,0);
painter.closePath();
rather than
cairo_move_to( cr, 20, 0 );
cairo_rel_line_to( cr, 40,  40 );
cairo_rel_line_to( cr, -40, 0 );
cairo_close_path( cr );

Personally I'm not sure if it is. 
Right now I think that pretty much the best thing we can do is implement 
QCairoEngine and maybe get the handle() return the cairo_t that is 
currently used.
Then you could mix QPainter/raw Cairo calls or just use one of them.

Zack

-- 
If money is the root of all evil, why do churches want it so badly?


More information about the Kde-graphics-devel mailing list