[cairo-commit] cairo-java/src/jni org_freedesktop_cairo_Matrix.c,
NONE, 1.1 org_freedesktop_cairo_TextExtents.c, NONE,
1.1 org_freedesktop_cairo_Pattern.c, NONE,
1.1 org_freedesktop_cairo_PngSurface.c, NONE,
1.1 org_freedesktop_cairo_PdfSurface.c, NONE,
1.1 org_freedesktop_cairo_ImageSurface.c, NONE,
1.1 org_freedesktop_cairo_FontExtents.c, NONE,
1.1 org_freedesktop_cairo_Font.c, NONE,
1.1 org_freedesktop_cairo_Surface.c, NONE,
1.1 org_freedesktop_cairo_Cairo.c, NONE,
1.1 org_freedesktop_cairo_Glyph.c, NONE,
1.1 org_freedesktop_cairo_FreetypeFont.c, NONE,
1.1 org_freedesktop_cairo_PsSurface.c, NONE, 1.1
Jeffrey Morgan
commit at pdx.freedesktop.org
Wed Feb 23 10:17:55 PST 2005
- Previous message: [cairo-commit] cairo-java autogen.sh, NONE, 1.1 .project, NONE,
1.1 AUTHORS, NONE, 1.1 COPYING, NONE, 1.1 .classpath, NONE,
1.1 Makefile.am, NONE, 1.1 configure.ac, NONE, 1.1 ChangeLog,
NONE, 1.1 INSTALL, NONE, 1.1 README, NONE, 1.1 .cvsignore,
NONE, 1.1 cairo-java.pc.in, NONE, 1.1 NEWS, NONE, 1.1
- Next message: [cairo-commit] roadster/data Makefile.am,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: kuzman
Update of /cvs/cairo/cairo-java/src/jni
In directory gabe:/tmp/cvs-serv32536/src/jni
Added Files:
org_freedesktop_cairo_Matrix.c
org_freedesktop_cairo_TextExtents.c
org_freedesktop_cairo_Pattern.c
org_freedesktop_cairo_PngSurface.c
org_freedesktop_cairo_PdfSurface.c
org_freedesktop_cairo_ImageSurface.c
org_freedesktop_cairo_FontExtents.c
org_freedesktop_cairo_Font.c org_freedesktop_cairo_Surface.c
org_freedesktop_cairo_Cairo.c org_freedesktop_cairo_Glyph.c
org_freedesktop_cairo_FreetypeFont.c
org_freedesktop_cairo_PsSurface.c
Log Message:
Initial import
--- NEW FILE: org_freedesktop_cairo_Matrix.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 <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_Matrix
#define _Included_org_freedesktop_cairo_Matrix
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_create
* Signature: ()Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1create
(JNIEnv *env, jclass cls)
{
return getHandleFromPointer(env, cairo_matrix_create());
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_destroy
* Signature: (Lorg/gnu/glib/Handle;)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1destroy
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
cairo_matrix_destroy(matrix);
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_copy
* Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1copy
(JNIEnv *env, jclass cls, jobject dest, jobject src)
{
cairo_matrix_t *dest_g = (cairo_matrix_t*)getPointerFromHandle(env, dest);
cairo_matrix_t *src_g = (cairo_matrix_t*)getPointerFromHandle(env, src);
int status = cairo_matrix_copy(dest_g, src_g);
updateHandle(env, dest, dest_g);
return status;
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_set_identity
* Signature: (Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1set_1identity
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
return (jint)cairo_matrix_set_identity(matrix);
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_set_affine
* Signature: (Lorg/gnu/glib/Handle;DDDDDD)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1set_1affine
(JNIEnv *env, jclass cls, jobject obj, jdouble a, jdouble b, jdouble c, jdouble d,
jdouble tx, jdouble ty)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
return (jint)cairo_matrix_set_affine(matrix, a, b, c, d, tx, ty);
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_get_affine
* Signature: (Lorg/gnu/glib/Handle;[D[D[D[D[D[D)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1get_1affine
(JNIEnv *env, jclass cls, jobject obj, jdoubleArray a, jdoubleArray b, jdoubleArray c,
jdoubleArray d, jdoubleArray tx, jdoubleArray ty)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
double *a_g = (double*)(*env)->GetDoubleArrayElements(env, a, NULL);
double *b_g = (double*)(*env)->GetDoubleArrayElements(env, b, NULL);
double *c_g = (double*)(*env)->GetDoubleArrayElements(env, c, NULL);
double *d_g = (double*)(*env)->GetDoubleArrayElements(env, d, NULL);
double *tx_g = (double*)(*env)->GetDoubleArrayElements(env, tx, NULL);
double *ty_g = (double*)(*env)->GetDoubleArrayElements(env, ty, NULL);
int status = cairo_matrix_get_affine(matrix, a_g, b_g, c_g, d_g, tx_g, ty_g);
(*env)->ReleaseDoubleArrayElements(env, a, a_g, 0);
(*env)->ReleaseDoubleArrayElements(env, b, b_g, 0);
(*env)->ReleaseDoubleArrayElements(env, c, c_g, 0);
(*env)->ReleaseDoubleArrayElements(env, d, d_g, 0);
(*env)->ReleaseDoubleArrayElements(env, tx, tx_g, 0);
(*env)->ReleaseDoubleArrayElements(env, ty, ty_g, 0);
return status;
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_translate
* Signature: (Lorg/gnu/glib/Handle;DD)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1translate
(JNIEnv *env, jclass cls, jobject obj, jdouble tx, jdouble ty)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
return (jint)cairo_matrix_translate(matrix, tx, ty);
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_scale
* Signature: (Lorg/gnu/glib/Handle;DD)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1scale
(JNIEnv *env, jclass cls, jobject obj, jdouble sx, jdouble sy)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
return (jint)cairo_matrix_scale(matrix, sx, sy);
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_rotate
* Signature: (Lorg/gnu/glib/Handle;D)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1rotate
(JNIEnv *env, jclass cls, jobject obj, jdouble rad)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
return (jint)cairo_matrix_rotate(matrix, rad);
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_invert
* Signature: (Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1invert
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
return (jint)cairo_matrix_invert(matrix);
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_multiply
* Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1multiply
(JNIEnv *env, jclass cls, jobject dest, jobject one, jobject two)
{
cairo_matrix_t *dest_g = (cairo_matrix_t*)getPointerFromHandle(env, dest);
cairo_matrix_t *one_g = (cairo_matrix_t*)getPointerFromHandle(env, one);
cairo_matrix_t *two_g = (cairo_matrix_t*)getPointerFromHandle(env, two);
int status = cairo_matrix_multiply(dest_g, one_g, two_g);
updateHandle(env, dest, dest_g);
return status;
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_transform_distance
* Signature: (Lorg/gnu/glib/Handle;[D[D)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1transform_1distance
(JNIEnv *env, jclass cls, jobject obj, jdoubleArray dx, jdoubleArray dy)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
double *dx_g = (double*)(*env)->GetDoubleArrayElements(env, dx, NULL);
double *dy_g = (double*)(*env)->GetDoubleArrayElements(env, dy, NULL);
int status = cairo_matrix_transform_distance(matrix, dx_g, dy_g);
(*env)->ReleaseDoubleArrayElements(env, dx, dx_g, 0);
(*env)->ReleaseDoubleArrayElements(env, dy, dy_g, 0);
return status;
}
/*
* Class: org_freedesktop_cairo_Matrix
* Method: cairo_matrix_transform_point
* Signature: (Lorg/gnu/glib/Handle;[D[D)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Matrix_cairo_1matrix_1transform_1point
(JNIEnv *env, jclass cls, jobject obj, jdoubleArray dx, jdoubleArray dy)
{
cairo_matrix_t *matrix = (cairo_matrix_t*)getPointerFromHandle(env, obj);
double *dx_g = (double*)(*env)->GetDoubleArrayElements(env, dx, NULL);
double *dy_g = (double*)(*env)->GetDoubleArrayElements(env, dy, NULL);
int status = cairo_matrix_transform_point(matrix, dx_g, dy_g);
(*env)->ReleaseDoubleArrayElements(env, dx, dx_g, 0);
(*env)->ReleaseDoubleArrayElements(env, dy, dy_g, 0);
return status;
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_TextExtents.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 <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_TextExtents
#define _Included_org_freedesktop_cairo_TextExtents
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_TextExtents
* Method: get_x_bearing
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_TextExtents_get_1x_1bearing
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_text_extents_t *te = (cairo_text_extents_t*)getPointerFromHandle(env, obj);
return te->x_bearing;
}
/*
* Class: org_freedesktop_cairo_TextExtents
* Method: get_y_bearning
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_TextExtents_get_1y_1bearning
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_text_extents_t *te = (cairo_text_extents_t*)getPointerFromHandle(env, obj);
return te->y_bearing;
}
/*
* Class: org_freedesktop_cairo_TextExtents
* Method: get_width
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_TextExtents_get_1width
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_text_extents_t *te = (cairo_text_extents_t*)getPointerFromHandle(env, obj);
return te->width;
}
/*
* Class: org_freedesktop_cairo_TextExtents
* Method: get_height
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_TextExtents_get_1height
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_text_extents_t *te = (cairo_text_extents_t*)getPointerFromHandle(env, obj);
return te->height;
}
/*
* Class: org_freedesktop_cairo_TextExtents
* Method: get_x_advance
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_TextExtents_get_1x_1advance
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_text_extents_t *te = (cairo_text_extents_t*)getPointerFromHandle(env, obj);
return te->x_advance;
}
/*
* Class: org_freedesktop_cairo_TextExtents
* Method: get_y_advance
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_TextExtents_get_1y_1advance
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_text_extents_t *te = (cairo_text_extents_t*)getPointerFromHandle(env, obj);
return te->y_advance;
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_Pattern.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 <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_Pattern
#define _Included_org_freedesktop_cairo_Pattern
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_create_for_surface
* Signature: (Lorg/gnu/glib/Handle;)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1create_1for_1surface
(JNIEnv *env, jclass cls, jobject surface)
{
cairo_surface_t *surface_g = (cairo_surface_t*)getPointerFromHandle(env, surface);
return getHandleFromPointer(env, cairo_pattern_create_for_surface(surface_g));
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_create_linear
* Signature: (DDDD)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1create_1linear
(JNIEnv *env, jclass cls, jdouble x1, jdouble y1, jdouble x2, jdouble y2)
{
return getHandleFromPointer(env, cairo_pattern_create_linear(x1, y1, x2, y2));
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_create_radial
* Signature: (DDDDDD)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1create_1radial
(JNIEnv *env, jclass cls, jdouble x1, jdouble y1, jdouble radius1,
jdouble x2, jdouble y2, jdouble radius2)
{
return getHandleFromPointer(env, cairo_pattern_create_radial(x1, y1, radius1, x2, y2, radius2));
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_reference
* Signature: (Lorg/gnu/glib/Handle;)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1reference
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_pattern_t *pat = (cairo_pattern_t*)getPointerFromHandle(env, obj);
cairo_pattern_reference(pat);
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_destroy
* Signature: (Lorg/gnu/glib/Handle;)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1destroy
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_pattern_t *pat = (cairo_pattern_t*)getPointerFromHandle(env, obj);
cairo_pattern_destroy(pat);
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_add_color_stop
* Signature: (Lorg/gnu/glib/Handle;DDDDD)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1add_1color_1stop
(JNIEnv *env, jclass cls, jobject obj, jdouble offset, jdouble red, jdouble green,
jdouble blue, jdouble alpha)
{
cairo_pattern_t *pat = (cairo_pattern_t*)getPointerFromHandle(env, obj);
return cairo_pattern_add_color_stop(pat, offset, red, green, blue, alpha);
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_set_matrix
* Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1set_1matrix
(JNIEnv *env, jclass cls, jobject obj, jobject matrix)
{
cairo_pattern_t *pat = (cairo_pattern_t*)getPointerFromHandle(env, obj);
cairo_matrix_t *matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
return cairo_pattern_set_matrix(pat, matrix_g);
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_get_matrix
* Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1get_1matrix
(JNIEnv *env, jclass cls, jobject obj, jobject matrix)
{
cairo_pattern_t *pat = (cairo_pattern_t*)getPointerFromHandle(env, obj);
cairo_matrix_t *matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
int status = cairo_pattern_get_matrix(pat, matrix_g);
updateHandle(env, matrix, matrix_g);
return status;
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_set_extend
* Signature: (Lorg/gnu/glib/Handle;I)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1set_1extend
(JNIEnv *env, jclass cls, jobject obj, jint extend)
{
cairo_pattern_t *pat = (cairo_pattern_t*)getPointerFromHandle(env, obj);
return cairo_pattern_set_extend(pat, (cairo_extend_t)extend);
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_get_extents
* Signature: (Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1get_1extents
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_pattern_t *pat = (cairo_pattern_t*)getPointerFromHandle(env, obj);
return (jint)cairo_pattern_get_extend(pat);
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_set_filter
* Signature: (Lorg/gnu/glib/Handle;I)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1set_1filter
(JNIEnv *env, jclass cls, jobject obj, jint filter)
{
cairo_pattern_t *pat = (cairo_pattern_t*)getPointerFromHandle(env, obj);
return cairo_pattern_set_filter(pat, (cairo_filter_t)filter);
}
/*
* Class: org_freedesktop_cairo_Pattern
* Method: cairo_pattern_get_filter
* Signature: (Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Pattern_cairo_1pattern_1get_1filter
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_pattern_t *pat = (cairo_pattern_t*)getPointerFromHandle(env, obj);
return (jint)cairo_pattern_get_filter(pat);
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_PngSurface.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 <stdio.h>
#include <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_PngSurface
#define _Included_org_freedesktop_cairo_PngSurface
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_PngSurface
* Method: cairo_set_target_png
* 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, jstring filename, jint format,
jint width, jint height)
{
cairo_t *cr_g = (cairo_t*)getPointerFromHandle(env, cr);
char *fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
FILE *f = fopen(fn, "w");
cairo_set_target_png(cr_g, f, (cairo_format_t)format, width, height);
(*env)->ReleaseStringUTFChars(env, filename, fn);
}
/*
* Class: org_freedesktop_cairo_PngSurface
* Method: cairo_png_surface_create
* 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)
{
char *fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
FILE *f = fopen(fn, "w");
cairo_surface_t *sur = cairo_png_surface_create(f, (cairo_format_t)format,
width, height);
(*env)->ReleaseStringUTFChars(env, filename, fn);
return getHandleFromPointer(env, sur);
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_PdfSurface.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 <stdio.h>
#include <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_PdfSurface
#define _Included_org_freedesktop_cairo_PdfSurface
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_PdfSurface
* 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
(JNIEnv *env, jclass cls, jobject cr, jstring filename, jdouble width, jdouble height,
jdouble x, jdouble y)
{
cairo_t *cr_g = (cairo_t*)getPointerFromHandle(env, cr);
char *fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
FILE *f = fopen(fn, "w");
cairo_set_target_pdf(cr_g, f, width, height, x, y);
(*env)->ReleaseStringUTFChars(env, filename, fn);
}
/*
* Class: org_freedesktop_cairo_PdfSurface
* 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
(JNIEnv *env, jclass cls, jstring filename, jdouble width, jdouble height,
jdouble x, jdouble y)
{
char *fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
FILE *f = fopen(fn, "w");
cairo_surface_t *sur = cairo_pdf_surface_create(f, width, height, x, y);
(*env)->ReleaseStringUTFChars(env, filename, fn);
return getHandleFromPointer(env, sur);
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_ImageSurface.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 <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_ImageSurface
#define _Included_org_freedesktop_cairo_ImageSurface
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_ImageSurface
* Method: cairo_image_surface_create
* Signature: (III)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_ImageSurface_cairo_1image_1surface_1create
(JNIEnv *env, jclass cls, jint format, jint width, jint height)
{
return getHandleFromPointer(env, cairo_image_surface_create((cairo_format_t)format, width, height));
}
/*
* Class: org_freedesktop_cairo_ImageSurface
* Method: cairo_image_surface_create_for_data
* Signature: (Ljava/lang/String;IIII)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_ImageSurface_cairo_1image_1surface_1create_1for_1data
(JNIEnv *env, jclass cls, jstring data, jint format, jint width, jint height, jint stride)
{
char* data_g = (char*)(*env)->GetStringUTFChars(env, data, NULL);
jobject hndl = getHandleFromPointer(env, cairo_image_surface_create_for_data(data_g,
(cairo_format_t)format, width, height, stride));
(*env)->ReleaseStringUTFChars(env, data, data_g);
return hndl;
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_FontExtents.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 <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_FontExtents
#define _Included_org_freedesktop_cairo_FontExtents
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_FontExtents
* Method: get_ascent
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_FontExtents_get_1ascent
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_font_extents_t *fe = (cairo_font_extents_t*)getPointerFromHandle(env, obj);
return (jdouble)fe->ascent;
}
/*
* Class: org_freedesktop_cairo_FontExtents
* Method: get_descent
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_FontExtents_get_1descent
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_font_extents_t *fe = (cairo_font_extents_t*)getPointerFromHandle(env, obj);
return (jdouble)fe->descent;
}
/*
* Class: org_freedesktop_cairo_FontExtents
* Method: get_height
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_FontExtents_get_1height
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_font_extents_t *fe = (cairo_font_extents_t*)getPointerFromHandle(env, obj);
return (jdouble)fe->height;
}
/*
* Class: org_freedesktop_cairo_FontExtents
* Method: get_max_x_advance
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_FontExtents_get_1max_1x_1advance
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_font_extents_t *fe = (cairo_font_extents_t*)getPointerFromHandle(env, obj);
return (jdouble)fe->max_x_advance;
}
/*
* Class: org_freedesktop_cairo_FontExtents
* Method: get_max_y_advance
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_FontExtents_get_1max_1y_1advance
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_font_extents_t *fe = (cairo_font_extents_t*)getPointerFromHandle(env, obj);
return (jdouble)fe->max_y_advance;
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_Font.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 <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_Font
#define _Included_org_freedesktop_cairo_Font
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_Font
* Method: cairo_font_reference
* Signature: (Lorg/gnu/glib/Handle;)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Font_cairo_1font_1reference
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_font_t *font = (cairo_font_t*)getPointerFromHandle(env, obj);
cairo_font_reference(font);
}
/*
* Class: org_freedesktop_cairo_Font
* Method: cairo_font_destroy
* Signature: (Lorg/gnu/glib/Handle;)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Font_cairo_1font_1destroy
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_font_t *font = (cairo_font_t*)getPointerFromHandle(env, obj);
cairo_font_destroy(font);
}
/*
* Class: org_freedesktop_cairo_Font
* Method: cairo_font_extents
* Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Font_cairo_1font_1extents
(JNIEnv *env, jclass cls, jobject obj, jobject matrix, jobject extents)
{
cairo_font_t *font = (cairo_font_t*)getPointerFromHandle(env, obj);
cairo_matrix_t *matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
cairo_font_extents_t *extents_g = (cairo_font_extents_t*)getPointerFromHandle(env, extents);
int status = cairo_font_extents(font, matrix_g, extents_g);
updateHandle(env, extents, extents_g);
return status;
}
/*
* Class: org_freedesktop_cairo_Font
* Method: cairo_font_glyph_extents
* Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;[Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Font_cairo_1font_1glyph_1extents
(JNIEnv *env, jclass cls, jobject obj, jobject matrix, jobjectArray glyphs, jobject extents)
{
cairo_font_t *font = (cairo_font_t*)getPointerFromHandle(env, obj);
cairo_matrix_t *matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
cairo_glyph_t *glyphs_g = (cairo_glyph_t*)getPointerArrayFromHandles(env, glyphs);
cairo_text_extents_t *extents_g = (cairo_text_extents_t*)getPointerFromHandle(env, extents);
int len = (*env)->GetArrayLength(env, glyphs);
cairo_font_glyph_extents(font, matrix_g, glyphs_g, len, extents_g);
updateHandle(env, extents, extents_g);
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_Surface.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 <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_Surface
#define _Included_org_freedesktop_cairo_Surface
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_create_for_image
* Signature: (Ljava/lang/String;IIII)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1create_1for_1image
(JNIEnv *env, jclass cls, jstring data, jint format, jint width, jint height, jint stride)
{
char *data_g = (char*)(*env)->GetStringUTFChars(env, data, NULL);
jobject hndl = getHandleFromPointer(env, cairo_surface_create_for_image(data_g, (cairo_format_t)format,
width, height, stride));
(*env)->ReleaseStringUTFChars(env, data, data_g);
return hndl;
}
/*
* Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_create_similar
* Signature: (Lorg/gnu/glib/Handle;III)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1create_1similar
(JNIEnv *env, jclass cls, jobject other, jint format, jint width, jint height)
{
cairo_surface_t *other_g = (cairo_surface_t*)getPointerFromHandle(env, other);
return getHandleFromPointer(env, cairo_surface_create_similar(other_g, (cairo_format_t)format,
width, height));
}
/*
* Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_reference
* Signature: (Lorg/gnu/glib/Handle;)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1reference
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
cairo_surface_reference(surface);
}
/*
* Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_destroy
* Signature: (Lorg/gnu/glib/Handle;)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1destroy
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
cairo_surface_destroy(surface);
}
/*
* Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_set_repeat
* Signature: (Lorg/gnu/glib/Handle;I)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1set_1repeat
(JNIEnv *env, jclass cls, jobject obj, jint repeat)
{
cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
cairo_surface_set_repeast(surface, repeat);
}
/*
* Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_set_matrix
* Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1set_1matrix
(JNIEnv *env, jclass cls, jobject obj, jobject matrix)
{
cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
cairo_matrix_t *matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
return (jint)cairo_surface_set_matrix(surface, matrix_g);
}
/*
* Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_get_matrix
* Signature: (Lorg/gnu/glib/Handle;Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1get_1matrix
(JNIEnv *env, jclass cls, jobject obj, jobject matrix)
{
cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
cairo_matrix_t *matrix_g = (cairo_matrix_t*)getPointerFromHandle(env, matrix);
jint status = (jint)cairo_surface_set_matrix(surface, matrix_g);
updateHandle(env, matrix, matrix_g);
return status;
}
/*
* Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_set_filter
* Signature: (Lorg/gnu/glib/Handle;I)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1set_1filter
(JNIEnv *env, jclass cls, jobject obj, jint filter)
{
cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
return cairo_surface_set_filter(surface, (cairo_filter_t)filter);
}
/*
* Class: org_freedesktop_cairo_Surface
* Method: cairo_surface_get_filter
* Signature: (Lorg/gnu/glib/Handle;)I
*/
JNIEXPORT jint JNICALL Java_org_freedesktop_cairo_Surface_cairo_1surface_1get_1filter
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_surface_t *surface = (cairo_surface_t*)getPointerFromHandle(env, obj);
return cairo_surface_get_filter(surface);
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_Cairo.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 <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_Cairo
#define _Included_org_freedesktop_cairo_Cairo
#ifdef __cplusplus
extern "C" {
#endif
[...1118 lines suppressed...]
cairo_current_point(cr, &curx, &cury);
cairo_line_to(cr, curx, y);
}
/*
* Class: org_freedesktop_cairo_Cairo
* Method: cairo_rel_vline_to
* Signature: (Lorg/gnu/glib/Handle;D)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_Cairo_cairo_1rel_1vline_1to
(JNIEnv *env, jclass cls, jobject obj, jdouble y)
{
cairo_t *cr = (cairo_t*)getPointerFromHandle(env, obj);
cairo_rel_line_to(cr, 0.0, y);
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_Glyph.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 <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_Glyph
#define _Included_org_freedesktop_cairo_Glyph
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_Glyph
* Method: get_index
* Signature: (Lorg/gnu/glib/Handle;)J
*/
JNIEXPORT jlong JNICALL Java_org_freedesktop_cairo_Glyph_get_1index
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_glyph_t *glyph = (cairo_glyph_t*)getPointerFromHandle(env, obj);
return (jlong)glyph->index;
}
/*
* Class: org_freedesktop_cairo_Glyph
* Method: get_x
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_Glyph_get_1x
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_glyph_t *glyph = (cairo_glyph_t*)getPointerFromHandle(env, obj);
return (jdouble)glyph->x;
}
/*
* Class: org_freedesktop_cairo_Glyph
* Method: get_y
* Signature: (Lorg/gnu/glib/Handle;)D
*/
JNIEXPORT jdouble JNICALL Java_org_freedesktop_cairo_Glyph_get_1y
(JNIEnv *env, jclass cls, jobject obj)
{
cairo_glyph_t *glyph = (cairo_glyph_t*)getPointerFromHandle(env, obj);
return (jdouble)glyph->y;
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_FreetypeFont.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 <jni.h>
#include <cairo.h>
#include <cairo-ft.h>
#include <freetype/freetype.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_FreetypeFont
#define _Included_org_freedesktop_cairo_FreetypeFont
#ifdef __cplusplus
extern "C" {
#endif
static FT_Library ft_library;
static short ft_lib_init = 0;
#define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0))
/*
* Class: org_freedesktop_cairo_FreetypeFont
* Method: cairo_ft_font_create
* Signature: (Ljava/lang/String;II)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_FreetypeFont_cairo_1ft_1font_1create__Ljava_lang_String_2II
(JNIEnv *env, jclass cls, jstring family, jint slant, jint weight)
{
const char *family_utf = (*env)->GetStringUTFChars(env, family, NULL);
cairo_font_t *font = NULL;
FcPattern * pat = NULL;
int fcslant;
int fcweight;
FT_Error error;
pat = FcPatternCreate ();
if (pat == NULL)
return 0;
switch (weight)
{
case CAIRO_FONT_WEIGHT_BOLD:
fcweight = FC_WEIGHT_BOLD;
break;
case CAIRO_FONT_WEIGHT_NORMAL:
default:
fcweight = FC_WEIGHT_MEDIUM;
break;
}
switch (slant)
{
case CAIRO_FONT_SLANT_ITALIC:
fcslant = FC_SLANT_ITALIC;
break;
case CAIRO_FONT_SLANT_OBLIQUE:
fcslant = FC_SLANT_OBLIQUE;
break;
case CAIRO_FONT_SLANT_NORMAL:
default:
fcslant = FC_SLANT_ROMAN;
break;
}
FcPatternAddString (pat, FC_FAMILY, (const FcChar8*) family_utf);
FcPatternAddInteger (pat, FC_SLANT, fcslant);
FcPatternAddInteger (pat, FC_WEIGHT, fcweight);
if (ft_lib_init == 0) {
error = FT_Init_FreeType (&ft_library);
if (error) {
FcPatternDestroy (pat);
return 0;
}
ft_lib_init = 1;
}
font = cairo_ft_font_create (ft_library, pat);
if (font == NULL)
return 0;
FT_Set_Char_Size (cairo_ft_font_face(font),
DOUBLE_TO_26_6 (1.0),
DOUBLE_TO_26_6 (1.0),
0, 0);
FcPatternDestroy (pat);
(*env)->ReleaseStringUTFChars(env, family, family_utf);
return getHandleFromPointer(env, font);
}
/*
* Class: org_freedesktop_cairo_FreetypeFont
* Method: cairo_ft_font_create
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_FreetypeFont_cairo_1ft_1font_1create__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2
(JNIEnv *env, jclass cls, jstring family, jstring slant, jstring weight)
{
const char *family_utf = (*env)->GetStringUTFChars(env, family, NULL);
const char *slant_utf = (*env)->GetStringUTFChars(env, slant, NULL);
const char *weight_utf = (*env)->GetStringUTFChars(env, weight, NULL);
cairo_font_t *font = NULL;
FcPattern * pat = NULL;
FT_Error error;
char fontBuf[256];
strcpy(fontBuf, family_utf);
strcat(fontBuf, ":");
strcat(fontBuf, weight_utf);
strcat(fontBuf, ":");
strcat(fontBuf, slant_utf);
pat = FcNameParse ((const FcChar8*) fontBuf);
if (pat == NULL)
return 0;
if (ft_lib_init == 0) {
error = FT_Init_FreeType (&ft_library);
if (error) {
FcPatternDestroy (pat);
return 0;
}
ft_lib_init = 1;
}
font = cairo_ft_font_create (ft_library, pat);
if (font == NULL)
return 0;
FT_Set_Char_Size (cairo_ft_font_face(font),
DOUBLE_TO_26_6 (1.0),
DOUBLE_TO_26_6 (1.0),
0, 0);
FcPatternDestroy (pat);
(*env)->ReleaseStringUTFChars(env, family, family_utf);
(*env)->ReleaseStringUTFChars(env, slant, slant_utf);
(*env)->ReleaseStringUTFChars(env, weight, weight_utf);
return getHandleFromPointer(env, font);
}
#ifdef __cplusplus
}
#endif
#endif
--- NEW FILE: org_freedesktop_cairo_PsSurface.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 <stdio.h>
#include <jni.h>
#include <cairo.h>
#include <jg_jnu.h>
#ifndef _Included_org_freedesktop_cairo_PsSurface
#define _Included_org_freedesktop_cairo_PsSurface
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_freedesktop_cairo_PsSurface
* Method: cairo_set_target_ps
* Signature: (Lorg/gnu/glib/Handle;Ljava/lang/String;DDDD)V
*/
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PsSurface_cairo_1set_1target_1ps
(JNIEnv *env, jclass cls, jobject cr, jstring filename, jdouble width, jdouble height,
jdouble x, jdouble y)
{
cairo_t *cr_g = (cairo_t*)getPointerFromHandle(env, cr);
char *fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
FILE *f = fopen(fn, "w");
cairo_set_target_ps(cr_g, f, width, height, x, y);
(*env)->ReleaseStringUTFChars(env, filename, fn);
}
/*
* Class: org_freedesktop_cairo_PsSurface
* Method: cairo_ps_surface_create
* Signature: (Ljava/lang/String;DDDD)Lorg/gnu/glib/Handle;
*/
JNIEXPORT jobject JNICALL Java_org_freedesktop_cairo_PsSurface_cairo_1ps_1surface_1create
(JNIEnv *env, jclass cls, jstring filename, jdouble width, jdouble height,
jdouble x, jdouble y)
{
char *fn = (char*)(*env)->GetStringUTFChars(env, filename, NULL);
FILE *f = fopen(fn, "w");
cairo_surface_t *sur = cairo_ps_surface_create(f, width, height, x, y);
(*env)->ReleaseStringUTFChars(env, filename, fn);
return getHandleFromPointer(env, sur);
}
#ifdef __cplusplus
}
#endif
#endif
- Previous message: [cairo-commit] cairo-java autogen.sh, NONE, 1.1 .project, NONE,
1.1 AUTHORS, NONE, 1.1 COPYING, NONE, 1.1 .classpath, NONE,
1.1 Makefile.am, NONE, 1.1 configure.ac, NONE, 1.1 ChangeLog,
NONE, 1.1 INSTALL, NONE, 1.1 README, NONE, 1.1 .cvsignore,
NONE, 1.1 cairo-java.pc.in, NONE, 1.1 NEWS, NONE, 1.1
- Next message: [cairo-commit] roadster/data Makefile.am,NONE,1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list