public class SVGImage
extends javafx.scene.Group
Constructor and Description |
---|
SVGImage()
Constructor.
|
SVGImage(SVGContent content)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
SVGImageRegion |
createRegion()
Create a region containing this image.
|
static javafx.scene.SnapshotParameters |
getDefaultSnapshotParameters()
Return the default SnapshotParameters used when creating a snapshot.
|
double |
getHeight()
Return the height of the image.
|
javafx.scene.Node |
getNode(java.lang.String id)
Return the Node indicated by id.
|
double |
getScaledHeight()
Return the height of the image, taking into account the scaling of the svg image.
|
double |
getScaledWidth()
Return the width of the image, taking into account the scaling of the svg image.
|
SVGContent |
getSVGContent()
Return the SVG content origin.
|
Viewport |
getViewport()
Return the viewport of the SVG content.
|
double |
getWidth()
Return the width of the image.
|
boolean |
hasNode(java.lang.String id)
Return true if there is a Node indicated by an id.
|
void |
playAnimations()
Play the animations.
|
SVGImage |
scale(double scale)
Scale the image.
|
SVGImage |
scale(double scale,
boolean createNew)
Scale the image.
|
SVGImage |
scaleTo(double width)
Scale the image to a specified width.
|
SVGImage |
scaleTo(double width,
boolean createNew)
Scale the image to a specified width.
|
static void |
setDefaultSnapshotParameters(javafx.scene.SnapshotParameters params)
Set the default SnapshotParameters to use when creating a snapshot.
|
void |
setViewport(Viewport viewport)
Set the viewport of the SVG content.
|
boolean |
snapshot(javafx.scene.SnapshotParameters params,
java.lang.String format,
java.io.File file)
Saves a snapshot of the image.
|
boolean |
snapshot(java.lang.String format,
java.io.File file)
Saves a snapshot of the image.
|
void |
stopAnimations()
Stop the animations.
|
javafx.scene.image.Image |
toImage()
Convert the Node tree to an image, without applying a scale.
|
javafx.scene.image.Image |
toImage(double width)
Convert the Node tree to an image, specifying the resulting width and preserving the image ratio.
|
javafx.scene.image.Image |
toImage(short quality,
double width)
Convert the Node tree to an image, specifying the resulting width and preserving the image ratio.
|
javafx.scene.image.Image |
toImage(javafx.scene.SnapshotParameters params)
Convert the Node tree to an image.
|
javafx.scene.image.Image |
toImageScaled(double scale)
Convert the Node tree to an image.
|
javafx.scene.image.Image |
toImageScaled(double scaleX,
double scaleY)
Convert the Node tree to a scaled image.
|
javafx.scene.image.Image |
toImageScaled(short quality,
double scaleX,
double scaleY)
Convert the Node tree to a scaled image.
|
autoSizeChildrenProperty, getChildren, impl_computeLayoutBounds, isAutoSizeChildren, layoutChildren, minHeight, minWidth, prefHeight, prefWidth, setAutoSizeChildren
computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, getBaselineOffset, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_computeContains, impl_computeGeomBounds, impl_createPeer, impl_getAllParentStylesheets, impl_pickNodeLocal, impl_processCSS, impl_processMXNode, impl_traversalEngineProperty, impl_updatePeer, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBounds
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClassCssMetaData, getClip, getContentBias, getCssMetaData, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_cssGetFocusTraversableInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_notifyLayoutBoundsChanged, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isResizable, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, maxHeight, maxWidth, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resize, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visibleProperty
public SVGImage()
public SVGImage(SVGContent content)
content
- the SVG contentpublic void setViewport(Viewport viewport)
viewport
- the viewportpublic Viewport getViewport()
public SVGImageRegion createRegion()
public SVGContent getSVGContent()
public static void setDefaultSnapshotParameters(javafx.scene.SnapshotParameters params)
params
- the default SnapshotParameterspublic static javafx.scene.SnapshotParameters getDefaultSnapshotParameters()
public boolean hasNode(java.lang.String id)
id
- the name of the Nodepublic javafx.scene.Node getNode(java.lang.String id)
id
- the name of the Nodepublic void playAnimations()
public void stopAnimations()
public double getWidth()
public double getScaledWidth()
public double getHeight()
public double getScaledHeight()
public javafx.scene.image.Image toImageScaled(double scale)
scale
- the scalepublic javafx.scene.image.Image toImageScaled(short quality, double scaleX, double scaleY)
quality
- the scaling qualityscaleX
- the X scalescaleY
- the Y scaleScaleQuality
public javafx.scene.image.Image toImageScaled(double scaleX, double scaleY)
scaleX
- the X scalescaleY
- the Y scalepublic javafx.scene.image.Image toImage(short quality, double width)
quality
- the scaling qualitywidth
- the resulting widthScaleQuality
public javafx.scene.image.Image toImage(double width)
width
- the resulting widthpublic javafx.scene.image.Image toImage()
public javafx.scene.image.Image toImage(javafx.scene.SnapshotParameters params)
params
- the parameterspublic SVGImage scale(double scale)
scale
- the scale factorpublic SVGImage scale(double scale, boolean createNew)
createNew
is true
, then return the initial SVGImage.scale
- the scale factorcreateNew
- true to create a new imagepublic SVGImage scaleTo(double width)
width
- the width of the scaled imagepublic SVGImage scaleTo(double width, boolean createNew)
createNew
is true
, then return the initial
SVGImage.width
- the width of the scaled imagecreateNew
- true to creata a new imagepublic boolean snapshot(javafx.scene.SnapshotParameters params, java.lang.String format, java.io.File file) throws SVGLibraryException
SVGLibraryException
if the snapshot
generation generated an exception and GlobalConfig.getExceptionsHandling()
is set to
ExceptionsHandling.RETROW_EXCEPTION
. It means that by default the method will simply return false if it
could not save the snapshot.
Reasons for the save to not being able to generate the snapshot are the directory being read-only, or swing not
available.params
- the parametersformat
- the formatfile
- the fileSVGLibraryException
public boolean snapshot(java.lang.String format, java.io.File file) throws SVGLibraryException
SVGLibraryException
if the snapshot
generation generated an exception and GlobalConfig.getExceptionsHandling()
is set to
ExceptionsHandling.RETROW_EXCEPTION
. It means that by default the method will simply return false if it
could not save the snapshot.
Reasons for the save to not being able to generate the snapshot are the directory being read-only, or swing not
available.format
- the formatfile
- the fileSVGLibraryException
Copyright © 2021, 2022, 2025 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence