[cairo-commit] cairo-java/src/java/org/freedesktop/cairo Matrix.java, 1.3, 1.4 Status.java, 1.4, 1.5 Affine.java, 1.1, NONE Context.java, 1.1, 1.2

Jeffrey Morgan commit at pdx.freedesktop.org
Fri May 6 04:50:58 PDT 2005


Committed by: kuzman

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

Modified Files:
	Matrix.java Status.java Context.java 
Removed Files:
	Affine.java 
Log Message:
Ongoing API cleanup - removed Affine, added/removed methods from Context and Matrix.

Index: Matrix.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Matrix.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Matrix.java	11 Apr 2005 00:47:21 -0000	1.3
+++ Matrix.java	6 May 2005 11:50:55 -0000	1.4
@@ -19,175 +19,239 @@
 	Matrix(Handle hndl) {
 		super(hndl);
 	}
-	
-    /**
-     * Default constructor. Creates a default identity matrix.
-     *
-     */
+
+	/**
+	 * 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);
-    }
-    
+
+	/**
+	 * Constructs a matrix using the affine parameters.
+	 */
+	public Matrix(double xx, double yx, double xy, double yy,
+			double x0, double y0) {
+		super(cairo_matrix_create());
+		setXX(getHandle(), xx);
+		setYX(getHandle(), yx);
+		setXY(getHandle(), xy);
+		setYY(getHandle(), yy);
+		setX0(getHandle(), x0);
+		setY0(getHandle(), y0);
+	}
+
 	private static Handle copy(Matrix copy) {
 		Handle hndl = Struct.getNullHandle();
 		cairo_matrix_copy(hndl, copy.getHandle());
 		return hndl;
 	}
-	
-    /**
-     * Disposes all the native resources used by the matrix.
-     */
+
+	/**
+	 * Disposes all the native resources used by the matrix.
+	 */
 	public void dispose() {
 		cairo_matrix_destroy(getHandle());
 	}
-	
-    /**
-     * Sets the matrix to identity matrix (no transformations).
-     */
+
+	/**
+	 * Sets the matrix to identity matrix (no transformations).
+	 */
 	public void setIdentity() {
 		cairo_matrix_set_identity(getHandle());
 	}
