[cairo-commit] cairo-java/src/java/org/freedesktop/cairo
PdfSurface.java, 1.8, NONE PDFSurface.java, NONE, 1.1
Jeffrey Morgan
commit at pdx.freedesktop.org
Mon May 2 18:40:42 PDT 2005
- Previous message: [cairo-commit] cairo-java/test/snippets Snippets.java, 1.3,
1.4 CairoSnippetsPS.java, 1.2, NONE CairoSnippetsPDF.java, 1.3,
1.4 CairoSnippetsPNG.java, 1.3, 1.4
- Next message: [cairo-commit] cairo-java/src/jni
org_freedesktop_cairo_PdfSurface.c, 1.5,
NONE org_freedesktop_cairo_PDFSurface.c, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: kuzman
Update of /cvs/cairo/cairo-java/src/java/org/freedesktop/cairo
In directory gabe:/tmp/cvs-serv8826/src/java/org/freedesktop/cairo
Added Files:
PDFSurface.java
Removed Files:
PdfSurface.java
Log Message:
Renamed PdfSurface to PDFSurface
--- PdfSurface.java DELETED ---
--- NEW FILE: PDFSurface.java ---
/*
* Java-Gnome Bindings Library
*
* Copyright 1998-2005 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.
*/
package org.freedesktop.cairo;
import java.io.File;
import java.io.IOException;
import org.gnu.javagnome.Handle;
/**
*/
public class PDFSurface extends Surface {
private String filename;
private double width;
private double height;
private double xPixels;
private double yPixels;
public PDFSurface(String filename, double widthInches, double heightInches,
double xPixelsPerInch, double yPixelsPerInch) throws IOException {
super(initialize(filename, widthInches, heightInches, xPixelsPerInch, yPixelsPerInch));
this.filename = filename;
width = widthInches;
height = heightInches;
xPixels = xPixelsPerInch;
yPixels = yPixelsPerInch;
}
public void close() {
close(getHandle());
}
private static Handle initialize(String filename, double widthInches, double heightInches,
double xPixels, double yPixels) throws IOException {
File f = new File(filename);
if (f.isDirectory())
throw new IOException(filename + " is a directory");
if (f.exists()) {
if (!f.canWrite())
throw new IOException("cannot write to file: " + filename);
}
else {
String parent = f.getParent();
if (null == parent)
parent = System.getProperty("user.dir");
File dir = new File(parent);
if (!dir.exists()) {
throw new IOException("destination directory doesn't exist: " + filename);
}
if (!dir.canWrite())
throw new IOException("Cannot write to file: " + filename);
}
return cairo_pdf_surface_create(filename, widthInches, heightInches, xPixels, yPixels);
}
void makeTarget(Context cr) {
cairo_set_target_pdf(cr.getHandle(), getHandle(), width, height, xPixels, yPixels);
}
/*
* Native calls
*/
native static final private void cairo_set_target_pdf(Handle cr, Handle sur,
double width_inches, double height_inches,
double x_pixels_per_inch, double y_pixels_per_inch);
native static final private Handle cairo_pdf_surface_create(String filename,
double width_inches, double height_inches,
double x_pixels_per_inch, double y_pixels_per_inch);
native static final private void close(Handle handle);
}
- Previous message: [cairo-commit] cairo-java/test/snippets Snippets.java, 1.3,
1.4 CairoSnippetsPS.java, 1.2, NONE CairoSnippetsPDF.java, 1.3,
1.4 CairoSnippetsPNG.java, 1.3, 1.4
- Next message: [cairo-commit] cairo-java/src/jni
org_freedesktop_cairo_PdfSurface.c, 1.5,
NONE org_freedesktop_cairo_PDFSurface.c, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list