[cairo-commit] cairo-java/src/jni org_freedesktop_cairo_PdfSurface.c, 1.5, NONE org_freedesktop_cairo_PDFSurface.c, NONE, 1.1

Jeffrey Morgan commit at pdx.freedesktop.org
Mon May 2 18:40:42 PDT 2005


Committed by: kuzman

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

Added Files:
	org_freedesktop_cairo_PDFSurface.c 
Removed Files:
	org_freedesktop_cairo_PdfSurface.c 
Log Message:
Renamed PdfSurface to PDFSurface

--- org_freedesktop_cairo_PdfSurface.c DELETED ---

--- 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 <stdlib.h>
#include <jni.h>
#include <cairo.h>
#include <cairo-pdf.h>
#include <jg_jnu.h>

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

typedef struct jg_pdfsurface {
	cairo_surface_t *surface;
	FILE *file;
} jg_pdfsurface_t;

/*
 * 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, 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(cr_g, s->file, width, height, x, y);
}

/*
 * 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)
{
	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(f, width, height, x, y);
	(*env)->ReleaseStringUTFChars(env, filename, fn);
	s->surface = sur;
	s->file = f;
	return getHandleFromPointer(env, s);
}

/*
 * Class:     org_freedesktop_cairo_PDFSurface
 * Method:    close_file
 * Signature: (Lorg/gnu/glib/Handle;)V
 */
JNIEXPORT void JNICALL Java_org_freedesktop_cairo_PDFSurface_close
  (JNIEnv *env, jclass cls, jobject sur)
{
	jg_pdfsurface_t *s = (jg_pdfsurface_t*)getPointerFromHandle(env, sur);
	fclose(s->file);
	free(s);
}


#ifdef __cplusplus
}
#endif
#endif




More information about the cairo-commit mailing list