[cairo-commit] cairo-java/src/java/org/freedesktop/cairo FillRule.java, NONE, 1.1 BoundingBox.java, NONE, 1.1 FontSlant.java, NONE, 1.1 Extend.java, NONE, 1.1 CairoObject.java, NONE, 1.1 Distance.java, NONE, 1.1 Filter.java, NONE, 1.1 Config.java.in, NONE, 1.1 PdfSurface.java, NONE, 1.1 CairoException.java, NONE, 1.1 TextExtents.java, NONE, 1.1 FreetypeFont.java, NONE, 1.1 RGBColor.java, NONE, 1.1 Status.java, NONE, 1.1 Glyph.java, NONE, 1.1 Cairo.java, NONE, 1.1 Matrix.java, NONE, 1.1 FontWeight.java, NONE, 1.1 Affine.java, NONE, 1.1 Pattern.java, NONE, 1.1 LineCap.java, NONE, 1.1 Font.java, NONE, 1.1 LineJoin.java, NONE, 1.1 PngSurface.java, NONE, 1.1 PsSurface.java, NONE, 1.1 Operator.java, NONE, 1.1 Point.java, NONE, 1.1 Surface.java, NONE, 1.1 ImageSurface.java, NONE, 1.1 FontExtents.java, NONE, 1.1 Format.java, NONE, 1.1

Jeffrey Morgan commit at pdx.freedesktop.org
Wed Feb 23 10:17:54 PST 2005


Committed by: kuzman

Update of /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo
In directory gabe:/tmp/cvs-serv32536/src/java/org/freedesktop/cairo

Added Files:
	FillRule.java BoundingBox.java FontSlant.java Extend.java 
	CairoObject.java Distance.java Filter.java Config.java.in 
	PdfSurface.java CairoException.java TextExtents.java 
	FreetypeFont.java RGBColor.java Status.java Glyph.java 
	Cairo.java Matrix.java FontWeight.java Affine.java 
	Pattern.java LineCap.java Font.java LineJoin.java 
	PngSurface.java PsSurface.java Operator.java Point.java 
	Surface.java ImageSurface.java FontExtents.java Format.java 
Log Message:
Initial import

--- NEW FILE: FillRule.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Enum;

public class FillRule extends Enum {

    static final private int _WINDING = 0;
    static final public FillRule WINDING = new FillRule (_WINDING);
    static final private int _EVEN_ODD = 1;
    static final public FillRule EVEN_ODD = new FillRule (_EVEN_ODD);
    static final private FillRule[] theInterned = new FillRule[] {
        WINDING, EVEN_ODD
    };
    static private java.util.Hashtable theInternedExtras;
    static final private FillRule theSacrificialOne = new FillRule (0);
    static public FillRule intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        FillRule already = (FillRule) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new FillRule(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private FillRule(int value) {
        value_ = value;
    }

    public FillRule or (FillRule other) {
        return intern(value_ | other.value_);
    }

    public FillRule and (FillRule other) {
        return intern(value_ & other.value_);
    }

    public FillRule xor (FillRule other) {
        return intern(value_ ^ other.value_);
    }

    public boolean test (FillRule other) {
        return (value_ & other.value_) == other.value_;
    }
}

--- NEW FILE: BoundingBox.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

public class BoundingBox {
    
    double x1;
    double y1;
    double x2;
    double y2;
    
    public BoundingBox(double x1, double y1, double x2, double y2) {
        this.x1 = x1;
        this.y1 = y1;
        this.x2 = x2;
        this.y2 = y2;
    }
    

    public double getX1() {
        return x1;
    }
    public void setX1(double x1) {
        this.x1 = x1;
    }
    public double getX2() {
        return x2;
    }
    public void setX2(double x2) {
        this.x2 = x2;
    }
    public double getY1() {
        return y1;
    }
    public void setY1(double y1) {
        this.y1 = y1;
    }
    public double getY2() {
        return y2;
    }
    public void setY2(double y2) {
        this.y2 = y2;
    }
}

--- NEW FILE: FontSlant.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/
package org.freedesktop.cairo;

import org.gnu.glib.Enum;

public class FontSlant extends Enum {
    static final private int _NORMAL = 0;
    static final public FontSlant NORMAL = new FontSlant (_NORMAL);
    static final private int _ITALIC = 1;
    static final public FontSlant ITALIC = new FontSlant (_ITALIC);
    static final private int _OBLIQUE = 2;
    static final public FontSlant OBLIQUE = new FontSlant (_OBLIQUE);
    static final private FontSlant[] theInterned = new FontSlant[] {
    	NORMAL, ITALIC, OBLIQUE
    };
    static private java.util.Hashtable theInternedExtras;
    static final private FontSlant theSacrificialOne = new FontSlant (0);
    static public FontSlant intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        FontSlant already = (FontSlant) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new FontSlant(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private FontSlant(int value) {
        value_ = value;
    }

    public boolean test (FontSlant other) {
        return (value_ & other.value_) == other.value_;
    }
}

--- NEW FILE: Extend.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Enum;

/**
 */
public class Extend extends Enum {