-	
-	public void setAffine(Affine affine) {
-		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
-     */
+
+	/**
+	 * Appends a transaltion transformation to this matrix.
+	 * 
+	 * @param tx
+	 *            X axis translation
+	 * @param ty
+	 *            Y axis translation
+	 */
 	public void translate(double tx, double ty) {
 		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
-     */
+
+	/**
+	 * 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) {
 		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.
-     */
+	 * 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) {
 		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.
-     *
-     */
+	/**
+	 * 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() {
 		cairo_matrix_invert(getHandle());
 	}
-	
-    /**
-     * Multiplies 2 matrices and returns the result.
-     * 
-     * @param a first matrix
-     * @param b second matrix
-     * @return The product
-     */
+
+	/**
+	 * 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 = Struct.getNullHandle();
 		cairo_matrix_multiply(hndl, a.getHandle(), b.getHandle());
 		return new Matrix(hndl);
 	}
-	
-    /**
-     * Transforms the given distance and returns transformed co-ordinates
-     * 
-     */
+
+	/**
+	 * 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()};
+		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
-     * 
-     */
+
+	/**
+	 * 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()};
+		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]);
 	}
 
+	public double getXX() {
+		return getXX(getHandle());
+	}
+	
+	public void setXX(double xx) {
+		setXX(getHandle(), xx);
+	}
+
+	public double getYX() {
+		return getYX(getHandle());
+	}
+	
+	public void setYX(double yx) {
+		setYX(getHandle(), yx);
+	}
+	
+	public double getXY() {
+		return getXY(getHandle());
+	}
+	
+	public void setXY(double xy) {
+		setXY(getHandle(), xy);
+	}
+	
+	public double getYY() {
+		return getYY(getHandle());
+	}
+	
+	public void setYY(double yy) {
+		setYY(getHandle(), yy);
+	}
+	
+	public double getX0() {
+		return getX0(getHandle());
+	}
+	
+	public void setX0(double x0) {
+		setX0(getHandle(), x0);
+	}
+	
+	public double getY0() {
+		return getY0(getHandle());
+	}
+	
+	public void setY0(double y0) {
+		setY0(getHandle(), y0);
+	}
+
 	/*
 	 * Native calls
 	 */
+	native static final private double getXX(Handle matrix);
+	native static final private double getYX(Handle matrix);
+	native static final private double getXY(Handle matrix);
+	native static final private double getYY(Handle matrix);
+	native static final private double getX0(Handle matrix);
+	native static final private double getY0(Handle matrix);
+	native static final private void setXX(Handle matrix, double xx);
+	native static final private void setYX(Handle matrix, double yx);
+	native static final private void setXY(Handle matrix, double xy);
+	native static final private void setYY(Handle matrix, double yy);
+	native static final private void setX0(Handle matrix, double x0);
+	native static final private void setY0(Handle matrix, double y0);
+	
 	native static final private Handle cairo_matrix_create();
 	native static final private void cairo_matrix_destroy(Handle matrix);
-	native static final private void cairo_matrix_copy(Handle matrix, Handle other);
+	native static final private void cairo_matrix_copy(Handle matrix,
+			Handle other);
 	native static final private void cairo_matrix_set_identity(Handle matrix);
-	native static final private void cairo_matrix_set_affine(Handle matrix, double a, double b,
-				double c, double d, double tx, double ty);
-	native static final private void cairo_matrix_get_affine(Handle matrix, double[] a, double[] b,
-				double[] c, double[] d, double[] tx, double[] ty);
-	native static final private void cairo_matrix_translate(Handle matrix, double tx, double ty);
-	native static final private void cairo_matrix_scale(Handle matrix, double sx, double sy);
-	native static final private void cairo_matrix_rotate(Handle matrix, double radians);
+	native static final private void cairo_matrix_set_affine(Handle matrix,
+			double a, double b, double c, double d, double tx, double ty);
+	native static final private void cairo_matrix_get_affine(Handle matrix,
+			double[] a, double[] b, double[] c, double[] d, double[] tx,
+			double[] ty);
+	native static final private void cairo_matrix_translate(Handle matrix,
+			double tx, double ty);
+	native static final private void cairo_matrix_scale(Handle matrix,
+			double sx, double sy);
+	native static final private void cairo_matrix_rotate(Handle matrix,
+			double radians);
 	native static final private void cairo_matrix_invert(Handle matrix);
-	native static final private void cairo_matrix_multiply(Handle result, Handle a, Handle b);
-	native static final private void cairo_matrix_transform_distance(Handle handle, double[] dx, double[] dy);
-	native static final private void cairo_matrix_transform_point(Handle handle, double[] x, double[] y);
+	native static final private void cairo_matrix_multiply(Handle result,
+			Handle a, Handle b);
+	native static final private void cairo_matrix_transform_distance(
+			Handle handle, double[] dx, double[] dy);
+	native static final private void cairo_matrix_transform_point(
+			Handle handle, double[] x, double[] y);
 }

Index: Status.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Status.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Status.java	24 Mar 2005 18:11:40 -0000	1.4
+++ Status.java	6 May 2005 11:50:55 -0000	1.5
@@ -36,11 +36,15 @@
     static final public Status WRITE_ERROR = new Status (_WRITE_ERROR);
     static final private int _SURFACE_FINISHED = 9;
     static final public Status SURFACE_FINISHED = new Status (_SURFACE_FINISHED);
+    static final private int _SURFACE_TYPE_MISMATCH = 10;
+    static final public Status SURFACE_TYPE_MISMATCH = new Status (_SURFACE_TYPE_MISMATCH);
+    static final private int _BAD_NESTING = 11;
+    static final public Status BAD_NESTING = new Status (_BAD_NESTING);
 
     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, INVALID_DATA_PATH,
-        WRITE_ERROR, SURFACE_FINISHED
+        WRITE_ERROR, SURFACE_FINISHED, SURFACE_TYPE_MISMATCH, BAD_NESTING
     };
     static private java.util.Hashtable theInternedExtras;
     static final private Status theSacrificialOne = new Status (0);

