org.freedesktop.cairo
Class ImageSurface
Object
org.freedesktop.bindings.Pointer
org.freedesktop.bindings.Proxy
org.freedesktop.cairo.Surface
org.freedesktop.cairo.ImageSurface
public class ImageSurface
- extends Surface
A Surface which is an image in memory and can be written to disk. If
drawing to an image you intend to write to a PNG, you would end up doing
something like:
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
XlibSurface
s 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.
- Since:
- 4.0.7
- Author:
- Andrew Cowie
Constructor Summary |
ImageSurface(Format format,
int width,
int height)
Construct an ImageSurface of the specified visual depth and size. |
Methods inherited from class org.freedesktop.bindings.Pointer |
toString |
Methods inherited from class Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ImageSurface
public ImageSurface(Format format,
int width,
int height)
- Construct an ImageSurface of the specified visual depth and size.
- Since:
- 4.0.7