	static final private int _NONE = 0;
    static final public Extend NONE = new Extend (_NONE);
    static final private int _REPEAT = 1;
    static final public Extend REPEAT = new Extend (_REPEAT);
    static final private int _REFLECT = 2;
    static final public Extend REFLECT = new Extend (_REFLECT);
    static final private Extend[] theInterned = new Extend[] {
    	NONE, REPEAT, REFLECT
    };
    static private java.util.Hashtable theInternedExtras;
    static final private Extend theSacrificialOne = new Extend (0);
    static public Extend intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        Extend already = (Extend) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new Extend(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private Extend(int value) {
        value_ = value;
    }

    public boolean test (Extend other) {
        return (value_ & other.value_) == other.value_;
    }
}

--- NEW FILE: CairoObject.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/

package org.freedesktop.cairo;

import org.gnu.glib.Boxed;
import org.gnu.glib.Handle;

/**
 */
class CairoObject extends Boxed {

	CairoObject(Handle hndl) {
		super(hndl);
	}

    // static init code
    static {
        System.loadLibrary("cairojni-" + org.freedesktop.cairo.Config.CAIRO_API_VERSION);
    }
	
}

--- NEW FILE: Distance.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/

package org.freedesktop.cairo;

/**
 */
public class Distance {

	private double xDistance;
	private double yDistance;
	
	public Distance(double xDistance, double yDistance) {
		this.xDistance = xDistance;
		this.yDistance = yDistance;
	}
	
	/**
	 * @return Returns the xDistance.
	 */
	public double getXDistance() {
		return xDistance;
	}
	/**
	 * @param distance The xDistance to set.
	 */
	public void setXDistance(double distance) {
		xDistance = distance;
	}
	/**
	 * @return Returns the yDistance.
	 */
	public double getYDistance() {
		return yDistance;
	}
	/**
	 * @param distance The yDistance to set.
	 */
	public void setYDistance(double distance) {
		yDistance = distance;
	}
}

--- NEW FILE: Filter.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Enum;

/**
 */
public class Filter extends Enum {
    static final private int _FAST = 0;
    static final public Filter FAST = new Filter (_FAST);
    static final private int _GOOD = 1;
    static final public Filter GOOD = new Filter (_GOOD);
    static final private int _BEST = 2;
    static final public Filter BEST = new Filter (_BEST);
    static final private int _NEAREST = 3;
    static final public Filter NEAREST = new Filter (_NEAREST);
    static final private int _BILINEAR = 4;
    static final public Filter BILINEAR = new Filter (_BILINEAR);
    static final private int _GAUSSIAN = 5;
    static final public Filter GAUSSIAN = new Filter (_GAUSSIAN);
    static final private Filter[] theInterned = new Filter[] {
        FAST, GOOD, BEST, NEAREST, BILINEAR, GAUSSIAN
    };
    static private java.util.Hashtable theInternedExtras;
    static final private Filter theSacrificialOne = new Filter (0);
    static public Filter intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        Filter already = (Filter) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new Filter(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private Filter(int value) {
        value_ = value;
    }

    public Filter or (Filter other) {
        return intern(value_ | other.value_);
    }

    public Filter and (Filter other) {
        return intern(value_ & other.value_);
    }

    public Filter xor (Filter other) {
        return intern(value_ ^ other.value_);
    }

    public boolean test (Filter other) {
        return (value_ & other.value_) == other.value_;
    }

}

--- NEW FILE: Config.java.in ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */

package org.freedesktop.cairo;

/*
 * This interface makes values calculated by configure available to
 * the Cairo bindings.
 */
public interface Config
{
  /**
   * Version of Cairo that these bindings wrap.
   */
  String CAIRO_API_VERSION = "@apiversion@";
}

--- NEW FILE: PdfSurface.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Handle;

/**
 * TODO: When / How does the file get closed ?
 * TODO: Is file opened twice ?
 */
public class PdfSurface extends Surface {

	private String filename;
	private double width;
	private double height;
	private double xPixels;
	private double yPixels;
	
	public PdfSurface(String filename, double widthInches, double heightInches,
				double xPixelsPerInch, double yPixelsPerInch) {
		super(cairo_pdf_surface_create(filename, widthInches, heightInches,
					xPixelsPerInch, yPixelsPerInch));
		this.filename = filename;
		width = widthInches;
		height = heightInches;
		xPixels = xPixelsPerInch;
		yPixels = yPixelsPerInch;
	}
	
	void makeTarget(Cairo cr){
		cairo_set_target_pdf(cr.getHandle(), filename, width, height, xPixels, yPixels);
	}

	/*
	 * Native calls
	 */
	native static final private void cairo_set_target_pdf(Handle cr, String filename, 
				double width_inches, double height_inches,
				double x_pixels_per_inch, double y_pixels_per_inch);
	native static final private Handle cairo_pdf_surface_create(String filename,
			double width_inches, double height_inches,
			double x_pixels_per_inch, double y_pixels_per_inch);
}

--- NEW FILE: CairoException.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

public class CairoException extends Exception {

}

--- NEW FILE: TextExtents.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/

package org.freedesktop.cairo;

import org.gnu.glib.Handle;

public class TextExtents extends CairoObject {

	TextExtents(Handle hndl) {
		super(hndl);
	}
	
	public double getXBearing() {
		return get_x_bearing(getHandle());
	}
	
	public double getYBearing(){
		return get_y_bearning(getHandle());
	}
	
	public double getWidth() {
		return get_width(getHandle());
	}
	
	public double getHeight() {
		return get_height(getHandle());
	}
	
	public double getXAdvance() {
		return get_x_advance(getHandle());
	}
	
	public double getYAdvance() {
		return get_y_advance(getHandle());
	}
	
