-
public class ImageVisual extends SingleLayerVisual
Visual showing an Image.
The image gets stretched to the size of the component that this visual is embedded in.
A sub-image can be loaded by passing offsetX/offsetY for the TOP_LEFT corner and width/height for the sub-image size. If width or height is passed as -1, the remaining image from offsetX/offsetY will be loaded.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
ImageVisual.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Property<BufferedImage>
imageProperty
private BufferedImage
image
private final LimitedDoubleProperty
transparencyProperty
private Double
transparency
-
Constructor Summary
Constructors Constructor Description ImageVisual(String path, Integer width, Integer height, Integer offsetX, Integer offsetY)
Loads an ImageVisual from a path. ImageVisual(File file, Integer width, Integer height, Integer offsetX, Integer offsetY)
Loads an ImageVisual from a file. ImageVisual(BufferedImage image, Integer width, Integer height, Integer offsetX, Integer offsetY)
Loads an ImageVisual from a BufferedImage.
-
Method Summary
Modifier and Type Method Description final Property<BufferedImage>
getImageProperty()
Property for the displayed image. final BufferedImage
getImage()
final Unit
setImage(BufferedImage image)
final LimitedDoubleProperty
getTransparencyProperty()
Property for the transparency / alpha channel for this Visual. final Double
getTransparency()
final Unit
setTransparency(Double transparency)
ImageVisual
copy()
Copies this ImageVisual to a new object. -
-
Constructor Detail
-
ImageVisual
ImageVisual(String path, Integer width, Integer height, Integer offsetX, Integer offsetY)
Loads an ImageVisual from a path.- Parameters:
path
- Path to image file to show.width
- Width of sub-image.height
- Height of sub-image.offsetX
- Left bound of sub-image.offsetY
- Top bound of sub-image.
-
ImageVisual
ImageVisual(File file, Integer width, Integer height, Integer offsetX, Integer offsetY)
Loads an ImageVisual from a file.- Parameters:
file
- Image file to show.width
- Width of sub-image.height
- Height of sub-image.offsetX
- Left bound of sub-image.offsetY
- Top bound of sub-image.
-
ImageVisual
ImageVisual(BufferedImage image, Integer width, Integer height, Integer offsetX, Integer offsetY)
Loads an ImageVisual from a BufferedImage.- Parameters:
image
- Image to show.width
- Width of sub-image.height
- Height of sub-image.offsetX
- Left bound of sub-image.offsetY
- Top bound of sub-image.
-
-
Method Detail
-
getImageProperty
final Property<BufferedImage> getImageProperty()
-
getImage
final BufferedImage getImage()
-
setImage
final Unit setImage(BufferedImage image)
-
getTransparencyProperty
final LimitedDoubleProperty getTransparencyProperty()
Property for the transparency / alpha channel for this Visual.
Must be set between 0 (full transparent) and 1 (non-transparent / solid). Default: 1.
-
getTransparency
final Double getTransparency()
-
setTransparency
final Unit setTransparency(Double transparency)
-
copy
ImageVisual copy()
Copies this ImageVisual to a new object.
-
-
-
-