[cairo-commit] cairo-java/src/java/org/freedesktop/cairo Cairo.java, 1.10, 1.11 Surface.java, 1.3, 1.4

Jeffrey Morgan commit at pdx.freedesktop.org
Fri Mar 25 08:53:35 PST 2005


Committed by: kuzman

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

Modified Files:
	Cairo.java Surface.java 
Log Message:
Updated APIs to match upstream changes

Index: Cairo.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Cairo.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Cairo.java	24 Mar 2005 18:11:40 -0000	1.10
+++ Cairo.java	25 Mar 2005 16:53:33 -0000	1.11
@@ -234,8 +234,8 @@
      * @param matrix
      *            The transformation matrix to append
      */
-	public void concatMatrix (Matrix matrix) {
-		cairo_concat_matrix(getHandle(), matrix.getHandle());
+	public void transform(Matrix matrix) {
+		cairo_transform(getHandle(), matrix.getHandle());
 	}
 	
     /**
@@ -264,11 +264,9 @@
 		cairo_identity_matrix(getHandle());
 	}
 
-	public void transformPoint(Point p) {
-		double[] x = new double[] { p.getX() };
-		double[] y = new double[] { p.getY() };
-		cairo_transform_point(getHandle(), x, y);
-		// TODO: does this work ? check the native layer
+	public Point userToDevice(Point p) {
+		double[] points = userToDevice(p.getX(), p.getY());
+		return new Point(points[0], points[1]);
 	}
 	
     /**
@@ -281,17 +279,16 @@
      *            The y cordinate of the point in local co-ordinates
      * @return The transformed point
      */
-	public double[] transformPoint(double x, double y) {
+	public double[] userToDevice(double x, double y) {
 		double[] px = new double[] { x };
 		double[] py = new double[] { y };
-		cairo_transform_point(getHandle(), px, py);
+		cairo_user_to_device(getHandle(), px, py);
 		return new double[] {px[0], py[0]};
 	}
 	
-	public void inverseTransformPoint(Point p) {
-		double[] x = new double[] { p.getX() };
-		double[] y = new double[] { p.getY() };
-		cairo_inverse_transform_point(getHandle(), x, y);
+	public Point deviceToUser(Point p) {
+		double[] points = deviceToUser(p.getX(), p.getY());
+		return new Point(points[0], points[1]);
 	}
 	
     /**
@@ -304,39 +301,36 @@
      *            The y cordinate of the point in global co-ordinates
      * @return The transformed point
      */
-	public double[] inverseTransformPoint(double x, double y) {
+	public double[] deviceToUser(double x, double y) {
 		double[] px = new double[] { x };
 		double[] py = new double[] { y };
-		cairo_inverse_transform_point(getHandle(), px, py);
+		cairo_device_to_user(getHandle(), px, py);
 		return new double[] {px[0], py[0]};
 	}
 	
-	public void transformDistance(Distance d) {
-		double[] x = new double[] { d.getXDistance() };
-		double[] y = new double[] { d.getYDistance() };
-		cairo_transform_distance(getHandle(), x, y);
+	public Distance userToDeviceDistance(Distance d) {
+		double[] dis = userToDeviceDistance(d.getXDistance(), d.getYDistance());
+		return new Distance(dis[0], dis[1]);
 	}
 	
-	public double[] transformDistance(double x, double y) {
+	public double[] userToDeviceDistance(double x, double y) {
 		double[] dx = new double[] { x };
 		double[] dy = new double[] { y };
-		cairo_transform_distance(getHandle(), dx, dy);
+		cairo_user_to_device_distance(getHandle(), dx, dy);
 		return new double[] {dx[0], dy[0]};
 		
 	}
 	
-	public void inverseTransformDistance(Distance d) {
-		double[] x = new double[] { d.getXDistance() };
-		double[] y = new double[] { d.getYDistance() };
-		cairo_inverse_transform_distance(getHandle(), x, y);
+	public Distance deviceToUserDistance(Distance d) {
+		double[] dis = deviceToUserDistance(d.getXDistance(), d.getYDistance());
+		return new Distance(dis[0], dis[1]);
 	}
 	
-	public double[] inverseTransformDistance(double x, double y) {
+	public double[] deviceToUserDistance(double x, double y) {
 		double[] dx = new double[] { x };
 		double[] dy = new double[] { y };
-		cairo_inverse_transform_distance(getHandle(), dx, dy);
+		cairo_device_to_user_distance(getHandle(), dx, dy);
 		return new double[] {dx[0], dy[0]};
-		
 	}
 	
     /**
@@ -662,8 +656,8 @@
 		return new BoundingBox(x1[0], y1[0], x2[0], y2[0]);
 	}
 	
-	public void initClip() {
-		cairo_init_clip(getHandle());
+	public void resetClip() {
+		cairo_reset_clip(getHandle());
 	}
 
     /**
@@ -1056,14 +1050,14 @@
 	native static final private void cairo_translate(Handle obj, double tx, double ty);
 	native static final private void cairo_scale(Handle obj, double sx, double sy);
 	native static final private void cairo_rotate(Handle obj, double angle);
-	native static final private void cairo_concat_matrix(Handle obj, Handle matrix);
+	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_transform_point(Handle obj, double[] x, double[] y);
-	native static final private void cairo_transform_distance(Handle obj, double[] dx, double[] dy);
-	native static final private void cairo_inverse_transform_point(Handle obj, double[] x, double[] y);
-	native static final private void cairo_inverse_transform_distance(Handle obj, double[] dx, double[] dy);
+	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);
+	native static final private void cairo_device_to_user(Handle obj, double[] x, double[] y);
+	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);
@@ -1091,7 +1085,7 @@
 	native static final private boolean cairo_in_fill(Handle obj, double x, double y);
 	native static final private void cairo_stroke_extents(Handle obj, double[] x1, double[] y1, double[] x2, double[] y2);
 	native static final private void cairo_fill_extents(Handle obj, double[] x1, double[] y1, double[] x2, double[] y2);
-	native static final private void cairo_init_clip(Handle obj);
+	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);

Index: Surface.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Surface.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Surface.java	24 Mar 2005 18:11:40 -0000	1.3
+++ Surface.java	25 Mar 2005 16:53:33 -0000	1.4
@@ -83,6 +83,10 @@
     	return Filter.intern(cairo_surface_get_filter(getHandle()));
     }
     
+    public void setDeviceOffset(double xOffset, double yOffset) {
+    	cairo_surface_set_device_offset(getHandle(), xOffset, yOffset);
+    }
+    
     void makeTarget(Cairo cairo) {
     	Cairo.cairo_set_target_surface(cairo.getHandle(), getHandle());
     }
@@ -100,5 +104,6 @@
     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);
+    native static final private void cairo_surface_set_device_offset(Handle obj, double xOff, double yOff);
 
 }




More information about the cairo-commit mailing list