Package org.csstudio.utility.batik
Class SVGHandler
java.lang.Object
org.csstudio.utility.batik.SVGHandler
SVGDocument handler. Handles render and animation of SVG files.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classTo hide the listener methods. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatThe amount of animation limiting.protected intThe animation limiting mode.protected org.apache.batik.bridge.BridgeContextThe current bridge context.protected org.apache.batik.bridge.GVTBuilderprotected AnimatedSVGCacheprotected org.apache.batik.gvt.GraphicsNodeprotected SVGHandlerListenerprotected booleanWhether the current document has dynamic features.protected SVGHandler.ListenerThe listener.protected org.apache.batik.bridge.DocumentLoaderThe concrete bridge document loader.protected Dimension2Dprotected org.w3c.dom.svg.SVGDocumentprotected org.apache.batik.gvt.renderer.ImageRendererThe current renderer.protected org.apache.batik.gvt.renderer.ImageRendererFactoryThe renderer factory.protected SVGAnimationEngineprotected org.w3c.dom.svg.SVGDocumentThe current SVG document.protected org.apache.batik.anim.timing.TimedDocumentRootprotected UpdateManagerThe update manager.protected org.apache.batik.bridge.UserAgentThe user agent. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToBuffer(Image image) protected org.apache.batik.bridge.BridgeContextcreateBridgeContext(org.apache.batik.anim.dom.SVGOMDocument doc) Creates a new bridge context.protected org.apache.batik.gvt.renderer.ImageRendererCreates a new renderer.protected org.apache.batik.bridge.UserAgentCreates a new user agent.voiddispose()protected voiddoRender()protected org.apache.batik.gvt.CanvasGraphicsNodegetCanvasGraphicsNode(org.apache.batik.gvt.GraphicsNode gn) org.w3c.dom.svg.SVGDocumentprotected voidbooleanprotected voidnotifyNewImage(Image newImage) voidvoidprotected voidrender()protected voidvoidResumes the processing of the current document.voidsetAlignedToNearestSecond(boolean alignedToNearestSecond) voidsetAnimationLimitingCPU(float pc) Sets the animation limiting mode to a percentage of CPU.voidsetAnimationLimitingFPS(float fps) Sets the animation limiting mode to a number of frames per second.voidSets the animation limiting mode to "none".protected voidSets the animation limiting mode on the current bridge context.voidsetCanvasSize(int width, int height) voidsetColorToApply(Color newColor) voidsetColorToChange(Color newColor) voidsetRenderingHint(Object key, Object value) voidsetRenderListener(SVGHandlerListener renderListener) voidsetTransformMatrix(double[][] newMatrix) voidStart the processing of the current document.voidSuspend the processing of the current document.
-
Field Details
-
handlerListener
-
listener
The listener. -
rendererFactory
protected org.apache.batik.gvt.renderer.ImageRendererFactory rendererFactoryThe renderer factory. -
renderer
protected org.apache.batik.gvt.renderer.ImageRenderer rendererThe current renderer. -
userAgent
protected org.apache.batik.bridge.UserAgent userAgentThe user agent. -
bridgeContext
protected org.apache.batik.bridge.BridgeContext bridgeContextThe current bridge context. -
loader
protected org.apache.batik.bridge.DocumentLoader loaderThe concrete bridge document loader. -
gvtRoot
protected org.apache.batik.gvt.GraphicsNode gvtRoot -
updateManager
The update manager. -
timedDocumentRoot
protected org.apache.batik.anim.timing.TimedDocumentRoot timedDocumentRoot -
svgAnimationEngine
-
cache
-
svgDocument
protected org.w3c.dom.svg.SVGDocument svgDocumentThe current SVG document. -
originalSVGDocument
protected org.w3c.dom.svg.SVGDocument originalSVGDocument -
originalDimension
-
isDynamicDocument
protected boolean isDynamicDocumentWhether the current document has dynamic features. -
animationLimitingMode
protected int animationLimitingModeThe animation limiting mode. -
animationLimitingAmount
protected float animationLimitingAmountThe amount of animation limiting. -
builder
protected org.apache.batik.bridge.GVTBuilder builder
-
-
Constructor Details
-
SVGHandler
-
-
Method Details
-
dispose
public void dispose() -
createUserAgent
protected org.apache.batik.bridge.UserAgent createUserAgent()Creates a new user agent. -
createBridgeContext
protected org.apache.batik.bridge.BridgeContext createBridgeContext(org.apache.batik.anim.dom.SVGOMDocument doc) Creates a new bridge context. -
createImageRenderer
protected org.apache.batik.gvt.renderer.ImageRenderer createImageRenderer()Creates a new renderer. -
handleException
-
getOriginalDocument
public org.w3c.dom.svg.SVGDocument getOriginalDocument() -
setRenderListener
-
setRenderingHint
-
removeRenderingHint
-
setCanvasSize
public void setCanvasSize(int width, int height) -
setColorToApply
-
setColorToChange
-
setTransformMatrix
public void setTransformMatrix(double[][] newMatrix) -
refreshContent
public void refreshContent() -
isDynamicDocument
public boolean isDynamicDocument() -
getDocumentSize
- Returns:
- document size after applying matrix.
-
setAlignedToNearestSecond
public void setAlignedToNearestSecond(boolean alignedToNearestSecond) -
resumeProcessing
public void resumeProcessing()Resumes the processing of the current document. -
suspendProcessing
public void suspendProcessing()Suspend the processing of the current document. -
startProcessing
public void startProcessing()Start the processing of the current document. -
setAnimationLimitingNone
public void setAnimationLimitingNone()Sets the animation limiting mode to "none". -
setAnimationLimitingCPU
public void setAnimationLimitingCPU(float pc) Sets the animation limiting mode to a percentage of CPU.- Parameters:
pc- the maximum percentage of CPU to use (0 < pc ≤ 1)
-
setAnimationLimitingFPS
public void setAnimationLimitingFPS(float fps) Sets the animation limiting mode to a number of frames per second.- Parameters:
fps- the maximum number of frames per second (fps > 0)
-
setBridgeContextAnimationLimitingMode
protected void setBridgeContextAnimationLimitingMode()Sets the animation limiting mode on the current bridge context. -
getOffScreen
- Returns:
- SVG static image.
-
render
protected void render() -
doRender
protected void doRender() -
getCanvasGraphicsNode
protected org.apache.batik.gvt.CanvasGraphicsNode getCanvasGraphicsNode(org.apache.batik.gvt.GraphicsNode gn) -
resetCache
protected void resetCache() -
addToBuffer
-
notifyNewImage
-