	/*
	 * Native calls
	 */
	native static final private double get_x_bearing(Handle obj);
	native static final private double get_y_bearning(Handle obj);
	native static final private double get_width(Handle obj);
	native static final private double get_height(Handle obj);
	native static final private double get_x_advance(Handle obj);
	native static final private double get_y_advance(Handle obj);
}

--- NEW FILE: FreetypeFont.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Handle;

/**
 */
public class FreetypeFont extends Font {

    /**
     * Creates a new freetype font using the given parameters.
     * 
     * @param family The font family
     * @param slant Font slant
     * @param weight Font weight
     */
    public FreetypeFont(String family, FontSlant slant, FontWeight weight) {
        super(cairo_ft_font_create(family, slant.getValue(), weight.getValue()));
    }
    
    /**
     * Creates a new freetype font using given font parameters. In this version of constructor, the
     * font slant and weight parameters are strings.
     * 
     * @param family The font family
     * @param slant Font slant, such as italic, normal, oblique.
     * @param weight Font weight, such as bold, normal, narrow.
     */
    public FreetypeFont(String family, String slant, String weight) {
        super(cairo_ft_font_create(family, slant, weight));
    }
       
    /*
     * Native methods
     */
    native static Handle cairo_ft_font_create (String family, int slant, int weight);
    native static Handle cairo_ft_font_create (String family, String slant, String weight);

}

--- NEW FILE: RGBColor.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

public class RGBColor {
	
	private double red;
	private double green;
	private double blue;
	
	public RGBColor(double red, double green, double blue) {
		this.red = red;
		this.green = green;
		this.blue = blue;
	}

	/**
	 * @return Returns the blue.
	 */
	public double getBlue() {
		return blue;
	}
	/**
	 * @param blue The blue to set.
	 */
	public void setBlue(double blue) {
		this.blue = blue;
	}
	/**
	 * @return Returns the green.
	 */
	public double getGreen() {
		return green;
	}
	/**
	 * @param green The green to set.
	 */
	public void setGreen(double green) {
		this.green = green;
	}
	/**
	 * @return Returns the red.
	 */
	public double getRed() {
		return red;
	}
	/**
	 * @param red The red to set.
	 */
	public void setRed(double red) {
		this.red = red;
	}
}

--- NEW FILE: Status.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */

package org.freedesktop.cairo;

import org.gnu.glib.Enum;

public class Status extends Enum {
    static final private int _SUCCESS = 0;
    static final public Status SUCCESS = new Status (_SUCCESS);
    static final private int _NO_MEMORY = 1;
    static final public Status NO_MEMORY = new Status (_NO_MEMORY);
    static final private int _INVALID_RESTORE = 2;
    static final public Status INVALID_RESTORE = new Status (_INVALID_RESTORE);
    static final private int _INVALID_POP_GROUP = 3;
    static final public Status INVALID_POP_GROUP = new Status (_INVALID_POP_GROUP);
    static final private int _NO_CURRENT_POINT = 4;
    static final public Status NO_CURRENT_POINT = new Status (_NO_CURRENT_POINT);
    static final private int _INVALID_MATRIX = 5;
    static final public Status INVALID_MATRIX = new Status (_INVALID_MATRIX);
    static final private int _NO_TARGET_SURFACE = 6;
    static final public Status NO_TARGET_SURFACE = new Status (_NO_TARGET_SURFACE);
    static final private int _NULL_POINTER = 7;
    static final public Status NULL_POINTER = new Status (_NULL_POINTER);
    static final private int _INVALID_STRING = 8;
    static final public Status INVALID_STRING = new Status (_INVALID_STRING);
    static final private Status[] theInterned = new Status[] {
        SUCCESS, NO_MEMORY, INVALID_RESTORE, INVALID_POP_GROUP, NO_CURRENT_POINT,
        INVALID_MATRIX, NO_TARGET_SURFACE, NULL_POINTER, INVALID_STRING
    };
    static private java.util.Hashtable theInternedExtras;
    static final private Status theSacrificialOne = new Status (0);
    static public Status intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        Status already = (Status) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new Status(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private Status(int value) {
        value_ = value;
    }

    public boolean test (Status other) {
        return (value_ & other.value_) == other.value_;
    }
}

--- NEW FILE: Glyph.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/
package org.freedesktop.cairo;

import org.gnu.glib.Handle;

public class Glyph extends CairoObject {
	
	Glyph(Handle hndl) {
		super(hndl);
	}
    
    public long getIndex() {
        return get_index(getHandle());
    }
    
    public double getX() {
        return get_x(getHandle());
    }
    
    public double getY() {
        return get_y(getHandle());
    }

    /*
     * native calls
     */
    native static final private long get_index(Handle obj);
    native static final private double get_x(Handle obj);
    native static final private double get_y(Handle obj);
}
--- NEW FILE: Cairo.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.GObject;
import org.gnu.glib.Handle;

class Cairo extends CairoObject {
	
