author | Jaroslav Tulach <jtulach@netbeans.org> |
Wed, 16 Sep 2009 22:28:11 +0200 | |
branch | display-image |
changeset 91 | 786df32c496b |
permissions | -rw-r--r-- |
jtulach@91 | 1 |
package cz.xelfi.quoridor.visidor; |
jtulach@91 | 2 |
|
jtulach@91 | 3 |
import cz.xelfi.quoridor.Board; |
jtulach@91 | 4 |
import java.awt.Image; |
jtulach@91 | 5 |
import java.io.IOException; |
jtulach@91 | 6 |
import org.netbeans.api.visual.export.SceneExporter; |
jtulach@91 | 7 |
import org.netbeans.api.visual.widget.Scene; |
jtulach@91 | 8 |
|
jtulach@91 | 9 |
/** Utilities to draw board into an image. |
jtulach@91 | 10 |
* |
jtulach@91 | 11 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jtulach@91 | 12 |
*/ |
jtulach@91 | 13 |
public final class Visidor { |
jtulach@91 | 14 |
private Visidor() {} |
jtulach@91 | 15 |
|
jtulach@91 | 16 |
public static Image draw(Board b) { |
jtulach@91 | 17 |
Scene scene = new Scene(); |
jtulach@91 | 18 |
Viewer.drawBoard(scene, b); |
jtulach@91 | 19 |
try { |
jtulach@91 | 20 |
return SceneExporter.createImage(scene, null, SceneExporter.ImageType.PNG, SceneExporter.ZoomType.ACTUAL_SIZE, true, false, 10, 450, 450); |
jtulach@91 | 21 |
} catch (IOException ex) { |
jtulach@91 | 22 |
throw new IllegalStateException(); |
jtulach@91 | 23 |
} |
jtulach@91 | 24 |
} |
jtulach@91 | 25 |
|
jtulach@91 | 26 |
} |