[cairo-commit] cairo-java/src/jni org_freedesktop_cairo_PngSurface.c, 1.3, 1.4 org_freedesktop_cairo_PdfSurface.c, 1.4, 1.5 org_freedesktop_cairo_PsSurface.c, 1.3, 1.4

Jeffrey Morgan commit at pdx.freedesktop.org
Fri Apr 1 05:58:47 PST 2005


Committed by: kuzman

Update of /cvs/cairo/cairo-java/src/jni
In directory gabe:/tmp/cvs-serv24258/src/jni

Modified Files:
	org_freedesktop_cairo_PngSurface.c 
	org_freedesktop_cairo_PdfSurface.c 
	org_freedesktop_cairo_PsSurface.c 
Log Message:
Incorporated upstream API changes

Index: org_freedesktop_cairo_PngSurface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_PngSurface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- org_freedesktop_cairo_PngSurface.c	4 Mar 2005 23:01:41 -0000	1.3
+++ org_freedesktop_cairo_PngSurface.c	1 Apr 2005 13:58:45 -0000	1.4
@@ -27,32 +27,34 @@
 
 /*
  * Class:     org_freedesktop_cairo_PngSurface
- * Method:    cairo_set_target_png
+ * Method:    cairo_set_target_surface
  * Signature: (Lorg/gnu/glib/Handle;Ljava/lang/String;III)V
  */
 JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PngSurface_cairo_1set_1target_1png
-  (JNIEnv *env, jclass cls, jobject cr, jobject sur, jint format, 
-  		jint width, jint height)
+  (JNIEnv *env, jclass cls, jobject cr, jobject sur)
 {
 	cairo_t *cr_g = (cairo_t*)getPointerFromHandle(env, cr);
 	jg_pngsurface_t *s = (jg_pngsurface_t*)getPointerFromHandle(env, sur);
-	cairo_set_target_png(cr_g, s->file, (cairo_format_t)format, width, height);
+	cairo_set_target_surface(cr_g, s->surface);
 }
 
 /*
  * Class:     org_freedesktop_cairo_PngSurface
- * Method:    cairo_png_surface_create
+ * Method:    cairo_image_surface_create_for_png
  * Signature: (Ljava/lang/String;III)Lorg/gnu/glib/Handle;
  */
-JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_PngSurface_cairo_1png_1surface_1create
-  (JNIEnv *env, jclass cls, jstring filename, jint format, jint width, jint height)
+JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_PngSurface_cairo_1image_1surface_1create_1for_1png
+  (JNIEnv *env, jclass cls, jstring filename, jintArray width, jintArray height)
 {
 	jg_pngsurface_t *s = malloc(sizeof(jg_pngsurface_t));
 	char *fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
 	FILE *f = fopen(fn, "wb");
-	cairo_surface_t *sur = cairo_png_surface_create(f, (cairo_format_t)format, 
-			width, height);
+	int* w = (int*)(*env)->GetIntArrayElements(env, width, NULL);
+	int* h = (int*)(*env)->GetIntArrayElements(env, height, NULL);
+	cairo_surface_t *sur = cairo_image_surface_create_for_png(f, w, h);
 	(*env)->ReleaseStringUTFChars(env, filename, fn);
+	(*env)->ReleaseIntArrayElements(env, width, w, 0);
+	(*env)->ReleaseIntArrayElements(env, height, h, 0);
 	s->surface = sur;
 	s->file = f;
 	return getHandleFromPointer(env, s);

Index: org_freedesktop_cairo_PdfSurface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_PdfSurface.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- org_freedesktop_cairo_PdfSurface.c	25 Mar 2005 16:18:54 -0000	1.4
+++ org_freedesktop_cairo_PdfSurface.c	1 Apr 2005 13:58:45 -0000	1.5
@@ -27,31 +27,31 @@
 
 /*
  * Class:     org_freedesktop_cairo_PdfSurface
- * Method:    cairo_set_target_pdf_as_file
+ * Method:    cairo_set_target_pdf
  * Signature: (Lorg/gnu/glib/Handle;Ljava/lang/String;DDDD)V
  */
-JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PdfSurface_cairo_1set_1target_1pdf_1as_1file
+JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PdfSurface_cairo_1set_1target_1pdf
   (JNIEnv *env, jclass cls, jobject cr, jobject sur, jdouble width, jdouble height, 
   		jdouble x, jdouble y)
 {
 	cairo_t *cr_g = (cairo_t*)getPointerFromHandle(env, cr);
 	jg_pdfsurface_t *s = (jg_pdfsurface_t*)getPointerFromHandle(env, sur);
-	cairo_set_target_pdf_as_file(cr_g, s->file, width, height, x, y);
+	cairo_set_target_pdf(cr_g, s->file, width, height, x, y);
 }
 
 /*
  * Class:     org_freedesktop_cairo_PdfSurface
- * Method:    cairo_pdf_surface_create_for_file
+ * Method:    cairo_pdf_surface_create
  * Signature: (Ljava/lang/String;DDDD)Lorg/gnu/glib/Handle;
  */
-JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_PdfSurface_cairo_1pdf_1surface_1create_1for_1file
+JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_PdfSurface_cairo_1pdf_1surface_1create
   (JNIEnv *env, jclass cls, jstring filename, jdouble width, jdouble height, 
   		jdouble x, jdouble y)
 {
 	jg_pdfsurface_t *s = malloc(sizeof(jg_pdfsurface_t));
 	char *fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
 	FILE *f = fopen(fn, "w");
-	cairo_surface_t *sur = cairo_pdf_surface_create_for_file(f, width, height, x, y);
+	cairo_surface_t *sur = cairo_pdf_surface_create(f, width, height, x, y);
 	(*env)->ReleaseStringUTFChars(env, filename, fn);
 	s->surface = sur;
 	s->file = f;

Index: org_freedesktop_cairo_PsSurface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_PsSurface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- org_freedesktop_cairo_PsSurface.c	10 Mar 2005 19:38:33 -0000	1.3
+++ org_freedesktop_cairo_PsSurface.c	1 Apr 2005 13:58:45 -0000	1.4
@@ -11,6 +11,7 @@
 #include <stdlib.h>
 #include <jni.h>
 #include <cairo.h>
+#include <cairo-ps.h>
 #include <jg_jnu.h>
 
 #ifndef _Included_org_freedesktop_cairo_PsSurface




More information about the cairo-commit mailing list