01: package com.vividsolutions.jump.workbench.ui.plugin;
02:
03: import java.awt.Graphics2D;
04: import java.awt.Image;
05: import java.awt.image.BufferedImage;
06:
07: import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
08: import com.vividsolutions.jump.workbench.ui.LayerViewPanel;
09:
10: public abstract class ExportImagePlugIn extends AbstractPlugIn {
11:
12: protected static boolean java14OrNewer() {
13: String version = System.getProperty("java.version");
14: if (version.indexOf("1.0") == 0) {
15: return false;
16: }
17: if (version.indexOf("1.1") == 0) {
18: return false;
19: }
20: if (version.indexOf("1.2") == 0) {
21: return false;
22: }
23: if (version.indexOf("1.3") == 0) {
24: return false;
25: }
26: //Allow 1.4, 1.5, 1.6, 2.0, etc. [Jon Aquino]
27: return true;
28: }
29:
30: protected BufferedImage image(LayerViewPanel layerViewPanel) {
31: //Don't use TYPE_INT_ARGB, which makes JPEGs pinkish (presumably because
32: //JPEGs don't support transparency [Jon Aquino 11/6/2003]
33: BufferedImage image = new BufferedImage(layerViewPanel
34: .getWidth(), layerViewPanel.getHeight(),
35: BufferedImage.TYPE_INT_RGB);
36: layerViewPanel.paintComponent((Graphics2D) image.getGraphics());
37: return image;
38: }
39:
40: }
|