	/**
	 * Create a new cairo target (cairo_t) 
	 */
	public Cairo() {
[...1054 lines suppressed...]
	native static final private void cairo_text_path(Handle obj, String utf8);
	native static final private void cairo_glyph_path(Handle obj, Handle[] glyphs);
	native static final private void cairo_show_surface(Handle obj, Handle surface, int width, int height);
	native static final private int cairo_current_operator(Handle obj);
	native static final private void cairo_current_rgb_color(Handle obj, double[] red, double[] green, double[] blue);
	native static final private Handle cairo_current_pattern(Handle obj);
	native static final private double cairo_current_alpha(Handle obj);
	native static final private double cairo_current_tolerance(Handle obj);
	native static final private void cairo_current_point(Handle obj, double[] x, double[] y);
	native static final private int cairo_current_fill_rule(Handle obj);
	native static final private double cairo_current_line_width(Handle obj);
	native static final private int cairo_current_line_cap(Handle obj);
	native static final private int cairo_current_line_join(Handle obj);
	native static final private double cairo_current_miter_limit(Handle obj);
	native static final private void cairo_current_matrix(Handle obj, Handle matrix);
	native static final private Handle cairo_current_target_surface(Handle obj);
	native static final private int cairo_status(Handle obj);
	native static final private String cairo_status_string(Handle obj);
	
}
--- NEW FILE: Matrix.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.GObject;
import org.gnu.glib.Handle;

/**
 * TODO: error handling
 */
public class Matrix extends CairoObject {

	Matrix(Handle hndl) {
		super(hndl);
	}
	
    /**
     * Default constructor. Creates a default identity matrix.
     *
     */
	public Matrix() {
		super(cairo_matrix_create());
	}
	
	public Matrix(Matrix copy) {
		super(copy(copy));
	}
	
    /**
     * Constructs a matrix using the affine parameters.
     * 
     * @param affine The affine parameters.
     */
    public Matrix(Affine affine) {
        super(cairo_matrix_create());
        setAffine(affine);
    }
    
	private static Handle copy(Matrix copy) {
		Handle hndl = GObject.getNullHandle();
		int status = cairo_matrix_copy(hndl, copy.getHandle());
		return hndl;
	}
	
    /**
     * Disposes all the native resources used by the matrix.
     */
	public void dispose() {
		cairo_matrix_destroy(getHandle());
	}
	
    /**
     * Sets the matrix to identity matrix (no transformations).
     */
	public void setIdentity() {
		int status = cairo_matrix_set_identity(getHandle());
	}
	
	public void setAffine(Affine affine) {
		int status = cairo_matrix_set_affine(getHandle(), affine.getA(), affine.getB(), 
					affine.getC(), affine.getD(), affine.getTx(), affine.getTy());
	}
	
	public Affine getAffine() {
		double[] a = new double[1];
		double[] b = new double[1];
		double[] c = new double[1];
		double[] d = new double[1];
		double[] tx = new double[1];
		double[] ty = new double[1];
		cairo_matrix_get_affine(getHandle(), a, b, c, d, tx, ty);
		return new Affine(a[0], b[0], c[0], d[0], tx[0], ty[0]);
	}
	
    /**
     * Appends a transaltion transformation to this matrix.
     * 
     * @param tx X axis translation
     * @param ty Y axis translation
     */
	public void translate(double tx, double ty) {
		int status = cairo_matrix_translate(getHandle(), tx, ty);
	}
	
    /**
     * Appends non-uniform scaling to this matrix.
     * 
     * @param sx X axis scaling factor
     * @param sy Y axis scaling factor
     */
	public void scale(double sx, double sy) {
		int status = cairo_matrix_scale(getHandle(), sx, sy);
	}
	
    /**
     * Appends uniform scaling transformation to this matrix.
     * 
     * @param scaleFactor The uniform scaling factor.
     */
    public void scale(double scaleFactor) {
        scale(scaleFactor, scaleFactor);
    }

	/**
     * Appends rotation transformation to this matrix.
     * 
     * @param radians The rotation angle in radians.
     */
	public void rotate(double radians) {
		int status = cairo_matrix_rotate(getHandle(), radians);
	}
	
    /**
     * Appends rotation around a given point, to this transformation.
     * 
     * @param radians Rotation angle in radians.
     * @param cx The X co-ordinate of the center of rotation
     * @param cy The Y co-ordinate of the center of rotation
     */
    public void rotate(double radians, double cx, double cy) {
        cairo_matrix_translate(getHandle(), cx, cy);
        cairo_matrix_rotate(getHandle(), radians);
        cairo_matrix_translate(getHandle(), -cx, -cy);
    }

    /**
     * Inverts this matrix.
     *
     */
	public void invert() {
		int status = cairo_matrix_invert(getHandle());
	}
	
    /**
     * Multiplies 2 matrices and returns the result.
     * 
     * @param a first matrix
     * @param b second matrix
     * @return The product
     */
	static public Matrix multiply(Matrix a, Matrix b) {
		Handle hndl = GObject.getNullHandle();
		int status = cairo_matrix_multiply(hndl, a.getHandle(), b.getHandle());
		return new Matrix(hndl);
	}
	
    /**
     * Transforms the given distance and returns transformed co-ordinates
     * 
     */
	public Distance transformDistance(Distance d) {
		double[] dx = new double[] {d.getXDistance()};
		double[] dy = new double[] {d.getYDistance()};
		cairo_matrix_transform_distance(getHandle(), dx, dy);
		return new Distance(dx[0], dy[0]);
	}
	
    /**
     * Transforms the given point and returns transformed co-ordinates
     * 
     */
	public Point transformPoint(Point point) {
		double[] dx = new double[] {point.getX()};
		double[] dy = new double[] {point.getY()};
		cairo_matrix_transform_distance(getHandle(), dx, dy);
		return new Point(dx[0], dy[0]);
	}

