[cairo-commit] cairo-java/src/jni org_freedesktop_cairo_FontOptions.c, NONE, 1.1 org_freedesktop_cairo_ScaledFont.c, 1.2, 1.3 org_freedesktop_cairo_Context.c, 1.7, 1.8 org_freedesktop_cairo_FontFace.c, 1.4, 1.5

Jeffrey Morgan commit at pdx.freedesktop.org
Sat Aug 13 15:11:24 PDT 2005


Committed by: kuzman

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

Modified Files:
	org_freedesktop_cairo_ScaledFont.c 
	org_freedesktop_cairo_Context.c 
	org_freedesktop_cairo_FontFace.c 
Added Files:
	org_freedesktop_cairo_FontOptions.c 
Log Message:
Updated API to match all cairo updates.

--- NEW FILE: org_freedesktop_cairo_FontOptions.c ---
/*
 * Java-Gnome Bindings Library
 *
 * Copyright 1998-2004 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.
 */

#include <stdlib.h>
#include <jni.h>
#include <cairo.h>
#include <jg_jnu.h>

#ifndef _Included_org_freedesktop_cairo_FontOptions
#define _Included_org_freedesktop_cairo_FontOptions
#ifdef __cplusplus
extern "C" {
#endif


/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_create
 * Signature: ()Lorg/gnu/javagnome/Handle;
 */
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1create
  (JNIEnv *env, jclass cls)
{
	return getHandleFromPointer(env, cairo_font_options_create());
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_set_antialias
 * Signature: (Lorg/gnu/javagnome/Handle;I)V
 */
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1set_1antialias
  (JNIEnv *env, jclass cls, jobject obj, jint antialias)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	cairo_font_options_set_antialias(options, (cairo_antialias_t)antialias);
}
/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_get_antialias
 * Signature: (Lorg/gnu/javagnome/Handle;)I
 */
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1get_1antialias
  (JNIEnv *env, jclass cls, jobject obj)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	return (jint)cairo_font_options_get_antialias(options);
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_set_subpixel_order
 * Signature: (Lorg/gnu/javagnome/Handle;I)V
 */
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1set_1subpixel_1order
  (JNIEnv *env, jclass cls, jobject obj, jint order)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	cairo_font_options_set_subpixel_order(options, (cairo_subpixel_order_t)order);
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_get_subpixel_order
 * Signature: (Lorg/gnu/javagnome/Handle;)I
 */
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1get_1subpixel_1order
  (JNIEnv *env, jclass cls, jobject obj)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	return (jint)cairo_font_options_get_subpixel_order(options);
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_set_hint_style
 * Signature: (Lorg/gnu/javagnome/Handle;I)V
 */
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1set_1hint_1style
  (JNIEnv *env, jclass cls, jobject obj, jint hint)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	cairo_font_options_set_hint_style(options, (cairo_hint_style_t)hint);
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_get_hint_style
 * Signature: (Lorg/gnu/javagnome/Handle;)I
 */
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1get_1hint_1style
  (JNIEnv *env, jclass cls, jobject obj)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	return (jint)cairo_font_options_get_hint_style(options);
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_set_hint_metrics
 * Signature: (Lorg/gnu/javagnome/Handle;I)V
 */
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1set_1hint_1metrics
  (JNIEnv *env, jclass cls, jobject obj, jint metrics)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	cairo_font_options_set_hint_metrics(options, (cairo_hint_metrics_t)metrics);
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_get_hint_metrics
 * Signature: (Lorg/gnu/javagnome/Handle;)I
 */
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1get_1hint_1metrics
  (JNIEnv *env, jclass cls, jobject obj)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	return (jint)cairo_font_options_get_hint_metrics(options);
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_destroy
 * Signature: (Lorg/gnu/javagnome/Handle;)V
 */
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1destroy
  (JNIEnv *env, jclass cls, jobject obj)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	cairo_font_options_destroy(options);
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_merge
 * Signature: (Lorg/gnu/javagnome/Handle;Lorg/gnu/javagnome/Handle;)V
 */
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1merge
  (JNIEnv *env, jclass cls, jobject obj, jobject other)
{
	cairo_font_options_t *options;
	cairo_font_options_t *other_g;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	other_g = (cairo_font_options_t*)getPointerFromHandle(env, other);
	cairo_font_options_merge(options, other_g);
	updateHandle(env, obj, options);
} 

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_equal
 * Signature: (Lorg/gnu/javagnome/Handle;Lorg/gnu/javagnome/Handle;)Z
 */
JNIEXPORT jboolean JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1equal
  (JNIEnv *env, jclass cls, jobject obj, jobject other)
{
	cairo_font_options_t *options;
	cairo_font_options_t *other_g;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	other_g = (cairo_font_options_t*)getPointerFromHandle(env, other);
	return cairo_font_options_equal(options, other_g);
}

/*
 * Class:     org_freedesktop_cairo_FontOptions
 * Method:    cairo_font_options_hash
 * Signature: (Lorg/gnu/javagnome/Handle;)J
 */
JNIEXPORT jlong JNICALL Java_org_freedesktop_cairo_FontOptions_cairo_1font_1options_1hash
  (JNIEnv *env, jclass cls, jobject obj)
{
	cairo_font_options_t *options;
	
	options = (cairo_font_options_t*)getPointerFromHandle(env, obj);
	return cairo_font_options_hash(options);
}



#ifdef __cplusplus
}
#endif
#endif

