diff options
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/visualization/batikutil')
16 files changed, 477 insertions, 13 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AddCSSClass.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AddCSSClass.java index 068b538a..0e2db37d 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AddCSSClass.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AddCSSClass.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AttributeModifier.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AttributeModifier.java index f1e62754..f52951d7 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AttributeModifier.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/AttributeModifier.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/BatikUtil.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/BatikUtil.java index f219a0ba..4f9781e7 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/BatikUtil.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/BatikUtil.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CSSHoverClass.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CSSHoverClass.java index d65256c0..3e9f355a 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CSSHoverClass.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CSSHoverClass.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CloneInlineImages.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CloneInlineImages.java new file mode 100644 index 00000000..a1dd3ba1 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/CloneInlineImages.java @@ -0,0 +1,143 @@ +package de.lmu.ifi.dbs.elki.visualization.batikutil; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2012 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.awt.image.renderable.RenderableImage; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import org.apache.batik.svggen.SVGSyntax; +import org.apache.batik.util.Base64EncoderStream; +import org.apache.batik.util.ParsedURL; +import org.apache.batik.util.SVGConstants; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +import de.lmu.ifi.dbs.elki.logging.LoggingUtil; +import de.lmu.ifi.dbs.elki.visualization.svg.SVGCloneVisible; + +/** + * Clone an SVG document, inlining temporary and in-memory linked images. + * + * @author Erich Schubert + * + */ +public class CloneInlineImages extends SVGCloneVisible { + @Override + public Node cloneNode(Document doc, Node eold) { + Node enew = null; + if(eold instanceof Element) { + Element e = (Element) eold; + if(e.getTagName().equals(SVGConstants.SVG_IMAGE_TAG)) { + String url = e.getAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE); + ParsedURL urldata = new ParsedURL(url); + if(ThumbnailRegistryEntry.isCompatibleURLStatic(urldata)) { + enew = inlineThumbnail(doc, urldata, eold); + } + else if("file".equals(urldata.getProtocol())) { + enew = inlineExternal(doc, urldata, eold); + } + } + } + if(enew != null) { + return enew; + } + return super.cloneNode(doc, eold); + } + + /** + * Inline a referenced thumbnail. + * + * @param doc Document (element factory) + * @param urldata URL + * @param eold Existing node + * @return Replacement node, or {@code null} + */ + protected Node inlineThumbnail(Document doc, ParsedURL urldata, Node eold) { + RenderableImage img = ThumbnailRegistryEntry.handleURL(urldata); + if(img == null) { + LoggingUtil.warning("Image not found in registry: " + urldata.toString()); + return null; + } + ByteArrayOutputStream os = new ByteArrayOutputStream(); + try { + os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); + Base64EncoderStream encoder = new Base64EncoderStream(os); + ImageIO.write(img.createDefaultRendering(), "png", encoder); + encoder.close(); + } + catch(IOException e) { + LoggingUtil.exception("Exception serializing image to png", e); + return null; + } + Element i = (Element) super.cloneNode(doc, eold); + i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", "")); + return i; + } + + /** + * Inline an external file (usually from temp). + * + * @param doc Document (element factory) + * @param urldata URL + * @param eold Existing node + * @return Replacement node, or {@code null} + */ + protected Node inlineExternal(Document doc, ParsedURL urldata, Node eold) { + File in = new File(urldata.getPath()); + if(!in.exists()) { + LoggingUtil.warning("Referencing non-existant file: " + urldata.toString()); + return null; + } + ByteArrayOutputStream os = new ByteArrayOutputStream(); + try { + os.write(SVGSyntax.DATA_PROTOCOL_PNG_PREFIX.getBytes()); + Base64EncoderStream encoder = new Base64EncoderStream(os); + FileInputStream instream = new FileInputStream(in); + byte[] buf = new byte[4096]; + while(true) { + int read = instream.read(buf, 0, buf.length); + if(read <= 0) { + break; + } + encoder.write(buf, 0, read); + } + instream.close(); + encoder.close(); + } + catch(IOException e) { + LoggingUtil.exception("Exception serializing image to png", e); + return null; + } + + Element i = (Element) super.cloneNode(doc, eold); + i.setAttributeNS(SVGConstants.XLINK_NAMESPACE_URI, SVGConstants.XLINK_HREF_ATTRIBUTE, os.toString().replaceAll("\\s*[\\r\\n]+\\s*", "")); + return i; + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java index 978aec29..42dab91b 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/DragableArea.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGSynchronizedCanvas.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGSynchronizedCanvas.java index a9e467db..7629ae1a 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGSynchronizedCanvas.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGSynchronizedCanvas.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGUpdateSynchronizer.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGUpdateSynchronizer.java index 0ecb6e0e..953c39da 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGUpdateSynchronizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/JSVGUpdateSynchronizer.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/LazyCanvasResizer.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/LazyCanvasResizer.java index d11e1b00..b0dbfd9c 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/LazyCanvasResizer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/LazyCanvasResizer.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeAppendChild.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeAppendChild.java index 69282a5a..380d2cbf 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeAppendChild.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeAppendChild.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplaceChild.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplaceChild.java index 0b5049cb..f0fb08c5 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplaceChild.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplaceChild.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplacer.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplacer.java index 51b1fec8..a82025df 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplacer.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/NodeReplacer.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/RemoveCSSClass.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/RemoveCSSClass.java index 9c16a2db..2f75d40e 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/RemoveCSSClass.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/RemoveCSSClass.java @@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.visualization.batikutil; This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - Copyright (C) 2011 + Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/ThumbnailRegistryEntry.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/ThumbnailRegistryEntry.java new file mode 100644 index 00000000..dd844165 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/ThumbnailRegistryEntry.java @@ -0,0 +1,249 @@ +package de.lmu.ifi.dbs.elki.visualization.batikutil; +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2012 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import gnu.trove.iterator.TIntObjectIterator; +import gnu.trove.map.TIntObjectMap; +import gnu.trove.map.hash.TIntObjectHashMap; + +import java.awt.image.RenderedImage; +import java.io.IOException; +import java.io.InputStream; +import java.lang.ref.SoftReference; +import java.util.Iterator; + +import org.apache.batik.ext.awt.image.GraphicsUtil; +import org.apache.batik.ext.awt.image.renderable.Filter; +import org.apache.batik.ext.awt.image.renderable.RedRable; +import org.apache.batik.ext.awt.image.spi.AbstractRegistryEntry; +import org.apache.batik.ext.awt.image.spi.ImageTagRegistry; +import org.apache.batik.ext.awt.image.spi.MagicNumberRegistryEntry; +import org.apache.batik.ext.awt.image.spi.URLRegistryEntry; +import org.apache.batik.svggen.ErrorConstants; +import org.apache.batik.util.ParsedURL; +import org.apache.batik.util.ParsedURLData; +import org.apache.batik.util.ParsedURLProtocolHandler; + +import de.lmu.ifi.dbs.elki.logging.Logging; + +/** + * Access images via an internal image registry. + * + * @author Erich Schubert + */ +public class ThumbnailRegistryEntry extends AbstractRegistryEntry implements URLRegistryEntry, ParsedURLProtocolHandler { + /** + * ELKI internal thumbnail protocol id. + */ + public static final String INTERNAL_PROTOCOL = "thumb"; + + /** + * ELKI internal thumbnail protocol prefix + */ + public static final String INTERNAL_PREFIX = INTERNAL_PROTOCOL + ":"; + + /** + * Mime type + */ + public static final String INTERNAL_MIME_TYPE = "internal/thumb"; + + /** + * The priority of this entry. + */ + public static final float PRIORITY = 1 * MagicNumberRegistryEntry.PRIORITY; + + /** + * The logger class. + */ + private static final Logging logger = Logging.getLogger(ThumbnailRegistryEntry.class); + + /** + * The image cache. + */ + private static final TIntObjectMap<SoftReference<RenderedImage>> images = new TIntObjectHashMap<SoftReference<RenderedImage>>(); + + /** + * Object counter + */ + private static int counter = 1; + + /** + * Constructor. + * + * Note: there will usually be two instances created. One for handling the + * image type, one for the URL handling. This is ok. + */ + public ThumbnailRegistryEntry() { + super("Internal", PRIORITY, new String[0], new String[] { INTERNAL_MIME_TYPE }); + if(logger.isDebuggingFiner()) { + logger.debugFiner("Registry initialized."); + } + } + + /** + * Put an image into the repository (note: the repository is only keeping a + * weak reference!) + * + * @param img Image to put + * @return Key + */ + public static int registerImage(RenderedImage img) { + synchronized(images) { + int key = counter; + counter++; + assert (images.get(key) == null); + images.put(key, new SoftReference<RenderedImage>(img)); + // Reorganize map, purge old entries + if(counter % 50 == 49) { + for(TIntObjectIterator<SoftReference<RenderedImage>> iter = images.iterator(); iter.hasNext();) { + iter.advance(); + if(iter.value() == null || iter.value().get() == null) { + iter.remove(); + } + } + } + if(logger.isDebuggingFiner()) { + logger.debugFiner("Registered image: " + key); + } + return key; + } + } + + @Override + public boolean isCompatibleURL(ParsedURL url) { + // logger.warning("isCompatible " + url.toString()); + return isCompatibleURLStatic(url); + } + + /** + * Test for a compatible URL. + * + * @param url URL + * @return Success code + */ + public static boolean isCompatibleURLStatic(ParsedURL url) { + return url.getProtocol().equals(INTERNAL_PROTOCOL); + } + + @Override + public Filter handleURL(ParsedURL url, boolean needRawData) { + Filter ret = handleURL(url); + if(ret != null) { + return ret; + } + // Image not found in registry. + return ImageTagRegistry.getBrokenLinkImage(ThumbnailRegistryEntry.this, ErrorConstants.ERR_IMAGE_DIR_DOES_NOT_EXIST, new Object[0]); + } + + /** + * Statically handle the URL access. + * + * @param url URL to access + * @return Image, or null + */ + public static Filter handleURL(ParsedURL url) { + if(logger.isDebuggingFiner()) { + logger.debugFiner("handleURL " + url.toString()); + } + if(!isCompatibleURLStatic(url)) { + return null; + } + int id; + try { + id = Integer.parseInt(url.getPath()); + } + catch(NumberFormatException e) { + return null; + } + SoftReference<RenderedImage> ref = images.get(id); + if(ref != null) { + RenderedImage ri = ref.get(); + if(ri == null) { + logger.warning("Referenced image has expired from the cache!"); + } + else { + return new RedRable(GraphicsUtil.wrap(ri)); + } + } + // Image not found in registry. + return null; + } + + /** + * URL representation for internal URLs. + * + * @author Erich Schubert + */ + class InternalParsedURLData extends ParsedURLData { + /** + * Constructor. + */ + public InternalParsedURLData(String id) { + super(); + this.protocol = INTERNAL_PROTOCOL; + this.contentType = INTERNAL_MIME_TYPE; + this.path = id; + } + + @Override + public String getContentType(String userAgent) { + return INTERNAL_MIME_TYPE; + } + + @Override + public boolean complete() { + return true; + } + + @SuppressWarnings("rawtypes") + @Override + public InputStream openStream(String userAgent, Iterator mimeTypes) throws IOException { + // Return null, since we don't want to use streams. + return null; + } + } + + @Override + public ParsedURLData parseURL(String urlStr) { + if(logger.isDebuggingFinest()) { + logger.debugFinest("parseURL: " + urlStr); + } + if(urlStr.startsWith(INTERNAL_PREFIX)) { + InternalParsedURLData ret = new InternalParsedURLData(urlStr.substring(INTERNAL_PREFIX.length())); + return ret; + } + return null; + } + + @Override + public ParsedURLData parseURL(ParsedURL basepurl, String urlStr) { + // Won't happen in a relative way anyway, and is not particularly + // supported (as the objects might be dropped from the cache) + return parseURL(urlStr); + } + + @Override + public String getProtocolHandled() { + return INTERNAL_PROTOCOL; + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/ThumbnailTranscoder.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/ThumbnailTranscoder.java new file mode 100644 index 00000000..0b2a2080 --- /dev/null +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/ThumbnailTranscoder.java @@ -0,0 +1,72 @@ +package de.lmu.ifi.dbs.elki.visualization.batikutil; + +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2012 + Ludwig-Maximilians-Universität München + Lehr- und Forschungseinheit für Datenbanksysteme + ELKI Development Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +import java.awt.image.BufferedImage; + +import org.apache.batik.transcoder.TranscoderException; +import org.apache.batik.transcoder.TranscoderOutput; +import org.apache.batik.transcoder.image.ImageTranscoder; + +/** + * Transcode images to in-memory thumbnails. + * + * @author Erich Schubert + */ +public class ThumbnailTranscoder extends ImageTranscoder { + /** + * Last image produced. + */ + private BufferedImage lastimg; + + /** + * Constructor. + */ + public ThumbnailTranscoder() { + super(); + hints.put(KEY_FORCE_TRANSPARENT_WHITE, Boolean.FALSE); + } + + @Override + public BufferedImage createImage(int width, int height) { + return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + } + + /** + * Output will be ignored! + */ + @Override + public void writeImage(BufferedImage img, TranscoderOutput output) throws TranscoderException { + lastimg = img; + } + + /** + * Get the latest image produced. + * + * @return the last image produced + */ + public BufferedImage getLastImage() { + return lastimg; + } +}
\ No newline at end of file diff --git a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/package-info.java b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/package-info.java index 80a68b29..333b8b0c 100644 --- a/src/de/lmu/ifi/dbs/elki/visualization/batikutil/package-info.java +++ b/src/de/lmu/ifi/dbs/elki/visualization/batikutil/package-info.java @@ -6,7 +6,7 @@ This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures -Copyright (C) 2011 +Copyright (C) 2012 Ludwig-Maximilians-Universität München Lehr- und Forschungseinheit für Datenbanksysteme ELKI Development Team |