Class BackgroundSize

java.lang.Object
javafx.scene.layout.BackgroundSize

public final class BackgroundSize extends Object
Defines the size of the area that a BackgroundImage should fill relative to the Region it is styling. There are several properties whose values take precedence over the others. In particular there are 4 key properties, width, height, contain, and cover. Both width and height are independent of each other, however both interact with contain and cover.

From the CSS Specification, cover is defined to:

Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.
contain is defined to:
Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.
And width and height both specify (in absolute values or percentages) the size to use. These two properties only apply if both cover and contain are false. If both cover and contain are true, then cover will be used.

The width and height may also be set to AUTO, indicating that the area should be sized so as to use the image's intrinsic size, or if it cannot be determined, 100%.

Since:
JavaFX 8.0