[cairo-commit] cairo-java/src/jni
org_freedesktop_cairo_ImageSurface.c, 1.2,
1.3 org_freedesktop_cairo_Surface.c, 1.8,
1.9 org_freedesktop_cairo_Glyph.c, 1.1, 1.2
Jeffrey Morgan
commit at pdx.freedesktop.org
Mon May 9 18:28:17 PDT 2005
- Previous message: [cairo-commit] cairo-java/src/jni
org_freedesktop_cairo_FontExtents.c, 1.1,
1.2 org_freedesktop_cairo_PDFSurface.c, 1.2,
1.3 org_freedesktop_cairo_Context.c, 1.5,
1.6 org_freedesktop_cairo_FontFace.c, 1.3, 1.4
- Next message: [cairo-commit] cairo-java ChangeLog,1.57,1.58
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: kuzman
Update of /cvs/cairo/cairo-java/src/jni
In directory gabe:/tmp/cvs-serv31745/src/jni
Modified Files:
org_freedesktop_cairo_ImageSurface.c
org_freedesktop_cairo_Surface.c org_freedesktop_cairo_Glyph.c
Log Message:
added missing native methods.
Index: org_freedesktop_cairo_ImageSurface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_ImageSurface.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- org_freedesktop_cairo_ImageSurface.c 5 Apr 2005 00:36:59 -0000 1.2
+++ org_freedesktop_cairo_ImageSurface.c 10 May 2005 01:28:15 -0000 1.3
@@ -27,6 +27,8 @@
{
cairo_surface_t *surface = cairo_image_surface_create(
(cairo_format_t)format, width, height);
+ if (surface)
+ cairo_surface_reference(surface);
return getHandleFromPointer(env, surface);
}
@@ -44,6 +46,8 @@
data_g = (unsigned char*)(*env)->GetCharArrayElements(env, data, NULL);
surface = cairo_image_surface_create_for_data(data_g,
(cairo_format_t)format, width, height, stride);
+ if (surface)
+ cairo_surface_reference(surface);
(*env)->ReleaseCharArrayElements(env, data, (jchar*)data_g, 0);
return getHandleFromPointer(env, surface);
}
Index: org_freedesktop_cairo_Surface.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Surface.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- org_freedesktop_cairo_Surface.c 9 May 2005 16:02:07 -0000 1.8
+++ org_freedesktop_cairo_Surface.c 10 May 2005 01:28:15 -0000 1.9
@@ -7,6 +7,7 @@
* the terms of the GNU Library General Public License version 2.
*/
+#include <stdlib.h>
#include <jni.h>
#include <cairo.h>
#include <stdlib.h>
@@ -41,6 +42,24 @@
/*
* Class: org_freedesktop_cairo_Surface
+ * Method: alloc
+ * Signature: ()Lorg/gnu/javagnome/Handle;
+ */
+JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Surface_alloc
+ (JNIEnv *env, jclass cls)
+{
+ cairo_surface_t *surface;
+
+ // TODO: alloc
+// surface = malloc (sizeof (cairo_surface_t));
+// if (surface)
+// cairo_surface_reference(surface);
+// return getHandleFromPointer(env, surface);
+ return NULL;
+}
+
+/*
+ * Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_destroy
* Signature: (Lorg/gnu/glib/Handle;)V
*/
@@ -63,6 +82,27 @@
cairo_surface_finish(surface);
}
+/*
+ * Class: org_freedesktop_cairo_Surface
+ * Method: cairo_surface_write_to_png
+ * Signature: (Lorg/gnu/javagnome/Handle;Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1write_1to_1png
+ (JNIEnv *env, jclass cls, jobject obj, jstring png)
+{
+ cairo_surface_t *surface;
+ char *png_g;
+ cairo_status_t status;
+
+ surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
+ png_g = (char*)(*env)->GetStringUTFChars(env, png, NULL);
+
+ status = cairo_surface_write_to_png(surface, png_g);
+
+ (*env)->ReleaseStringUTFChars(env, png, png_g);
+ return status;
+}
+
/*
* Class: org_freedesktop_cairo_Surface
Index: org_freedesktop_cairo_Glyph.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Glyph.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- org_freedesktop_cairo_Glyph.c 23 Feb 2005 18:17:52 -0000 1.1
+++ org_freedesktop_cairo_Glyph.c 10 May 2005 01:28:15 -0000 1.2
@@ -7,6 +7,7 @@
* the terms of the GNU Library General Public License version 2.
*/
+#include <stdlib.h>
#include <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
@@ -19,6 +20,51 @@
/*
* Class: org_freedesktop_cairo_Glyph
+ * Method: alloc
+ * Signature: ()Lorg/gnu/javagnome/Handle;
+ */
+JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Glyph_alloc__
+ (JNIEnv *env, jclass cls)
+{
+ cairo_glyph_t *glyph;
+
+ glyph = malloc (sizeof (cairo_glyph_t));
+ return getHandleFromPointer(env, glyph);
+}
+
+/*
+ * Class: org_freedesktop_cairo_Glyph
+ * Method: alloc
+ * Signature: (JDD)Lorg/gnu/javagnome/Handle;
+ */
+JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Glyph_alloc__JDD
+ (JNIEnv *env, jclass cls, jlong index, jdouble x, jdouble y)
+{
+ cairo_glyph_t *glyph;
+
+ glyph = malloc (sizeof (cairo_glyph_t));
+ glyph->index = index;
+ glyph->x = x;
+ glyph->y = y;
+ return getHandleFromPointer(env, glyph);
+}
+
+/*
+ * Class: org_freedesktop_cairo_Glyph
+ * Method: free
+ * Signature: (Lorg/gnu/javagnome/Handle;)V
+ */
+JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Glyph_free
+ (JNIEnv *env, jclass cls, jobject obj)
+{
+ cairo_glyph_t *glyph;
+
+ glyph = getPointerFromHandle(env, obj);
+ free(glyph);
+}
+
+/*
+ * Class: org_freedesktop_cairo_Glyph
* Method: get_index
* Signature: (Lorg/gnu/glib/Handle;)J
*/
@@ -53,6 +99,49 @@
return (jdouble)glyph->y;
}
+/*
+ * Class: org_freedesktop_cairo_Glyph
+ * Method: set_index
+ * Signature: (Lorg/gnu/javagnome/Handle;J)V
+ */
+JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Glyph_set_1index
+ (JNIEnv *env, jclass cls, jobject obj, jlong index)
+{
+ cairo_glyph_t *glyph;
+
+ glyph = getPointerFromHandle(env, obj);
+ glyph->index = index;
+}
+
+/*
+ * Class: org_freedesktop_cairo_Glyph
+ * Method: set_x
+ * Signature: (Lorg/gnu/javagnome/Handle;D)V
+ */
+JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Glyph_set_1x
+ (JNIEnv *env, jclass cls, jobject obj, jdouble x)
+{
+ cairo_glyph_t *glyph;
+
+ glyph = getPointerFromHandle(env, obj);
+ glyph->x = x;
+}
+
+/*
+ * Class: org_freedesktop_cairo_Glyph
+ * Method: set_y
+ * Signature: (Lorg/gnu/javagnome/Handle;D)V
+ */
+JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Glyph_set_1y
+ (JNIEnv *env, jclass cls, jobject obj, jdouble y)
+{
+ cairo_glyph_t *glyph;
+
+ glyph = getPointerFromHandle(env, obj);
+ glyph->y = y;
+}
+
+
#ifdef __cplusplus
}
#endif
- Previous message: [cairo-commit] cairo-java/src/jni
org_freedesktop_cairo_FontExtents.c, 1.1,
1.2 org_freedesktop_cairo_PDFSurface.c, 1.2,
1.3 org_freedesktop_cairo_Context.c, 1.5,
1.6 org_freedesktop_cairo_FontFace.c, 1.3, 1.4
- Next message: [cairo-commit] cairo-java ChangeLog,1.57,1.58
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list