--- Affine.java DELETED ---

Index: Context.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Context.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Context.java	3 May 2005 01:36:15 -0000	1.1
+++ Context.java	6 May 2005 11:50:55 -0000	1.2
@@ -157,6 +157,11 @@
 	public void setSourceRGBA(RGBColor color, double alpha) {
 		setSourceRGBA(color.getRed(), color.getGreen(), color.getBlue(), alpha);
 	}
+
+	
+	public void setSourceSurface(Surface surface, double x, double y) {
+		cairo_set_source_surface(getHandle(), surface.getHandle(), x, y);
+	}
 	
 	/**
 	 * Sets the tolerance used when converting paths into trapezoids.
@@ -476,140 +481,6 @@
 	}
 	
     /**
-     * Draws a quadratic bezier curve from the current point to (x2, y2) using a
-     * control point (x1, y1).
-     * 
-     * @param x1
-     *            x co-ordinate of the control point
-     * @param y1
-     *            y co-ordinate of the control point
-     * @param x2
-     *            x co-ordinate of the end point
-     * @param y2
-     *            y co-ordinate of the end point
-     */
-    public void quadTo(double x1, double y1, double x2, double y2) {
-        cairo_quad_to(getHandle(), x1, y1, x2, y2);
-    }
-    
-    public void quadTo(Point p1, Point p2) {
-    	cairo_quad_to(getHandle(), p1.getX(), p1.getY(), p2.getX(), p2.getY());
-    }
-
-    /**
-     * Draws a quadratic bezier curve from the current point to (x2, y2) using a
-     * control point (x1, y1). The co-ordinates are specified relative to
-     * current point in the path.
-     * 
-     * @param dx1
-     *            relative x co-ordinate of the control point
-     * @param dy1
-     *            relative y co-ordinate of the control point
-     * @param dx2
-     *            relative x co-ordinate of the end point
-     * @param dy2
-     *            relative y co-ordinate of the end point
-     */
-    public void relQuadTo(double dx1, double dy1, double dx2, double dy2) {
-        cairo_rel_quad_to(getHandle(), dx1, dy1, dx2, dy2);
-    }
-
-    public void relQuadTo(Point p1, Point p2) {
-    	cairo_rel_quad_to(getHandle(), p1.getX(), p1.getY(), p2.getX(), p2.getY());
-    }
-	
-    /**
-     * Draws an elliptic arc from the current point to (end_x, end_y) with the
-     * given parameters.
-     * 
-     * @param rx
-     *            The x radius of the arc.
-     * @param ry
-     *            The y radius of the arc.
-     * @param xAxisRotation
-     *            The x axis rotation for the arc
-     * @param largeArcFlag
-     *            If 1 a large arc is drawn, else a short arc
-     * @param sweepFlag
-     *            If 1 clockwise sweep is used, else anti-clockwise
-     * @param end_x
-     *            x coodinate of the end point
-     * @param end_y
-     *            y co-ordinate of the end point
-     */
-/*    public void arcTo(double rx, double ry, double xAxisRotation,
-            int largeArcFlag, int sweepFlag, double end_x, double end_y) {
-        cairo_arc_to(getHandle(), rx, ry, xAxisRotation, largeArcFlag,
-        		sweepFlag, end_x, end_y);
-    }
-*/
-    /**
-     * Draws an elliptic arc from the current point to (end_dx, end_dy) with the
-     * given parameters. The co-ordinates of the end point are relative to the
-     * current point.
-     * 
-     * @param rx
-     *            The x radius of the arc.
-     * @param ry
-     *            The y radius of the arc.
-     * @param xAxisRotation
-     *            The x axis rotation for the arc
-     * @param largeArcFlag
-     *            If 1 a large arc is drawn, else a short arc
-     * @param sweepFlag
-     *            If 1 clockwise sweep is used, else anti-clockwise
-     * @param end_dx
-     *            relative x coodinate of the end point
-     * @param end_dy
-     *            relative y co-ordinate of the end point
-     */
- /*   public void relArcTo(double rx, double ry, double xAxisRotation,
-            int largeArcFlag, int sweepFlag, double end_dx, double end_dy) {
-        cairo_rel_arc_to(getHandle(), rx, ry, xAxisRotation, largeArcFlag,
-        		sweepFlag, end_dx, end_dy);
-    }
-*/
-    /**
-     * Draws a horizontal line from the current point to the new x co-ordinates.
-     * 
-     * @param x
-     *            x co-ordinate of the end point.
-     */
-    public void hLineTo(double x) {
-        cairo_hline_to(getHandle(), x);
-    }
-
-    /**
-     * Draws a horizontal line from the current point to the new x co-ordinates.
-     * 
-     * @param dx
-     *            relative x co-ordinate of the end point.
-     */
-    public void relHLineTo(double dx) {
-        cairo_rel_hline_to(getHandle(), dx);
-    }
-    
-    /**
-     * Draws a vertical line from the current point to the new y co-ordinates.
-     * 
-     * @param y
-     *            y co-ordinate of the end point.
-     */
-    public void vLineTo(double y) {
-        cairo_vline_to(getHandle(), y);
-    }
-
-    /**
-     * Draws a vertical line from the current point to the new y co-ordinates.
-     * 
-     * @param dy
-     *            relative y co-ordinate of the end point.
-     */
-    public void relVLineTo(double dy) {
-        cairo_rel_vline_to(getHandle(), dy);
-    }
-
-    /**
      * Closes the current path by connecting current point to the starting point
      * with a line segment.
      *  
@@ -625,23 +496,69 @@
 	public void paint() {
 		cairo_paint(getHandle());
 	}
-	
+
+	/**
+	 *  A drawing operator that paints the current source
+	 * using the alpha channel of pattern as a mask. (Opaque
+	 * areas of mask are painted with the source, transparent
+	 * areas are not painted.)
+	 * @param pattern
+	 */
+	public void mask(Pattern pattern) {
+		cairo_mask(getHandle(), pattern.getHandle());
+	}
+
+	/**
+	 * A drawing operator that paints the current source
+	 * using the alpha channel of surface as a mask. (Opaque
+	 * areas of surface are painted with the source, transparent
+	 * areas are not painted.) 
+	 * @param surface
+	 * @param sx
+	 * @param sy
+	 */
+	public void maskSurface(Surface surface, double sx, double sy) {
+		cairo_mask_surface(getHandle(), surface.getHandle(), sx, sy);
+	}
+
     /**
-     * Strokes the current path.
-     *  
+	 * A drawing operator that strokes the current path according to the
+	 * current line width, line join, line cap, and dash settings. After
+	 * stroke, the current path will be cleared from the cairo
+	 * context.
      */
 	public void stroke() {
 		cairo_stroke(getHandle());
 	}
