public class ImageSurface extends Surface
surface = new ImageSurface(Format.ARGB32, 100, 100); cr = new Context(surface); // do drawing surface.writeToPNG(filename);
While ImageSurfaces are good for writing images out to disk, they are not
optimized per se to be efficient as a back end, nor are they accelerated by
your graphics card. So they are not an appropriate intermediate in drawing
operations; don't be calling
setSource() on one of these.
More importantly, ImageSurface is not an image loader! Remember that
Surfaces are what Cairo draws to. If what you are doing is building
up images for display to the screen, then load your images into
XlibSurfaces and use those as sources.
Deep in the guts, Cairo's ImageSurface is like GDK's Pixbuf, a format
that C programmers can directly address directly in memory via pointers.
That's useful for very low level programming, but not needed for
application development. If you're drawing, use Cairo's higher level
drawing primitives; if you need to introspect an image, then load it with
Pixbuf and use Pixbuf's
getPixels() to peek around in its data.
|Constructor and Description|
Construct an ImageSurface of the specified visual depth and size.
copyPage, createSimilar, finish, flush, setMimeData, setMimeData, showPage, writeToPNG
public ImageSurface(Format format, int width, int height)