Howto wrap a cairo-context to a GdkDrawable



Hello,

I played a bit with Java's GTK-LookAndFeel and what they do for now
seems to be quite sad. Their problem is that they need to get
alpha-values, therefor they paint it twice and compare the results.

The procedure looks like this:
1.) Create two pixmaps, fill one white, one black
2.) paint the widget twice
3.) read pixmaps into pixbufs, compare both to get alpha-values.

The result is of course slow because:
- Painting is done twice
- Readbacks from vram / round-trips from/to X-Server
- Comparing the images is a CPU hog.

Is there any possibility to use GTK's theming functions to draw to a
system-ram-image which is able to preserve alpha? This would
elliminate round-tips and rendering twice at the cost of slightly
larger rendering times.
E.g. would it be possible to wrap an image-backed cairo-context in a
GdkDrawable, so that it would be possible to call e.g.
gdk_draw_rectangle so that all drawing is redirected to that
cairo-image and rendered without X?

If something does not exist, how hard do you think it would be to
write it? Would it be possible at all without altering large parts of
GTK?

Thank you in advance, Clemens


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]