	/*
	 * Native calls
	 */
	native static final private Handle cairo_matrix_create();
	native static final private void cairo_matrix_destroy(Handle matrix);
	native static final private int cairo_matrix_copy(Handle matrix, Handle other);
	native static final private int cairo_matrix_set_identity(Handle matrix);
	native static final private int cairo_matrix_set_affine(Handle matrix, double a, double b,
				double c, double d, double tx, double ty);
	native static final private int cairo_matrix_get_affine(Handle matrix, double[] a, double[] b,
				double[] c, double[] d, double[] tx, double[] ty);
	native static final private int cairo_matrix_translate(Handle matrix, double tx, double ty);
	native static final private int cairo_matrix_scale(Handle matrix, double sx, double sy);
	native static final private int cairo_matrix_rotate(Handle matrix, double radians);
	native static final private int cairo_matrix_invert(Handle matrix);
	native static final private int cairo_matrix_multiply(Handle result, Handle a, Handle b);
	native static final private int cairo_matrix_transform_distance(Handle handle, double[] dx, double[] dy);
	native static final private int cairo_matrix_transform_point(Handle handle, double[] x, double[] y);
}

--- NEW FILE: FontWeight.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/
package org.freedesktop.cairo;

import org.gnu.glib.Enum;

public class FontWeight extends Enum {
    static final private int _NORMAL = 0;
    static final public FontWeight NORMAL = new FontWeight (_NORMAL);
    static final private int _BOLD = 1;
    static final public FontWeight BOLD = new FontWeight (_BOLD);
    static final private FontWeight[] theInterned = new FontWeight[] {
    	NORMAL, BOLD
    };
    static private java.util.Hashtable theInternedExtras;
    static final private FontWeight theSacrificialOne = new FontWeight (0);
    static public FontWeight intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        FontWeight already = (FontWeight) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new FontWeight(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private FontWeight(int value) {
        value_ = value;
    }

    public boolean test (FontWeight other) {
        return (value_ & other.value_) == other.value_;
    }

}

--- NEW FILE: Affine.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

/**
 */
public class Affine {

	private double a;
	private double b;
	private double c;
	private double d;
	private double tx;
	private double ty;
	
	public Affine(double a, double b, double c, double d, double tx, double ty) {
		this.a = a;
		this.b = b;
		this.c = c;
		this.d = d;
		this.tx = tx;
		this.ty = ty;
	}
	
	/**
	 * @return Returns the a.
	 */
	public double getA() {
		return a;
	}
	/**
	 * @param a The a to set.
	 */
	public void setA(double a) {
		this.a = a;
	}
	/**
	 * @return Returns the b.
	 */
	public double getB() {
		return b;
	}
	/**
	 * @param b The b to set.
	 */
	public void setB(double b) {
		this.b = b;
	}
	/**
	 * @return Returns the c.
	 */
	public double getC() {
		return c;
	}
	/**
	 * @param c The c to set.
	 */
	public void setC(double c) {
		this.c = c;
	}
	/**
	 * @return Returns the d.
	 */
	public double getD() {
		return d;
	}
	/**
	 * @param d The d to set.
	 */
	public void setD(double d) {
		this.d = d;
	}
	/**
	 * @return Returns the tx.
	 */
	public double getTx() {
		return tx;
	}
	/**
	 * @param tx The tx to set.
	 */
	public void setTx(double tx) {
		this.tx = tx;
	}
	/**
	 * @return Returns the ty.
	 */
	public double getTy() {
		return ty;
	}
	/**
	 * @param ty The ty to set.
	 */
	public void setTy(double ty) {
		this.ty = ty;
	}
}

--- NEW FILE: Pattern.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.GObject;
import org.gnu.glib.Handle;

/**
 * TODO: error handling
 */
public class Pattern extends CairoObject {
	
	public Pattern(Surface surface) {
		super(cairo_pattern_create_for_surface(surface.getHandle()));
	}
	
	public Pattern(double x1, double y1, double x2, double y2) {
		super(cairo_pattern_create_linear(x1, y1, x2, y2));
	}
	
	public Pattern(double x1, double y1, double radius1, double x2, double y2, double radius2) {
		super(cairo_pattern_create_radial(x1, y1, radius1, x1, y2, radius2));
	}
	
	Pattern(Handle hndl) {
		super(hndl);
	}
	
	public void dispose() {
		cairo_pattern_destroy(getHandle());
	}
	
    /**
     * Adds a new color stop to the pattern.
     * 
     * @param offset The offset length
     * @param color The color to use
     * @param alpha alpha for the color
     */
	public void addColorStop(double offset, RGBColor color, double alpha) {
		int status = cairo_pattern_add_color_stop(getHandle(), offset, color.getRed(),
					color.getGreen(), color.getBlue(), alpha);
	}
	
    /**
     * Sets the transformation matrix for this pattern.
     * 
     * @param matrix The transformation matrix.
     */
	public void setMatrix(Matrix matrix) {
		int status = cairo_pattern_set_matrix(getHandle(), matrix.getHandle());
	}
	
    /**
     * Returns the current transform matrix of this pattern. Note that this method returns a
     * new matrix object and you must dispose it.
     * 
     * @return The transformation matrix for the pattern.
     */
	public Matrix getMatrix() {
		Handle hndl = GObject.getNullHandle();
		int status = cairo_pattern_get_matrix(getHandle(), hndl);
		return new Matrix(hndl);
	}
	
