01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * Created on March 31, 2004, 4:09 PM
17: */
18: package org.geotools.renderer.lite;
19:
20: import java.awt.GraphicsEnvironment;
21: import java.awt.Transparency;
22: import java.awt.image.BufferedImage;
23:
24: import org.w3c.dom.Document;
25:
26: /**
27: *
28: * @author jamesm
29: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/render/src/main/java/org/geotools/renderer/lite/InternalTranscoder.java $
30: */
31: public class InternalTranscoder extends
32: org.apache.batik.transcoder.image.ImageTranscoder {
33:
34: private BufferedImage result;
35:
36: /** Creates a new instance of InternalTranscoder */
37: public InternalTranscoder() {
38: }
39:
40: public java.awt.image.BufferedImage createImage(int width,
41: int height) {
42: if (GraphicsEnvironment.isHeadless())
43: return new BufferedImage(width, height,
44: BufferedImage.TYPE_4BYTE_ABGR);
45: else
46: return GraphicsEnvironment.getLocalGraphicsEnvironment()
47: .getDefaultScreenDevice().getDefaultConfiguration()
48: .createCompatibleImage(width, height,
49: Transparency.TRANSLUCENT);
50: }
51:
52: //gets called by the end of the image transcoder with an actual image...
53: public void writeImage(java.awt.image.BufferedImage img,
54: org.apache.batik.transcoder.TranscoderOutput output) {
55: result = img;
56: }
57:
58: public BufferedImage getImage() {
59: return result;
60: }
61:
62: public void transcode(Document inputDoc) throws Exception {
63: super.transcode(inputDoc, null, null);
64: }
65:
66: }
|