1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/visidor/src/main/java/cz/xelfi/quoridor/visidor/Visidor.java Wed Sep 16 22:28:11 2009 +0200
1.3 @@ -0,0 +1,26 @@
1.4 +package cz.xelfi.quoridor.visidor;
1.5 +
1.6 +import cz.xelfi.quoridor.Board;
1.7 +import java.awt.Image;
1.8 +import java.io.IOException;
1.9 +import org.netbeans.api.visual.export.SceneExporter;
1.10 +import org.netbeans.api.visual.widget.Scene;
1.11 +
1.12 +/** Utilities to draw board into an image.
1.13 + *
1.14 + * @author Jaroslav Tulach <jtulach@netbeans.org>
1.15 + */
1.16 +public final class Visidor {
1.17 + private Visidor() {}
1.18 +
1.19 + public static Image draw(Board b) {
1.20 + Scene scene = new Scene();
1.21 + Viewer.drawBoard(scene, b);
1.22 + try {
1.23 + return SceneExporter.createImage(scene, null, SceneExporter.ImageType.PNG, SceneExporter.ZoomType.ACTUAL_SIZE, true, false, 10, 450, 450);
1.24 + } catch (IOException ex) {
1.25 + throw new IllegalStateException();
1.26 + }
1.27 + }
1.28 +
1.29 +}