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

Jeffrey Morgan commit at pdx.freedesktop.org
Sat Apr 2 05:46:43 PST 2005


Committed by: kuzman

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

Modified Files:
	Cairo.java ImageSurface.java 
Log Message:
added cairo_set_target_image_no_data to Cairo and fixed makeTarget for ImageSurface

Index: Cairo.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/Cairo.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Cairo.java	25 Mar 2005 16:53:33 -0000	1.11
+++ Cairo.java	2 Apr 2005 13:46:40 -0000	1.12
@@ -1035,7 +1035,6 @@
 	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 private void cairo_set_target_image(Handle obj, String data, int format, int width, int height, int stride);
 	native static final private void cairo_set_operator(Handle obj, int operator);
 	native static final private void cairo_set_rgb_color(Handle obj, double red, double green, double blue);
 	native static final private void cairo_set_pattern(Handle obj, Handle pattern);
@@ -1117,4 +1116,7 @@
 	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, byte[] 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);
 }
\ No newline at end of file

Index: ImageSurface.java
===================================================================
RCS file: /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo/ImageSurface.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ImageSurface.java	2 Apr 2005 11:46:23 -0000	1.3
+++ ImageSurface.java	2 Apr 2005 13:46:40 -0000	1.4
@@ -15,16 +15,37 @@
  */
 public class ImageSurface extends Surface {
 	
+	private Format format;
+	private int width;
+	private int height;
+	private int stride;
+	private byte[] data = null;
+	
 	public ImageSurface(Format format, int width, int height) {
 		super(cairo_image_surface_create(format.getValue(), width, height));
+		this.format = format;
+		this.width = width;
+		this.height = 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));
+		this.format = format;
+		this.width = width;
+		this.height = height;
+		this.stride = stride;
+		this.data = data;
+	}
+	
+	ImageSurface(Handle hndl) {
+		super(hndl);
 	}
 	
 	void makeTarget(Cairo cr) {
-		cr.setTargetSurface(this);
+		if (null == data)
+			Cairo.cairo_set_target_image_no_data(getHandle(), format.getValue(), width, height);
+		else
+			Cairo.cairo_set_target_image(getHandle(), data, format.getValue(), width, height, stride);
 	}
 	
 	/*




More information about the cairo-commit mailing list