public class Viewport extends Viewbox
dpi, hasWidthAndHeight, height, preserveAspectRatio, viewboxHeight, viewboxWidth, viewboxX, viewboxY, width| Constructor and Description |
|---|
Viewport()
Create a viewport without explicit width or height.
|
Viewport(double dpi)
Create a viewport without explicit width or height.
|
Viewport(double width,
double height)
Create a viewport with explicit width and height.
|
Viewport(double dpi,
double width,
double height)
Create a viewport with explicit width and height.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getBestHeight()
Return the height.
|
double |
getBestWidth()
Return the "best" width.
|
double |
getDefaultPosition(double defaultValue,
boolean isWidth)
Return a default position.
|
javafx.geometry.Rectangle2D |
getRectangle2D()
Return the Rectangle2D associated with the Viewport.
|
double |
getScale()
Return the scale.
|
double |
getX()
Return the x position.
|
double |
getY()
Return the y position.
|
boolean |
isNested()
Return true if the svg element on which the viexwpiort is defined is nested.
|
boolean |
isScaled()
Return true if lengths must be scaled.
|
boolean |
isScalingLineWidth()
Return true if line widths must be scaled.
|
double |
scaleLength(double length)
Scale a length value.
|
double |
scaleLineWidth(double width)
Scale a line width.
|
double |
scalePosition(double value,
boolean isWidth)
Scale a position value.
|
void |
scaleShape(javafx.scene.shape.Shape shape)
Scale a shape.
|
void |
setPosition(double x,
double y)
Set the viewport position.
|
void |
setScale(double scale,
boolean scaleLineWidth)
Set the scale value.
|
getDPI, getHeight, getViewboxHeight, getViewboxWidth, getViewboxX, getViewboxY, getWidth, hasWidthAndHeight, isPreservingAspectRatio, scaleNode, scaleValue, setPreserveAspectRatio, setViewboxpublic Viewport(double width,
double height)
width - the widthheight - the heightpublic Viewport(double dpi,
double width,
double height)
dpi - the dpiwidth - the widthheight - the heightpublic Viewport(double dpi)
dpi - the dpipublic Viewport()
public double getBestWidth()
public double getBestHeight()
public boolean isNested()
public double getX()
public double getY()
public void setPosition(double x,
double y)
x - the x positiony - the y positionpublic javafx.geometry.Rectangle2D getRectangle2D()
public void scaleShape(javafx.scene.shape.Shape shape)
shape - the shapepublic double getDefaultPosition(double defaultValue,
boolean isWidth)
defaultValue - the default position valueisWidth - true for a widthpublic double scalePosition(double value,
boolean isWidth)
value - the positionisWidth - true for a widgdth coordinatepublic double scaleLength(double length)
length - the lengthpublic double scaleLineWidth(double width)
width - the line width.public void setScale(double scale,
boolean scaleLineWidth)
scale - the scalescaleLineWidth - true if line widths must also be scaledpublic double getScale()
public boolean isScaled()
public boolean isScalingLineWidth()
Copyright © 2021, 2022, 2025, 2026 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence