- All Implemented Interfaces:
org.apache.batik.transcoder.Transcoder
public class SVGImageTranscoder
extends org.apache.batik.transcoder.image.ImageTranscoder
BufferedImage or Image.
Code inspired by https://gist.github.com/ComFreek/b0684ac324c815232556
Legal stuff
Copyright 2010-2020 Ekkart Kleinod ekleinod@edgesoft.de
This file is part of edgeutils.
edgeutils is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
edgeutils 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with edgeutils. If not, see http://www.gnu.org/licenses/.
- Since:
- 0.12.0
- Author:
- Ekkart Kleinod
-
Field Summary
Fields inherited from class org.apache.batik.transcoder.image.ImageTranscoder
KEY_BACKGROUND_COLOR, KEY_FORCE_TRANSPARENT_WHITEFields inherited from class org.apache.batik.transcoder.SVGAbstractTranscoder
DEFAULT_ALLOWED_SCRIPT_TYPES, DEFAULT_DEFAULT_FONT_FAMILY, KEY_ALLOWED_SCRIPT_TYPES, KEY_ALTERNATE_STYLESHEET, KEY_AOI, KEY_CONSTRAIN_SCRIPT_ORIGIN, KEY_DEFAULT_FONT_FAMILY, KEY_EXECUTE_ONLOAD, KEY_HEIGHT, KEY_LANGUAGE, KEY_MAX_HEIGHT, KEY_MAX_WIDTH, KEY_MEDIA, KEY_PIXEL_TO_MM, KEY_PIXEL_UNIT_TO_MILLIMETER, KEY_SNAPSHOT_TIME, KEY_USER_STYLESHEET_URI, KEY_WIDTH -
Constructor Summary
Constructors Constructor Description SVGImageTranscoder() -
Method Summary
Modifier and Type Method Description java.awt.image.BufferedImagecreateImage(int theWidth, int theHeight)static SVGImageTranscodercreateSVGImageTranscoder(int theWidth, int theHeight)Creates newSVGImageTranscoderwith given width and height.java.awt.image.BufferedImagegetBufferedImage()Returns buffered image.javafx.scene.image.ImagegetFXImage()Returns fx image.voidsetHeight(int theHeight)Sets image height.voidsetWidth(int theWidth)Sets image width.voidwriteImage(java.awt.image.BufferedImage img, org.apache.batik.transcoder.TranscoderOutput to)Methods inherited from class org.apache.batik.transcoder.TranscoderSupport
addTranscodingHint, getErrorHandler, getTranscodingHints, removeTranscodingHint, setErrorHandler, setTranscodingHints, setTranscodingHints
-
Constructor Details
-
SVGImageTranscoder
public SVGImageTranscoder()
-
-
Method Details
-
setWidth
public void setWidth(int theWidth)Sets image width.- Parameters:
theWidth- image width (-1 no width specified)
-
setHeight
public void setHeight(int theHeight)Sets image height.- Parameters:
theHeight- image height (-1 no height specified)
-
createSVGImageTranscoder
Creates newSVGImageTranscoderwith given width and height.- Parameters:
theWidth- image width (-1 no width specified)theHeight- image height (-1 no height specified)- Returns:
- new transcoder
-
createImage
public java.awt.image.BufferedImage createImage(int theWidth, int theHeight)- Specified by:
createImagein classorg.apache.batik.transcoder.image.ImageTranscoder
-
writeImage
public void writeImage(java.awt.image.BufferedImage img, org.apache.batik.transcoder.TranscoderOutput to) throws org.apache.batik.transcoder.TranscoderException- Specified by:
writeImagein classorg.apache.batik.transcoder.image.ImageTranscoder- Throws:
org.apache.batik.transcoder.TranscoderException
-
getBufferedImage
public java.awt.image.BufferedImage getBufferedImage()Returns buffered image.- Returns:
- buffered image
-
getFXImage
public javafx.scene.image.Image getFXImage()Returns fx image.- Returns:
- fx image
-