    /**
     * Sets the extend option for the pattern.
     * 
     * @param extend The Extend to use. 
     */
	public void setExtend(Extend extend) {
		int status = cairo_pattern_set_extend(getHandle(), extend.getValue());
	}
	
    /**
     * Returns the current extend option for the pattern.
     * 
     * @return The current extend option
     */
	public Extend getExtend() {
		return Extend.intern(cairo_pattern_get_extents(getHandle()));
	}
	
    /**
     * Sets the filter option for the pattern.
     * 
     * @param filter  
     */
	public void setFilter(Filter filter) {
		int status = cairo_pattern_set_filter(getHandle(), filter.getValue());
	}
	
    /**
     * Returns the current filter option for the pattern.
     * 
     * @return The current filter option (One of the Cairo.FILTER_xxx options).
     */
	public Filter getFilter() {
		return Filter.intern(cairo_pattern_get_filter(getHandle()));
	}

	/*
	 * Native calls
	 */
	native static final private Handle cairo_pattern_create_for_surface(Handle surface);
	native static final private Handle cairo_pattern_create_linear(double x0, double y0, double x1, double y1);
	native static final private Handle cairo_pattern_create_radial(double cx0, double yx0, double radius0, double cx1, double cy1, double radius1);
	native static final private void cairo_pattern_reference(Handle pat);
	native static final private void cairo_pattern_destroy(Handle pat);
	native static final private int cairo_pattern_add_color_stop(Handle pat, double offset,
				double red, double green, double blue, double alpha);
	native static final private int cairo_pattern_set_matrix(Handle pat, Handle matrix);
	native static final private int cairo_pattern_get_matrix(Handle pat, Handle matrix);
	native static final private int cairo_pattern_set_extend(Handle pat, int extend);
	native static final private int cairo_pattern_get_extents(Handle pat);
	native static final private int cairo_pattern_set_filter(Handle pat, int filter);
	native static final private int cairo_pattern_get_filter(Handle pat);
}

--- NEW FILE: LineCap.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Enum;

public class LineCap extends Enum {

    static final private int _BUTT = 0;
    static final public LineCap BUTT = new LineCap (_BUTT);
    static final private int _ROUND = 1;
    static final public LineCap ROUND = new LineCap (_ROUND);
    static final private int _SQUARE = 2;
    static final public LineCap SQUARE = new LineCap (_SQUARE);
    static final private LineCap[] theInterned = new LineCap[] {
        BUTT, ROUND, SQUARE
    };
    static private java.util.Hashtable theInternedExtras;
    static final private LineCap theSacrificialOne = new LineCap (0);
    static public LineCap intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        LineCap already = (LineCap) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new LineCap(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private LineCap(int value) {
        value_ = value;
    }

    public boolean test (LineCap other) {
        return (value_ & other.value_) == other.value_;
    }
}

--- NEW FILE: Font.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/
package org.freedesktop.cairo;

import org.gnu.glib.GObject;
import org.gnu.glib.Handle;

public class Font extends CairoObject {
	
	Font(Handle hndl) {
		super(hndl);
	}
	
	public void dispose() {
		cairo_font_destroy(getHandle());
	}
	
	public FontExtents getFontExtents(Matrix fontMatrix) throws CairoException {
		Handle hndl = GObject.getNullHandle();
		int status = cairo_font_extents(getHandle(), fontMatrix.getHandle(), hndl);
		if (status == Status.SUCCESS.getValue())
			return new FontExtents(hndl);
		return null;
	}
	
	public TextExtents getGlyphExtents(Matrix fontMatrix, Glyph[] glyphs) {
		Handle[] hndls = new Handle[glyphs.length];
		for (int i = 0; i < glyphs.length; i++)
			hndls[i] = glyphs[i].getHandle();
		Handle te = GObject.getNullHandle();
		cairo_font_glyph_extents(getHandle(), fontMatrix.getHandle(), hndls, te);
		return new TextExtents(te);
	}

    /*
     * Native calls
     */
	native static final private void cairo_font_reference(Handle obj);
	native static final private void cairo_font_destroy(Handle obj);
	native static final private int cairo_font_extents(Handle obj, Handle matrix, Handle extents);
	native static final private void cairo_font_glyph_extents(Handle obj, Handle matrix, Handle[] glyphs, Handle extents);

}

--- NEW FILE: LineJoin.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/
package org.freedesktop.cairo;

import org.gnu.glib.Enum;

public class LineJoin extends Enum {

    static final private int _MITER = 0;
    static final public LineJoin MITER = new LineJoin (_MITER);
    static final private int _ROUND = 1;
    static final public LineJoin ROUND = new LineJoin (_ROUND);
    static final private int _BEVEL = 2;
    static final public LineJoin BEVEL = new LineJoin (_BEVEL);
    static final private LineJoin[] theInterned = new LineJoin[] {
        MITER, ROUND, BEVEL
    };
    static private java.util.Hashtable theInternedExtras;
    static final private LineJoin theSacrificialOne = new LineJoin (0);
    static public LineJoin intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        LineJoin already = (LineJoin) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new LineJoin(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private LineJoin(int value) {
        value_ = value;
    }

    public boolean test (LineJoin other) {
        return (value_ & other.value_) == other.value_;
    }
}

--- NEW FILE: PngSurface.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Handle;

/**
 * TODO: When / How does the file get closed ?
 * TODO: Is file opened twice ?
 */
public class PngSurface extends Surface {
	
