[cairo-commit] cairo-java/test/org/freedesktop/cairo/test CairoSnippetsPDF.java, 1.1, 1.2 CairoSnippetsPNG.java, NONE, 1.1

Jeffrey Morgan commit at pdx.freedesktop.org
Fri Mar 4 13:03:40 PST 2005


Committed by: kuzman

Update of /cvs/cairo/cairo-java/test/org/freedesktop/cairo/test
In directory gabe:/tmp/cvs-serv16001/test/org/freedesktop/cairo/test

Modified Files:
	CairoSnippetsPDF.java 
Added Files:
	CairoSnippetsPNG.java 
Log Message:
More updates and PNG snippet code

Index: CairoSnippetsPDF.java
===================================================================
RCS file: /cvs/cairo/cairo-java/test/org/freedesktop/cairo/test/CairoSnippetsPDF.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CairoSnippetsPDF.java	4 Mar 2005 20:34:47 -0000	1.1
+++ CairoSnippetsPDF.java	4 Mar 2005 21:03:38 -0000	1.2
@@ -9,8 +9,6 @@
 
 package org.freedesktop.cairo.test;
 
-import java.io.IOException;
-
 import org.freedesktop.cairo.Cairo;
 import org.freedesktop.cairo.PdfSurface;
 
@@ -46,6 +44,6 @@
 		
 		// cleanup
 		cr.dispose();
-		surface.closeFile();
+		surface.close();
 	}
 }

--- NEW FILE: CairoSnippetsPNG.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.test;

import org.freedesktop.cairo.Cairo;
import org.freedesktop.cairo.Format;
import org.freedesktop.cairo.PngSurface;

/**
 */
public class CairoSnippetsPNG {

	public static int IMAGE_WIDTH = 256;
	public static int IMAGE_HEIGHT = 256;

	public static double LINE_WIDTH = 0.04;

	public static void main(String[] args) throws Exception {
		// call the snippets
		Snippets snip = new Snippets();
		for (int i = 0; i < Snippets.snippets.length; i++) {
			String filename = "./" + Snippets.snippets[i] + ".png";
			Cairo cr = new Cairo();
			PngSurface surface = new PngSurface(filename, Format.ARGB32, IMAGE_WIDTH, IMAGE_HEIGHT);
			cr.setTargetSurface(surface);
			
			cr.save();
			Snippets.invokeSnippet(snip, i, cr, IMAGE_WIDTH, IMAGE_HEIGHT);
			cr.restore();
			cr.showPage();
			cr.dispose();
			surface.close();
		}
	}
}




More information about the cairo-commit mailing list