public abstract class SVGAbstractTranscoder extends XMLAbstractTranscoder
Modifier and Type | Class and Description |
---|---|
protected class |
SVGAbstractTranscoder.SVGAbstractTranscoderUserAgent
A user agent implementation for PrintTranscoder.
|
Modifier and Type | Field and Description |
---|---|
protected GVTBuilder |
builder
Current gvt builder
|
protected BridgeContext |
ctx
Current bridge context
|
protected java.awt.geom.Rectangle2D |
curAOI
Current area of interest.
|
protected java.awt.geom.AffineTransform |
curTxf
Transform needed to render the current area of interest
|
static java.lang.String |
DEFAULT_ALLOWED_SCRIPT_TYPES
Default value for the KEY_ALLOWED_SCRIPT_TYPES key
|
static java.lang.String |
DEFAULT_DEFAULT_FONT_FAMILY
Value used as a default for the default font-family hint
|
protected float |
height
Image's width and height (init to 400x400).
|
static TranscodingHints.Key |
KEY_ALLOWED_SCRIPT_TYPES
The set of supported script languages (i.e., the set of possible
values for the <script> tag's type attribute).
|
static TranscodingHints.Key |
KEY_ALTERNATE_STYLESHEET
The alternate stylesheet key.
|
static TranscodingHints.Key |
KEY_AOI
The area of interest key.
|
static TranscodingHints.Key |
KEY_CONSTRAIN_SCRIPT_ORIGIN
Controls whether or not scripts can only be loaded from the
same location as the document which references them.
|
static TranscodingHints.Key |
KEY_DEFAULT_FONT_FAMILY
The default font-family key.
|
static TranscodingHints.Key |
KEY_EXECUTE_ONLOAD
The 'onload' execution key.
|
static TranscodingHints.Key |
KEY_HEIGHT
The image height key.
|
static TranscodingHints.Key |
KEY_LANGUAGE
The language key.
|
static TranscodingHints.Key |
KEY_MAX_HEIGHT
The maximux height of the image key.
|
static TranscodingHints.Key |
KEY_MAX_WIDTH
The maximum width of the image key.
|
static TranscodingHints.Key |
KEY_MEDIA
The media key.
|
static TranscodingHints.Key |
KEY_PIXEL_TO_MM
Deprecated.
As of Batik Version 1.5b3
|
static TranscodingHints.Key |
KEY_PIXEL_UNIT_TO_MILLIMETER
The number of millimeters in each pixel key.
|
static TranscodingHints.Key |
KEY_SNAPSHOT_TIME
The snapshot time key.
|
static TranscodingHints.Key |
KEY_USER_STYLESHEET_URI
The user stylesheet URI key.
|
static TranscodingHints.Key |
KEY_WIDTH
The image width key.
|
protected GraphicsNode |
root
Current GVT Tree, i.e., the GVT tree representing the page
being printed currently.
|
protected UserAgent |
userAgent
The user agent dedicated to an SVG Transcoder.
|
protected float |
width
Image's width and height (init to 400x400).
|
KEY_DOCUMENT_ELEMENT, KEY_DOCUMENT_ELEMENT_NAMESPACE_URI, KEY_DOM_IMPLEMENTATION, KEY_XML_PARSER_CLASSNAME, KEY_XML_PARSER_VALIDATING
handler, hints
Modifier | Constructor and Description |
---|---|
protected |
SVGAbstractTranscoder() |
Modifier and Type | Method and Description |
---|---|
protected BridgeContext |
createBridgeContext()
Creates the default SVG 1.0/1.1 BridgeContext.
|
protected BridgeContext |
createBridgeContext(java.lang.String svgVersion)
Creates the BridgeContext.
|
protected BridgeContext |
createBridgeContext(SVGOMDocument doc)
Factory method for constructing an configuring a
BridgeContext so subclasses can insert new/modified
bridges in the context.
|
protected DocumentFactory |
createDocumentFactory(org.w3c.dom.DOMImplementation domImpl,
java.lang.String parserClassname)
Creates a DocumentFactory that is used to create an SVG DOM
tree.
|
protected UserAgent |
createUserAgent() |
protected CanvasGraphicsNode |
getCanvasGraphicsNode(GraphicsNode gn) |
protected void |
setImageSize(float docWidth,
float docHeight)
Sets document size according to the hints.
|
protected void |
transcode(org.w3c.dom.Document document,
java.lang.String uri,
TranscoderOutput output)
Transcodes the specified Document as an image in the specified output.
|
void |
transcode(TranscoderInput input,
TranscoderOutput output)
Transcodes the specified XML input in the specified output.
|
addTranscodingHint, getErrorHandler, getTranscodingHints, removeTranscodingHint, setErrorHandler, setTranscodingHints, setTranscodingHints
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTranscodingHint, getErrorHandler, getTranscodingHints, removeTranscodingHint, setErrorHandler, setTranscodingHints, setTranscodingHints
public static final java.lang.String DEFAULT_DEFAULT_FONT_FAMILY
protected java.awt.geom.Rectangle2D curAOI
protected java.awt.geom.AffineTransform curTxf
protected GraphicsNode root
protected BridgeContext ctx
protected GVTBuilder builder
protected float width
protected float height
protected UserAgent userAgent
public static final TranscodingHints.Key KEY_WIDTH
Key: |
KEY_WIDTH |
---|---|
Value: |
Float |
Default: |
The width of the top most svg element |
Required: |
No |
Description: |
Specify the width of the image to create. |
public static final TranscodingHints.Key KEY_HEIGHT
Key: |
KEY_HEIGHT |
---|---|
Value: |
Float |
Default: |
The height of the top most svg element |
Required: |
No |
Description: |
Specify the height of the image to create. |
public static final TranscodingHints.Key KEY_MAX_WIDTH
Key: |
KEY_MAX_WIDTH |
---|---|
Value: |
Float |
Default: |
The width of the top most svg element |
Required: |
No |
Description: |
Specify the maximum width of the image to create. The value will set the maximum width of the image even when bigger width is specified in a document or set with KEY_WIDTH. |
public static final TranscodingHints.Key KEY_MAX_HEIGHT
Key: |
KEY_MAX_HEIGHT |
---|---|
Value: |
Float |
Default: |
The height of the top most svg element |
Required: |
No |
Description: |
Specify the maximum height of the image to create. The value will set the maximum height of the image even when bigger height is specified in a document or set with KEY_HEIGHT. |
public static final TranscodingHints.Key KEY_AOI
Key: |
KEY_AOI |
---|---|
Value: |
Rectangle2D |
Default: |
The document's size |
Required: |
No |
Description: |
Specify the area of interest to render. The rectangle coordinates must be specified in pixels and in the document coordinates system. |
public static final TranscodingHints.Key KEY_LANGUAGE
Key: |
KEY_LANGUAGE |
---|---|
Value: |
String |
Default: |
"en" |
Required: |
No |
Description: |
Specify the preferred language of the document. |
public static final TranscodingHints.Key KEY_MEDIA
Key: |
KEY_MEDIA |
---|---|
Value: |
String |
Default: |
"screen" |
Required: |
No |
Description: |
Specify the media to use with CSS. |
public static final TranscodingHints.Key KEY_DEFAULT_FONT_FAMILY
Key: |
KEY_DEFAULT_FONT_FAMILY |
---|---|
Value: |
String |
Default: |
"Arial, Helvetica, sans-serif" |
Required: |
No |
Description: |
Controls the default value used by the CSS engine for the font-family property when that property is unspecified.Specify the media to use with CSS. |
public static final TranscodingHints.Key KEY_ALTERNATE_STYLESHEET
Key: |
KEY_ALTERNATE_STYLESHEET |
---|---|
Value: |
String |
Default: |
null |
Required: |
No |
Description: |
Specify the alternate style sheet title. |
public static final TranscodingHints.Key KEY_USER_STYLESHEET_URI
Key: |
KEY_USER_STYLESHEET_URI |
---|---|
Value: |
String |
Default: |
null |
Required: |
No |
Description: |
Specify the user style sheet. |
public static final TranscodingHints.Key KEY_PIXEL_UNIT_TO_MILLIMETER
Key: |
KEY_PIXEL_UNIT_TO_MILLIMETER |
---|---|
Value: |
Float |
Default: |
0.264583 |
Required: |
No |
Description: |
Specify the size of a px CSS unit in millimeters. |
public static final TranscodingHints.Key KEY_PIXEL_TO_MM
public static final TranscodingHints.Key KEY_EXECUTE_ONLOAD
Key: |
KEY_EXECUTE_ONLOAD |
---|---|
Value: |
Boolean |
Default: |
false |
Required: |
No |
Description: |
Specify if scripts added on the 'onload' event attribute must be invoked. |
public static final TranscodingHints.Key KEY_SNAPSHOT_TIME
Key: |
KEY_SNAPSHOT_TIME |
---|---|
Value: |
Float |
Default: |
0 |
Required: |
No |
Description: |
Specifies the document time to seek to before
rasterization. Only applies if KEY_EXECUTE_ONLOAD is
set to true . |
public static final TranscodingHints.Key KEY_ALLOWED_SCRIPT_TYPES
Key: |
KEY_ALLOWED_SCRIPT_TYPES |
---|---|
Value: |
String (Comma separated values) |
Default: |
text/ecmascript, application/java-archive |
Required: |
No |
Description: |
Specifies the allowed values for the type attribute in the <script> element. This is a comma separated list. The special value '*' means that all script types are allowed. |
public static final java.lang.String DEFAULT_ALLOWED_SCRIPT_TYPES
public static final TranscodingHints.Key KEY_CONSTRAIN_SCRIPT_ORIGIN
Key: |
KEY_CONSTRAIN_SCRIPT_ORIGIN |
---|---|
Value: |
boolean |
Default: |
true |
Required: |
No |
Description: |
When set to true, script elements referencing files from a different origin (server) than the document containing the script element will not be loaded. When set to true, script elements may reference script files from any origin. |
protected UserAgent createUserAgent()
protected DocumentFactory createDocumentFactory(org.w3c.dom.DOMImplementation domImpl, java.lang.String parserClassname)
createDocumentFactory
in class XMLAbstractTranscoder
domImpl
- the DOM Implementation (not used)parserClassname
- the XML parser classnamepublic void transcode(TranscoderInput input, TranscoderOutput output) throws TranscoderException
XMLAbstractTranscoder
transcode
in interface Transcoder
transcode
in class XMLAbstractTranscoder
input
- the XML input to transcodeoutput
- the ouput where to transcodeTranscoderException
- if an error occured while transcodingprotected void transcode(org.w3c.dom.Document document, java.lang.String uri, TranscoderOutput output) throws TranscoderException
transcode
in class XMLAbstractTranscoder
document
- the document to transcodeuri
- the uri of the document or null if anyoutput
- the ouput where to transcodeTranscoderException
- if an error occured while transcodingprotected CanvasGraphicsNode getCanvasGraphicsNode(GraphicsNode gn)
protected BridgeContext createBridgeContext(SVGOMDocument doc)
doc
- the SVG document to create the BridgeContext forprotected BridgeContext createBridgeContext()
createBridgeContext(String)
instead.createBridgeContext(String)
protected BridgeContext createBridgeContext(java.lang.String svgVersion)
svgVersion
- the SVG version in use (ex. "1.0", "1.x" or "1.2")protected void setImageSize(float docWidth, float docHeight)
docWidth
- Width of the document.docHeight
- Height of the document.Copyright ? 2009 Apache Software Foundation. All Rights Reserved.