Francis Kung wrote:
Hi,
The attached patch starts implementing support for custom Composite
classes, starting with VolatileImageGraphics.
I've also attached the simple test I've been using, MyComposite.java
which wraps the AlphaComposite class (thus preventing Cairo from
handling alpha composite internally), and CustomComposite.java (which
draws two arcs and an optional image, all with custom composite.. check
the source code for a couple of options).
"ecj CustomComposite.java MyComposite.java ; cacao CustomComposite" to
run.
As this is, or at least feels like, a large change, I'd appreciate some
feedback before committing it. If this approach looks good, I'll
continue with it for the other CairoGraphics2D subclasses.
This looks great. Two questions:
There are several blocks like this:
+ if (comp == null || comp instanceof AlphaComposite)
+ super.draw(s);
+
+ // Custom composite
+ else
Would it be cleaner to create a CustomVolatileImageGraphics that extends
VolatileImageGraphics?
Also, this block:
+ pixbuf = gdk_pixbuf_new( GDK_COLORSPACE_RGB, TRUE, 8, width, height );
+ gdk_pixbuf_get_from_drawable( pixbuf, pixmap, NULL, 0, 0, 0, 0, width,
height );
+ pixels = gdk_pixbuf_get_pixels(pixbuf);
Is pixmap guaranteed to be entirely on-screen for this call? If not, some of
the resultant pixbuf will be black or undefined.
Otherwise, this looks good to commit.
Tom