[cairo-commit] cairo-java/src/java/org/freedesktop/cairo Cairo.java, 1.13, 1.14 Matrix.java, 1.2, 1.3 Font.java, 1.2, NONE PngSurface.java, 1.6, 1.7 FreetypeFont.java, 1.3, 1.4 FontFace.java, NONE, 1.1

Jeffrey Morgan commit at pdx.freedesktop.org
Sun Apr 10 17:47:24 PDT 2005


Committed by: kuzman

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

Modified Files:
	Cairo.java Matrix.java PngSurface.java FreetypeFont.java 
Added Files:
	FontFace.java 
Removed Files:
	Font.java 
Log Message:
Changes to match upstream API changes

Index: Cairo.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Cairo.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Cairo.java	5 Apr 2005 00:36:59 -0000	1.13
+++ Cairo.java	11 Apr 2005 00:47:21 -0000	1.14
@@ -249,14 +249,6 @@
 	}
 	
     /**
-     * Set the transformation matrix for the state to default (identity) matrix.
-     *  
-     */
-	public void defaultMatrix() {
-		cairo_default_matrix(getHandle());
-	}
-	
-    /**
      * Set the transformation matrix for the state to identity matrix.
      *  
      */
@@ -678,8 +670,8 @@
      * @param weight
      *            Font weight
      */