	private String filename;
	private Format format;
	private int width;
	private int height;

	public PngSurface(String filename, Format format, int width, int height) {
		super(cairo_png_surface_create(filename, format.getValue(), width, height));
		this.filename = filename;
		this.format = format;
		this.width = width;
		this.height = height;
	}
	
	void makeTarget(Cairo cr) {
		cairo_set_target_png(cr.getHandle(), filename, format.getValue(), width, height);
	}

	/*
	 * Native calls
	 */
	native static final private void cairo_set_target_png(Handle cr, String filename, int format, int width, int height);
	native static final private Handle cairo_png_surface_create(String filename, int format, int width, int height);
}

--- NEW FILE: PsSurface.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Handle;

/**
 * TODO: When / How does the file get closed ?
 * TODO: Is file opened twice ?
 */
public class PsSurface extends Surface {
	
	private String filename;
	private double width;
	private double height;
	private double xPixels;
	private double yPixels;

	public PsSurface(String filename, double widthInches, double heightInches,
				double xPixelsPerInch, double yPixelsPerInch) {
		super(cairo_ps_surface_create(filename, widthInches, heightInches,
				xPixelsPerInch, yPixelsPerInch));
		this.filename = filename;
		width = widthInches;
		height = heightInches;
		xPixels = xPixelsPerInch;
		yPixels = yPixelsPerInch;
	}
	
	void makeTarget(Cairo cr) {
		cairo_set_target_ps(cr.getHandle(), filename, width, height, xPixels, yPixels);
	}

	/*
	 * Native calls
	 */
	native static final private void cairo_set_target_ps(Handle cr, String filename,
			double width_inches, double height_inches, double x_pixels_per_inch, double y_pixels_per_inch);
	native static final private Handle cairo_ps_surface_create(String filename, 
			double width_inches, double height_inches, double x_pixels_per_inch, double y_pixels_per_inch);
}

--- NEW FILE: Operator.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Enum;

/**
 */
public class Operator extends Enum {
    static final private int _CLEAR = 0;
    static final public Operator CLEAR = new Operator (_CLEAR);
    static final private int _SRC = 1;
    static final public Operator SRC = new Operator (_SRC);
    static final private int _DST = 2;
    static final public Operator DST = new Operator (_DST);
    static final private int _OVER = 3;
    static final public Operator OVER = new Operator (_OVER);
    static final private int _OVER_REVERSE = 4;
    static final public Operator OVER_REVERSE = new Operator (_OVER_REVERSE);
    static final private int _IN = 5;
    static final public Operator IN = new Operator (_IN);
    static final private int _IN_REVERSE = 6;
    static final public Operator IN_REVERSE = new Operator (_IN_REVERSE);
    static final private int _OUT = 7;
    static final public Operator OUT = new Operator (_OUT);
    static final private int _OUT_REVERSE = 8;
    static final public Operator OUT_REVERSE = new Operator (_OUT_REVERSE);
    static final private int _ATOP = 9;
    static final public Operator ATOP = new Operator (_ATOP);
    static final private int _ATOP_REVERSE = 10;
    static final public Operator ATOP_REVERSE = new Operator (_ATOP_REVERSE);
    static final private int _XOR = 11;
    static final public Operator XOR = new Operator (_XOR);
    static final private int _ADD = 12;
    static final public Operator ADD = new Operator (_ADD);
    static final private int _SATURATE = 13;
    static final public Operator SATURATE = new Operator (_SATURATE);
    static final private Operator[] theInterned = new Operator[] {
        CLEAR, SRC, DST, OVER, OVER_REVERSE, IN, IN_REVERSE, OUT, OUT_REVERSE,
        ATOP, ATOP_REVERSE, XOR, ADD, SATURATE
    };
    static private java.util.Hashtable theInternedExtras;
    static final private Operator theSacrificialOne = new Operator (0);
    static public Operator intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        Operator already = (Operator) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new Operator(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private Operator(int value) {
        value_ = value;
    }

    public Operator or (Operator other) {
        return intern(value_ | other.value_);
    }

    public Operator and (Operator other) {
        return intern(value_ & other.value_);
    }

    public Operator xor (Operator other) {
        return intern(value_ ^ other.value_);
    }

    public boolean test (Operator other) {
        return (value_ & other.value_) == other.value_;
    }
}

--- NEW FILE: Point.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

public class Point {
    private double x;
    private double y;
    
    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }
    
    public double getX() {
        return x;
    }
    
    public void setX(double x) {
        this.x = x;
    }
    
    public double getY() {
        return y;
    }
    
    public void setY(double y) {
        this.y = y;
    }
}

--- NEW FILE: Surface.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.GObject;
import org.gnu.glib.Handle;

/**
 * The Surface class represents an Cairo drawing surface. A Cairo object
 * is used to draw on the drawing surface.
 */
public class Surface extends CairoObject {
	
    public Surface(Surface other, Format format, int width, int height) {
        super(cairo_surface_create_similar(other.getHandle(), format.getValue(), width, height));
    }
    
    Surface(Handle hndl) {
    	super(hndl);
    }
    
    /**
     * Disposes native resources used by the surface. Do not use the surface
     * once it is disposed.
     *  
     */
    public void dispose() {
    	cairo_surface_destroy(getHandle());
    }
    
