[ANN] CairoPad (wxCairoContext?)
Robert Roebling
robert at roebling.de
Fri Dec 14 04:52:15 PST 2007
> ps. I did some experiment with Cairo using wx/cpp, before using it with
> wxLua. I modified a local copy of src/generic/graphicc.cpp to use Cairo
> in win32. Drawing sample's alpha test worked. But, I think, to use Cairo
> API directly, a wxCairoContext and wxCairoCanvas (similar to
> wxGLContext,wxGLCanvas) would be a good addition.
I wonder what this would do. Wouldn't it be enough to to add a
function like
cairo_t* GetCairoFromWindow( wxWindow *);
and be done with it? From then on you'd just use the Cairo API
which is documented. We might need to keep track of update
regions when painting or help convert from a wxRegion to whatever
Cairo uses. OK, maybe a class which also takes care of destroying
the cairo_t would be a plus. So we might have a
wxCairoContext ctx( this );
cairo_draw_line( ctx );
and in a wxScrolledWindow we'd have to do something like this
wxCairoContext ctx( this );
ctx.OnPrepare( this );
cairo_draw_line( ctx, 10, 10, 100, 100 );
Is there any sense in wrapping the entire Cairo library plus
its Pango cousin? I can agree that writing
ctx.draw_line( 10, 10, 100, 100 );
would be a little nicer, but it doesn't seem to be worth the
effort.
Any other ideas or suggestions welcome.
Robert
More information about the wx-users
mailing list