-	
+
+	/**
+	 * A drawing operator that strokes the current path according to the
+	 * current line width, line join, line cap, and dash settings. Unlike
+	 * stroke(), strokePreserve preserves the path within the
+	 * cairo context.
+	 */
+	public void strokePreserve() {
+		cairo_stroke_preserve(getHandle());
+	}
+
     /**
-     * Fills the current path
-     *  
+	 * A drawing operator that fills the current path according to the
+	 * current fill rule. After fill, the current path will be
+	 * cleared from the cairo context.
      */
 	public void fill() {
 		cairo_fill(getHandle());
 	}
 
+	/**
+	 * A drawing operator that fills the current path according to the
+	 * current fill rule. Unlike fill(), fillPreserve
+	 * preserves the path within the cairo context.
+	 */
+	public void fillPreserve() {
+		cairo_fill_preserve(getHandle());
+	}
+	
 	public void copyPage() {
 		cairo_copy_page(getHandle());
 	}
@@ -681,13 +598,49 @@
 	}
 
     /**
-     * Uses current path as a clip to fill or stroke next paths.
-     *  
+	 * Establishes a new clip region by intersecting the current clip
+	 * region with the current path as it would be filled by fill()
+	 * and according to the current fill rule (see setFillRule()).
+	 *
+	 * After clip, the current path will be cleared from the cairo
+	 * context.
+	 *
+	 * The current clip region affects all drawing operations by
+	 * effectively masking out any changes to the surface that are outside
+	 * the current clip region.
+	 *
+	 * Calling clip() can only make the clip region smaller, never
+	 * larger. But the current clip is part of the graphics state, so a
+	 * tempoarary restriction of the clip region can be achieved by
+	 * calling clip() within a save()/restore() pair. The only other 
+	 * means of increasing the size of the clip region is resetClip().
      */
 	public void clip() {
 		cairo_clip(getHandle());
 	}
 	
