Package arc.util
Enum Class Scaling
- All Implemented Interfaces:
Serializable
,Comparable<Scaling>
,Constable
Various scaling types for fitting one rectangle into another.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionScales the source to fit the target if it is larger, otherwise does not scale.Scales the source to fill the target while keeping the same aspect ratio.Scales the source to fill the target in the x direction while keeping the same aspect ratio.Scales the source to fill the target in the y direction while keeping the same aspect ratio.Scales the source to fit the target while keeping the same aspect ratio.The source is not scaled.Scales the source to fill the target.Scales the source to fill the target in the x direction, without changing the y direction.Scales the source to fill the target in the y direction, without changing the x direction. -
Method Summary
Modifier and TypeMethodDescriptionapply
(float sourceWidth, float sourceHeight, float targetWidth, float targetHeight) Returns the size of the source scaled to the target.static Scaling
Returns the enum constant of this class with the specified name.static Scaling[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
fit
Scales the source to fit the target while keeping the same aspect ratio. This may cause the source to be smaller than the target in one direction. -
bounded
Scales the source to fit the target if it is larger, otherwise does not scale. -
fill
Scales the source to fill the target while keeping the same aspect ratio. This may cause the source to be larger than the target in one direction. -
fillX
Scales the source to fill the target in the x direction while keeping the same aspect ratio. This may cause the source to be smaller or larger than the target in the y direction. -
fillY
Scales the source to fill the target in the y direction while keeping the same aspect ratio. This may cause the source to be smaller or larger than the target in the x direction. -
stretch
Scales the source to fill the target. This may cause the source to not keep the same aspect ratio. -
stretchX
Scales the source to fill the target in the x direction, without changing the y direction. This may cause the source to not keep the same aspect ratio. -
stretchY
Scales the source to fill the target in the y direction, without changing the x direction. This may cause the source to not keep the same aspect ratio. -
none
The source is not scaled.
-
-
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
-
apply
Returns the size of the source scaled to the target. Note the same Vec2 instance is always returned and should never be cached.
-