gnu.java.awt.peer.gtk

Class CairoSurface


public class CairoSurface
extends DataBuffer

CairoSurface - wraps a Cairo surface.

Field Summary

Fields inherited from class java.awt.image.DataBuffer

TYPE_BYTE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_SHORT, TYPE_UNDEFINED, TYPE_USHORT, banks, dataType, offset, offsets, size

Constructor Summary

CairoSurface(int width, int height)
Create a cairo_surface_t with specified width and height.

Method Summary

void
copyAreaNative(int x, int y, int width, int height, int dx, int dy, int stride)
void
dispose()
Dispose of the native data.
void
drawSurface(long contextPointer, double[] i2u, double alpha)
protected void
finalize()
Call dispose() to clean up any native resources allocated.
static BufferedImage
getBufferedImage(CairoSurface surface)
Returns a BufferedImage backed by a Cairo surface.
static BufferedImage
getBufferedImage(GtkImage image)
Returns a BufferedImage backed by a Cairo surface, created from a GtkImage.
static BufferedImage
getBufferedImage(int width, int height)
Returns a BufferedImage backed by a Cairo surface.
int
getElem(int bank, int i)
DataBank.getElem implementation
Graphics2D
getGraphics()
Return a Graphics2D drawing to the CairoSurface.
GtkImage
getGtkImage()
Return a GtkImage from this Cairo surface.
int[]
getPixels(int size)
void
nativeDrawSurface(long surfacePointer, long contextPointer, double[] i2u, double alpha)
Draws this image to a given CairoGraphics context, with an affine transform given by i2u.
long
newCairoContext()
void
setElem(int bank, int i, int val)
DataBank.setElem implementation
void
setPixels(int[] pixels)

Methods inherited from class java.awt.image.DataBuffer

getDataType, getDataTypeSize, getElem, getElem, getElemDouble, getElemDouble, getElemFloat, getElemFloat, getNumBanks, getOffset, getOffsets, getSize, setElem, setElem, setElemDouble, setElemDouble, setElemFloat, setElemFloat

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

CairoSurface

public CairoSurface(int width,
                    int height)
Create a cairo_surface_t with specified width and height. The format will be ARGB32 with premultiplied alpha and native bit and word ordering.

Method Details

copyAreaNative

public void copyAreaNative(int x,
                           int y,
                           int width,
                           int height,
                           int dx,
                           int dy,
                           int stride)

dispose

public void dispose()
Dispose of the native data.

drawSurface

public void drawSurface(long contextPointer,
                        double[] i2u,
                        double alpha)

finalize

protected void finalize()
Call dispose() to clean up any native resources allocated.
Overrides:
finalize in interface Object

getBufferedImage

public static BufferedImage getBufferedImage(CairoSurface surface)
Returns a BufferedImage backed by a Cairo surface.

getBufferedImage

public static BufferedImage getBufferedImage(GtkImage image)
Returns a BufferedImage backed by a Cairo surface, created from a GtkImage.

getBufferedImage

public static BufferedImage getBufferedImage(int width,
                                             int height)
Returns a BufferedImage backed by a Cairo surface.

getElem

public int getElem(int bank,
                   int i)
DataBank.getElem implementation
Overrides:
getElem in interface DataBuffer

getGraphics

public Graphics2D getGraphics()
Return a Graphics2D drawing to the CairoSurface.

getGtkImage

public GtkImage getGtkImage()
Return a GtkImage from this Cairo surface.

getPixels

public int[] getPixels(int size)

nativeDrawSurface

public void nativeDrawSurface(long surfacePointer,
                              long contextPointer,
                              double[] i2u,
                              double alpha)
Draws this image to a given CairoGraphics context, with an affine transform given by i2u.

newCairoContext

public long newCairoContext()

setElem

public void setElem(int bank,
                    int i,
                    int val)
DataBank.setElem implementation
Overrides:
setElem in interface DataBuffer

setPixels

public void setPixels(int[] pixels)

CairoSurface.java Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.