+	/**
+	 * Establishes a new clip region by intersecting the current clip
+	 * region with the current path as it would be filled by fill()
+	 * and according to the current fill rule (see setFillRule()).
+	 *
+	 * Unlike clip(), clipPreserve preserves the path within
+	 * the cairo context.
+	 *
+	 * The current clip region affects all drawing operations by
+	 * effectively masking out any changes to the surface that are outside
+	 * the current clip region.
+	 *
+	 * Calling clip() can only make the clip region smaller, never
+	 * larger. But the current clip is part of the graphics state, so a
+	 * tempoarary restriction of the clip region can be achieved by
+	 * calling clip() within a save()/restore() pair. The only other 
+	 * means of increasing the size of the clip region is resetClip().
+	 */
+	public void clipPreserve() {
+		cairo_clip_preserve(getHandle());
+	}
+	
     /**
      * Sets the font for drawing text.
      * 
@@ -714,15 +667,27 @@
 	}
 	
     /**
-     * Transforms the current font using the given affine parameters.
+	 * Sets the current font matrix to matrix. The font matrix gives a
+	 * transformation from the design space of the font (in this space,
+	 * the em-square is 1 unit by 1 unit) to user space. Normally, a
+	 * simple scale is used (see setFontSize()), but a more complex 
+	 * font matrix can be used to shear the font or stretch it unequally 
+	 * along the two axes
      * 
-     * @param matrix
-     *            transformation matrix.
+     * @param matrix transformation matrix.
      */
 	public void setFontMatrix(Matrix matrix) {
 		cairo_set_font_matrix(getHandle(), matrix.getHandle());
 	}
 	
+	/**
+	 * Gets the current font matrix. See setFontMatrix()
+	 * @return the current font matrix
+	 */
+	public Matrix getFontMatrix() {
+		return new Matrix(cairo_get_font_matrix(getHandle()));
+	}
+	
     /**
      * Draws the given text on the screen.
      * 
@@ -798,21 +763,6 @@
 	}
 
     /**
-     * Shows a Surface on the screen. All the shapes and images drawn onto
-     * this surface will be shown.
-     * 
-     * @param surface
-     *            The surface to display
-     * @param width
-     *            Width of the surface
-     * @param height
-     *            Height of the surface
-     */
-	public void showSurface(Surface surface, int width, int height) {
-		cairo_show_surface(getHandle(), surface.getHandle(), width, height);
-	}
-
-    /**
      * Returns the current surface operator
      * 
      * @return The surface operator.
@@ -974,53 +924,6 @@
         cairo_close_path(getHandle());
     }
 
-    /**
-     * Draws a rounder rectangle.
-     * 
-     * @param x
-     *            X co-ordinate of the top left corner
-     * @param y
-     *            Y co-ordinate of the top left corner
-     * @param width
-     *            Width of the rectangle
-     * @param height
-     *            Height of the rectangle
-     * @param rx
-     *            X radius of rounded corners
-     * @param ry
-     *            Y radius of rounded corners
-     */
-    public void rounderRectangle(double x, double y, double width, double height,
-            double rx, double ry) {
-
-        /*
-         * Check whether we really need rounded corners
-         */
-        cairo_new_path(getHandle());
-        if (rx > 0.0 || ry > 0.0) {
-            // Make sure that rx is not more than width/2 and ry is not more
-            // than height/2
-            rx = Math.min(rx, width / 2.0);
-            ry = Math.min(ry, height / 2.0);
-
-            cairo_move_to(getHandle(), x + rx, y);
-            cairo_line_to(getHandle(), x + width - rx, y);
-            cairo_arc_to(getHandle(), rx, ry, 0, 0, 1, x + width, y + ry);
-            cairo_line_to(getHandle(), x + width, y + height - ry);
-            cairo_arc_to(getHandle(), rx, ry, 0, 0, 1, x + width - rx, y + height);
-            cairo_line_to(getHandle(), x + rx, y + height);
-            cairo_arc_to(getHandle(), rx, ry, 0, 0, 1, x, y + height - ry);
-            cairo_line_to(getHandle(), x, y + ry);
-            cairo_arc_to(getHandle(), rx, ry, 0, 0, 1, x + rx, y);
-        } else {
-            cairo_move_to(getHandle(), x, y);
-            cairo_rel_line_to(getHandle(), 0, height);
-            cairo_rel_line_to(getHandle(), width, 0);
-            cairo_rel_line_to(getHandle(), 0, -height);
-        }
-        cairo_close_path(getHandle());
-    }
-
 	public Status getStatus() {
         return Status.intern(cairo_status(getHandle()));
     }
