Package com.oorian.css
Enum Class ObjectFit
- All Implemented Interfaces:
Serializable,Comparable<ObjectFit>,Constable
CSS object-fit property values for replaced element sizing.
The object-fit property specifies how the contents of a replaced element (like img or video) should be fitted to the box established by its width and height.
Fit Values:
- fill: Stretches to fill box, may distort aspect ratio
- contain: Scales to fit box, maintains aspect ratio
- cover: Scales to cover box, maintains aspect ratio, may crop
- none: No resizing, may overflow or underflow
- scale-down: Behaves as none or contain, whichever is smaller
Usage:
image.setObjectFit(ObjectFit.COVER);
video.setObjectFit(ObjectFit.CONTAIN);
- Since:
- 2024
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionScales content to fit inside the box, maintains aspect ratio.Scales content to cover the box, maintains aspect ratio, may crop.Stretches content to fill the box, may distort aspect ratio (default).Inherits from parent element.Sets to default value.Content is not resized.Rolls back to the value defined by a previous cascade origin.Rolls back to the value defined in the previous cascade layer.Behaves as none or contain, whichever results in smaller concrete object size.Resets the property to its inherited value or initial value. -
Method Summary
Modifier and TypeMethodDescriptiongetValue()Returns the CSS value string.toString()Returns the CSS value string.static ObjectFitReturns the enum constant of this class with the specified name.static ObjectFit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
FILL
Stretches content to fill the box, may distort aspect ratio (default). -
CONTAIN
Scales content to fit inside the box, maintains aspect ratio. -
COVER
Scales content to cover the box, maintains aspect ratio, may crop. -
NONE
Content is not resized. -
SCALE_DOWN
Behaves as none or contain, whichever results in smaller concrete object size. -
INITIAL
Sets to default value. -
INHERIT
Inherits from parent element. -
UNSET
Resets the property to its inherited value or initial value. -
REVERT
Rolls back to the value defined by a previous cascade origin. -
REVERT_LAYER
Rolls back to the value defined in the previous cascade layer.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getValue
Returns the CSS value string.- Returns:
- the CSS value
-
toString
Returns the CSS value string.
-