Index: org_freedesktop_cairo_ScaledFont.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_ScaledFont.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- org_freedesktop_cairo_ScaledFont.c	9 May 2005 16:02:07 -0000	1.2
+++ org_freedesktop_cairo_ScaledFont.c	13 Aug 2005 22:11:22 -0000	1.3
@@ -23,38 +23,36 @@
  * Signature: (Lorg/gnu/javagnome/Handle;Lorg/gnu/javagnome/Handle;Lorg/gnu/javagnome/Handle;)Lorg/gnu/javagnome/Handle;
  */
 JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_ScaledFont_cairo_1scaled_1font_1create
-  (JNIEnv *env, jclass cls, jobject face, jobject matrix, jobject ctm)
+  (JNIEnv *env, jclass cls, jobject face, jobject matrix, jobject ctm, jobject options)
 {
 	cairo_font_face_t *face_g;
 	cairo_matrix_t *matrix_g;
 	cairo_matrix_t *ctm_g;
 	cairo_scaled_font_t *sf;
+	cairo_font_options_t *options_g;
 	
 	face_g = (cairo_font_face_t*)getPointerFromHandle(env, face);
 	matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
 	ctm_g = (cairo_matrix_t*)getPointerFromHandle(env, ctm);
+	options_g = (cairo_font_options_t*)getPointerFromHandle(env, options);
 	
-	sf = cairo_scaled_font_create(face_g, matrix_g, ctm_g);
-	if (sf)
-		cairo_scaled_font_reference(sf); 
-	
-	return getHandleFromPointer(env, sf);
-		
+	sf = cairo_scaled_font_create(face_g, matrix_g, ctm_g, options_g);
+
+	return getHandleFromPointer(env, cairo_scaled_font_reference(sf)); 
 }
 
 /*
  * Class:     org_freedesktop_cairo_ScaledFont
  * Method:    cairo_scaled_font_extents
- * Signature: (Lorg/gnu/javagnome/Handle;Lorg/gnu/javagnome/Handle;)I
+ * Signature: (Lorg/gnu/javagnome/Handle;Lorg/gnu/javagnome/Handle;)V
  */
-JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_ScaledFont_cairo_1scaled_1font_1extents
+JNIEXPORT void JNICALL Java_org_freedesktop_cairo_ScaledFont_cairo_1scaled_1font_1extents
   (JNIEnv *env, jclass cls, jobject sfont, jobject ext)
 {
 	cairo_scaled_font_t *sfont_g = (cairo_scaled_font_t*)getPointerFromHandle(env, sfont);
 	cairo_font_extents_t* ext_g;
-	int status = cairo_scaled_font_extents(sfont_g, ext_g);
+	cairo_scaled_font_extents(sfont_g, ext_g);
 	updateHandle(env, ext, ext_g);
-	return status;
 }
 
 #ifdef __cplusplus

Index: org_freedesktop_cairo_Context.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_Context.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- org_freedesktop_cairo_Context.c	11 May 2005 00:43:56 -0000	1.7
+++ org_freedesktop_cairo_Context.c	13 Aug 2005 22:11:22 -0000	1.8
@@ -1081,6 +1081,29 @@
 	return (*env)->NewStringUTF(env, cairo_status_string(cr));
 }
 
+/*
+ * Class:     org_freedesktop_cairo_Context
+ * Method:    cairo_set_antialias
+ * Signature: (Lorg/gnu/glib/Handle;I)
+ */
+JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Context_cairo_1set_1antialias
+  (JNIEnv *env, jclass cls, jobject obj, jint antialias)
+{
+	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
+	cairo_set_antialias(cr, antialias);
+}
+
+/*
+ * Class:     org_freedesktop_cairo_Context
+ * Method:    cairo_get_antialias
+ * Signature: (Lorg/gnu/glib/Handle;I)
+ */
+JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Context_cairo_1get_1antialias
+  (JNIEnv *env, jclass cls, jobject obj)
+{
+	cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
+	return (jint)cairo_get_antialias(cr);
+}
 
 
 #ifdef __cplusplus

Index: org_freedesktop_cairo_FontFace.c
===================================================================
RCS file: /cvs/cairo/cairo-java/src/jni/org_freedesktop_cairo_FontFace.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- org_freedesktop_cairo_FontFace.c	10 May 2005 01:01:59 -0000	1.4
+++ org_freedesktop_cairo_FontFace.c	13 Aug 2005 22:11:22 -0000	1.5
@@ -32,7 +32,7 @@
 	// No way to malloc cairo_font_face_t
 //	font = malloc(sizeof(cairo_font_face_t));
 //	if (font)
-//		cairo_font_face_reference(font);
+//		return getHandleFromPointer(env, cairo_font_face_reference(font));
 //	return getHandleFromPointer(env, font);
 	return NULL;
 }




More information about the cairo-commit mailing list