@@ -1059,15 +962,20 @@
      * Native calls
      */
 	native static final private Handle cairo_create();
+	// TODO: API
+	native static final private void cairo_reference(Handle obj);
 	native static final private void cairo_destroy(Handle obj);
 	native static final private void cairo_save(Handle obj);
 	native static final private void cairo_restore(Handle obj);
 	native static final private void cairo_copy(Handle obj, Handle src);
 	native static final void cairo_set_target_surface(Handle obj, Handle surface);
+	native static final void cairo_set_target_image(Handle obj, char[] data, int format, int width, int height, int stride);
+	native static final void cairo_set_target_image_no_data(Handle obj, int format, int width, int height);
 	native static final private void cairo_set_operator(Handle obj, int operator);
 	native static final private void cairo_set_source(Handle obj, Handle pattern);
 	native static final private void cairo_set_source_rgb(Handle obj, double red, double green, double blue);
 	native static final private void cairo_set_source_rgba(Handle object, double red, double green, double glue, double alpha);
+	native static final private void cairo_set_source_surface(Handle object, Handle surface, double x, double y);
 	native static final private void cairo_set_tolerance(Handle obj, double tolerance);
 	native static final private void cairo_set_fill_rule(Handle obj, int fillRule);
 	native static final private void cairo_set_line_width(Handle obj, double width);
@@ -1080,7 +988,6 @@
 	native static final private void cairo_rotate(Handle obj, double angle);
 	native static final private void cairo_transform(Handle obj, Handle matrix);
 	native static final private void cairo_set_matrix(Handle obj, Handle matrix);
-	native static final private void cairo_default_matrix(Handle obj);
 	native static final private void cairo_identity_matrix(Handle obj);
 	native static final private void cairo_user_to_device(Handle obj, double[] x, double[] y);
 	native static final private void cairo_user_to_device_distance(Handle obj, double[] dx, double[] dy);
@@ -1088,26 +995,22 @@
 	native static final private void cairo_device_to_user_distance(Handle obj, double[] dx, double[] dy);
 	native static final private void cairo_new_path(Handle obj);
 	native static final private void cairo_move_to(Handle obj, double x, double y);
-	native static final private void cairo_rel_move_to(Handle obj, double dx, double dy);
 	native static final private void cairo_line_to(Handle obj, double x, double y);