-	public void selectFont(String family, FontSlant slant, FontWeight weight) {
-		cairo_select_font(getHandle(), family, slant.getValue(), weight.getValue());
+	public void selectFontFace(String family, FontSlant slant, FontWeight weight) {
+		cairo_select_font_face(getHandle(), family, slant.getValue(), weight.getValue());
 	}
 	
     /**
@@ -689,20 +681,24 @@
      * @param scale
      *            The scaling factor.
      */
-	public void scaleFont(double scale) {
-		cairo_scale_font(getHandle(), scale);
+	public void setFontSize(double scale) {
+		cairo_set_font_size(getHandle(), scale);
 	}
 	
     /**
-     * Transforms the current font using the given affine parameters. Note: tx,
-     * ty are not required.
+     * Transforms the current font using the given affine parameters.
      * 
      * @param matrix
      *            transformation matrix.
      */
-	public void transformFont(Matrix matrix) {
-		cairo_transform_font(getHandle(), matrix.getHandle());
+	public void setFontMatrix(Matrix matrix) {
+		cairo_set_font_matrix(getHandle(), matrix.getHandle());
 	}
+	
+	
+//	public Matrix getFontMatrix() {
+//		return new Matrix(cairo_get_font_matrix(getHandle()));
+//	}
 
     /**
      * Draws the given text on the screen.
@@ -723,18 +719,18 @@
 		cairo_show_glyphs(getHandle(), hndls);
 	}
 
-	public Font getFont() {
-		return new Font(cairo_get_font(getHandle()));
+	public FontFace getFontFace() {
+		return new FontFace(cairo_get_font_face(getHandle()));
 	}
 
 	public FontExtents getFontExtents() {
 		Handle hndl = Struct.getNullHandle();
-		cairo_get_font_extents(getHandle(), hndl);
+		cairo_font_extents(getHandle(), hndl);
 		return new FontExtents(hndl);
 	}
 	
-	public void setFont(Font font) {
-		cairo_set_font(getHandle(), font.getHandle());
+	public void setFont(FontFace font) {
+		cairo_set_font_face(getHandle(), font.getHandle());
 	}
 
     /**
@@ -1086,14 +1082,15 @@
 	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_select_font(Handle obj, String family, int slant, int weight);
-	native static final private void cairo_scale_font(Handle obj, double scale);
-	native static final private void cairo_transform_font(Handle obj, Handle matrix);
+	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, Handle matrix);
 	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(Handle obj);
-	native static final private void cairo_get_font_extents(Handle obj, Handle extents);
-	native static final private void cairo_set_font(Handle obj, Handle font);
+	native static final private Handle cairo_get_font_face(Handle obj);
+	native static final private void cairo_font_extents(Handle obj, Handle extents);
+	native static final private void cairo_set_font_face(Handle obj, Handle font);
 	native static final private void cairo_text_extents(Handle obj, String utf8, Handle extents);
 	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);

Index: Matrix.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Matrix.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Matrix.java	24 Mar 2005 18:11:40 -0000	1.2
+++ Matrix.java	11 Apr 2005 00:47:21 -0000	1.3
@@ -44,7 +44,7 @@
     
 	private static Handle copy(Matrix copy) {
 		Handle hndl = Struct.getNullHandle();
-		int status = cairo_matrix_copy(hndl, copy.getHandle());
+		cairo_matrix_copy(hndl, copy.getHandle());
 		return hndl;
 	}
 	
@@ -59,11 +59,11 @@
      * Sets the matrix to identity matrix (no transformations).
      */
 	public void setIdentity() {
-		int status = cairo_matrix_set_identity(getHandle());
+		cairo_matrix_set_identity(getHandle());
 	}
 	
 	public void setAffine(Affine affine) {
-		int status = cairo_matrix_set_affine(getHandle(), affine.getA(), affine.getB(), 
+		cairo_matrix_set_affine(getHandle(), affine.getA(), affine.getB(), 
 					affine.getC(), affine.getD(), affine.getTx(), affine.getTy());
 	}
 	
@@ -85,7 +85,7 @@
      * @param ty Y axis translation
      */
 	public void translate(double tx, double ty) {
-		int status = cairo_matrix_translate(getHandle(), tx, ty);
+		cairo_matrix_translate(getHandle(), tx, ty);
 	}
 	
     /**
@@ -95,7 +95,7 @@
      * @param sy Y axis scaling factor
      */
 	public void scale(double sx, double sy) {
-		int status = cairo_matrix_scale(getHandle(), sx, sy);
+		cairo_matrix_scale(getHandle(), sx, sy);
 	}
 	
     /**
@@ -113,7 +113,7 @@
      * @param radians The rotation angle in radians.
      */
 	public void rotate(double radians) {
-		int status = cairo_matrix_rotate(getHandle(), radians);
+		cairo_matrix_rotate(getHandle(), radians);
 	}
 	
     /**
@@ -134,7 +134,7 @@
      *
      */
 	public void invert() {
-		int status = cairo_matrix_invert(getHandle());
+		cairo_matrix_invert(getHandle());
 	}
 	
     /**
@@ -146,7 +146,7 @@
      */
 	static public Matrix multiply(Matrix a, Matrix b) {
 		Handle hndl = Struct.getNullHandle();
-		int status = cairo_matrix_multiply(hndl, a.getHandle(), b.getHandle());
+		cairo_matrix_multiply(hndl, a.getHandle(), b.getHandle());
 		return new Matrix(hndl);
 	}
 	
@@ -177,17 +177,17 @@
 	 */
 	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,
+	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 int cairo_matrix_get_affine(Handle matrix, double[] a, double[] b,
+	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 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);
+	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);
 }

--- Font.java DELETED ---

Index: PngSurface.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/PngSurface.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- PngSurface.java	2 Apr 2005 16:07:34 -0000	1.6
+++ PngSurface.java	11 Apr 2005 00:47:21 -0000	1.7
@@ -30,16 +30,16 @@
 		super(initialize(filename));
 	}
 
+	public PngSurface(Format format, int width, int height) {
+		super(format, width, height);
+	}
+	
 	public void write(String filename) throws IOException {
 		checkFile(filename);
-		
+		this.filename = filename;
 		int status = cairo_surface_write_png(getHandle(), filename);
 	}
 	
-	public PngSurface(Format format, int width, int height) {
-		super(format, width, height);
-	}
-	
 	private static Handle initialize(String filename)
 			throws IOException {
 

Index: FreetypeFont.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/FreetypeFont.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- FreetypeFont.java	24 Mar 2005 18:11:40 -0000	1.3
+++ FreetypeFont.java	11 Apr 2005 00:47:21 -0000	1.4
@@ -12,7 +12,7 @@
 
 /**
  */
-public class FreetypeFont extends Font {
+public class FreetypeFont extends FontFace {
 
     /**
      * Creates a new freetype font using the given parameters.

--- NEW FILE: FontFace.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.javagnome.Handle;

public class FontFace extends CairoObject {
	
	FontFace(Handle hndl) {
		super(hndl);
	}
	
	public void dispose() {
		cairo_font_face_destroy(getHandle());
	}
	
//	public FontExtents getFontExtents(Matrix fontMatrix) throws CairoException {
//		Handle hndl = Struct.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 = Struct.getNullHandle();
//		cairo_font_glyph_extents(getHandle(), fontMatrix.getHandle(), hndls, te);
//		return new TextExtents(te);
//	}

    /*
     * Native calls
     */
	native static final private void cairo_font_face_reference(Handle obj);
	native static final private void cairo_font_face_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);

}




More information about the cairo-commit mailing list