Java Reference
In-Depth Information
If you want to only display part of the image, you can create a viewport . A
viewport is a rectangular area within the image's coordinate system prior to any
transformations like scaling. You specify the viewport by using the javafx
.geometry.Rectangle2D class. This is illustrated in Listing 8.4.
Listing 8.4
Viewport
imageView = ImageView {
fitWidth: bind scene.width
fitHeight: bind scene.height - 25
preserveRatio: true
smooth: true
image: image = bind image
viewport: Rectangle2D {
minX: 200
minY: 200
width: 800
height: 500
}
};
This produces a view of only a portion of the original image, as depicted in Fig-
ure 8.3.
Figure 8.3
NASA Image Display Using Viewport
 
Search WWH ::




Custom Search