    /**
     * Sets the repeat count for filling (//TODO: Figure out what this is)
     * 
     * @param repeat
     *            The repeat count.
     */
    public void setRepeat(int repeat) {
    	int status = cairo_surface_set_repeat(getHandle(), repeat);
    }
    
    /**
     * Sets the transformation matrix for the surface.
     * 
     * @param matrix
     *            Transformation matrix
     */
    public void setMatrix(Matrix matrix) {
        int status = cairo_surface_set_matrix(getHandle(), matrix.getHandle());
    }
    
    /**
     * Returns the transformation matrix of the surface.
     * 
     * @return The transformation matrix.
     */
    public Matrix getMatrix() {
    	Handle hndl = GObject.getNullHandle();
    	int status = cairo_surface_get_matrix(getHandle(), hndl);
    	return new Matrix(hndl);
    }

    /**
     * Sets the filter for the surface (???)
     * 
     * @param filter
     *            The filter specification
     */
    public void setFilter(Filter filter) {
        int status = cairo_surface_set_filter(getHandle(), filter.getValue());
    }
    
    public Filter getFilter() {
    	return Filter.intern(cairo_surface_get_filter(getHandle()));
    }
    
    void makeTarget(Cairo cairo) {
    	Cairo.cairo_set_target_surface(cairo.getHandle(), getHandle());
    }

    /*
     * Native calls
     */
    native static final private Handle cairo_surface_create_for_image(String data, int format, int width, int height, int stride);
    native static final private Handle cairo_surface_create_similar(Handle other, int format, int width, int height);
    native static final private void cairo_surface_reference(Handle obj);
    native static final private void cairo_surface_destroy(Handle obj);
    native static final private int cairo_surface_set_repeat(Handle obj, int repeat);
    native static final private int cairo_surface_set_matrix(Handle obj, Handle matrix);
    native static final private int cairo_surface_get_matrix(Handle obj, Handle matrix);
    native static final private int cairo_surface_set_filter(Handle obj, int filter);
    native static final private int cairo_surface_get_filter(Handle obj);

}

--- NEW FILE: ImageSurface.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/

package org.freedesktop.cairo;

import org.gnu.glib.Handle;

/**
 */
public class ImageSurface extends Surface {
	
	public ImageSurface(Format format, int width, int height) {
		super(cairo_image_surface_create(format.getValue(), width, height));
	}
	
	public ImageSurface(byte[] data, Format format, int width, int height, int stride) {
		super(cairo_image_surface_create_for_data(data, format.getValue(), width, height, stride));
	}
	
	/*
	 * Native calls
	 */
	native static final private Handle cairo_image_surface_create(int format, int width, int height);
	native static final private Handle cairo_image_surface_create_for_data(byte[] data, int format, int width, int height, int stride);
}

--- NEW FILE: FontExtents.java ---
/*
 * Java-Gnome Bindings Library
*
* Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
*
* The Java-Gnome bindings library is free software distributed under
* the terms of the GNU Library General Public License version 2.
*/
package org.freedesktop.cairo;

import org.gnu.glib.Handle;

public class FontExtents extends CairoObject {
	
	FontExtents(Handle hndl) {
		super(hndl);
	}

	public double getAscent() {
		return get_ascent(getHandle());
	}
	
	public double getDescent() {
		return get_descent(getHandle());
	}
	
	public double getHeight() {
		return get_height(getHandle());
	}
	
	public double getMaxXAdvance() {
		return get_max_x_advance(getHandle());
	}
	
	public double getMaxYAdvance() {
		return get_max_y_advance(getHandle());
	}
	
	/*
	 * Native calls
	 */
	native static final private double get_ascent(Handle obj);
	native static final private double get_descent(Handle obj);
	native static final private double get_height(Handle obj);
	native static final private double get_max_x_advance(Handle obj);
	native static final private double get_max_y_advance(Handle obj);
}

--- NEW FILE: Format.java ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2005 the Java-Gnome Team, all rights reserved.
 *
 * The Java-Gnome bindings library is free software distributed under
 * the terms of the GNU Library General Public License version 2.
 */
package org.freedesktop.cairo;

import org.gnu.glib.Enum;

public class Format extends Enum {

    static final private int _ARGB32 = 0;
    static final public Format ARGB32 = new Format (_ARGB32);
    static final private int _RGB24 = 1;
    static final public Format RGB24 = new Format (_RGB24);
    static final private int _A8 = 2;
    static final public Format A8 = new Format (_A8);
    static final private int _A1 = 3;
    static final public Format A1 = new Format (_A1);
    static final private Format[] theInterned = new Format[] {
        ARGB32, RGB24, A8, A1 
    };
    static private java.util.Hashtable theInternedExtras;
    static final private Format theSacrificialOne = new Format (0);
    static public Format intern (int value) {
        if (value < theInterned.length) {
            return theInterned[value];
        }
        theSacrificialOne.value_ = value;
        if (theInternedExtras == null) {
            theInternedExtras = new java.util.Hashtable();
        }
        Format already = (Format) theInternedExtras.get(theSacrificialOne);
        if (already == null) {
            already = new Format(value);
            theInternedExtras.put(already, already);
        }
        return already;
    }

    private Format(int value) {
        value_ = value;
    }

    public boolean test (Format other) {
        return (value_ & other.value_) == other.value_;
    }
}




More information about the cairo-commit mailing list