-	native static final private void cairo_rel_line_to(Handle obj, double dx, double dy);
-	native static final private void cairo_rel_curve_to(Handle obj, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
 	native static final private void cairo_curve_to(Handle obj, double x1, double y1, double x2, double y2, double x3, double y3);
-	native static final private void cairo_quad_to(Handle obj, double x1, double y1, double x2, double y2);
-	native static final private void cairo_rel_quad_to(Handle obj, double x1, double y1, double x2, double y2);
-	native static final private void cairo_arc_to(Handle obj, double rx, double ry, double xAxis, int largeArc, int sweep, double endX, double endy);
-	native static final private void cairo_rel_arc_to(Handle obj, double rx, double ry, double xAxis, int largeArc, int sweep, double endX, double endy);
-	native static final private void cairo_hline_to(Handle obj, double x);
-	native static final private void cairo_rel_hline_to(Handle obj, double dx);
-	native static final private void cairo_vline_to(Handle obj, double y);
-	native static final private void cairo_rel_vline_to(Handle obj, double dy);
 	native static final private void cairo_arc(Handle obj, double xc, double yc, double radius, double angle1, double angle2);
 	native static final private void cairo_arc_negative(Handle obj, double xc, double yc, double radius, double angle1, double angle2);
+	native static final private void cairo_rel_move_to(Handle obj, double dx, double dy);
+	native static final private void cairo_rel_line_to(Handle obj, double dx, double dy);
+	native static final private void cairo_rel_curve_to(Handle obj, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
 	native static final private void cairo_rectangle(Handle obj, double x, double y, double width, double height);
 	native static final private void cairo_close_path(Handle obj);
 	native static final private void cairo_paint(Handle obj);
+	native static final private void cairo_mask(Handle obj, Handle pattern);
+	native static final private void cairo_mask_surface(Handle obj, Handle surface, double sx, double sy);
 	native static final private void cairo_stroke(Handle obj);
+	native static final private void cairo_stroke_preserve(Handle obj);
 	native static final private void cairo_fill(Handle obj);
+	native static final private void cairo_fill_preserve(Handle obj);
 	native static final private void cairo_copy_page(Handle obj);
 	native static final private void cairo_show_page(Handle obj);
 	native static final private boolean cairo_in_stroke(Handle obj, double x, double y);
@@ -1116,9 +1019,11 @@
 	native static final private void cairo_fill_extents(Handle obj, double[] x1, double[] y1, double[] x2, double[] y2);
 	native static final private void cairo_reset_clip(Handle obj);
 	native static final private void cairo_clip(Handle ojb);
+	native static final private void cairo_clip_preserve(Handle obj);
 	native static final private void cairo_select_font_face(Handle obj, String family, int slant, int weight);
 	native static final private void cairo_set_font_size(Handle obj, double scale);
 	native static final private void cairo_set_font_matrix(Handle obj, Handle matrix);
+	native static final private Handle cairo_get_font_matrix(Handle obj);
 	native static final private void cairo_show_text(Handle obj, String utf8);
 	native static final private void cairo_show_glyphs(Handle obj, Handle[] glyphs);
 	native static final private Handle cairo_get_font_face(Handle obj);
@@ -1128,7 +1033,6 @@
 	native static final private void cairo_glyph_extents(Handle obj, Handle[] glyphs, Handle extents);
 	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_get_operator(Handle obj);
 	native static final private void cairo_get_rgb_color(Handle obj, double[] red, double[] green, double[] blue);
 	native static final private Handle cairo_get_source(Handle obj);
@@ -1142,11 +1046,22 @@
 	native static final private double cairo_get_miter_limit(Handle obj);
 	native static final private void cairo_get_matrix(Handle obj, Handle matrix);
 	native static final Handle cairo_get_target_surface(Handle obj);
-	native static final private int cairo_status(Handle obj);
-	native static final private String cairo_status_string(Handle obj);
 	native static final private void cairo_get_path(Handle obj, Object cairo);
     native static final private void cairo_get_path_flat(Handle obj, Object cairo);
-	// used by ImageSurface
-	native static final void cairo_set_target_image(Handle obj, char[] data, int format, int width, int height, int stride);
-	native static final void cairo_set_target_image_no_data(Handle obj, int format, int width, int height);
+	native static final private int cairo_status(Handle obj);
+	native static final private String cairo_status_string(Handle obj);
+	
+// TODO: add the following	
+//	cairo_path_t *
+//	cairo_copy_path (cairo_t *cr);
+//
+//	cairo_path_t *
+//	cairo_copy_path_flat (cairo_t *cr);
+//
+//	void
+//	cairo_append_path (cairo_t	*cr,
+//			   cairo_path_t *path);
+//
+//	void
+//	cairo_path_destroy (cairo_path_t *path);
 }
\ No newline at end of file




More information about the cairo-commit mailing list