Package com.badlogic.gdx.utils
Class Scaling
- java.lang.Object
-
- com.badlogic.gdx.utils.Scaling
-
public abstract class Scaling extends java.lang.ObjectVarious scaling types for fitting one rectangle into another.
-
-
Field Summary
Fields Modifier and Type Field Description static ScalingcontainScales the source to fit the target while keeping the same aspect ratio, but the source is not scaled at all if smaller in both directions.static ScalingfillScales the source to fill the target while keeping the same aspect ratio.static ScalingfillXScales the source to fill the target in the x direction while keeping the same aspect ratio.static ScalingfillYScales the source to fill the target in the y direction while keeping the same aspect ratio.static ScalingfitScales the source to fit the target while keeping the same aspect ratio.static ScalingnoneThe source is not scaled.static ScalingstretchScales the source to fill the target.static ScalingstretchXScales the source to fill the target in the x direction, without changing the y direction.static ScalingstretchYScales the source to fill the target in the y direction, without changing the x direction.protected static Vector2temp
-
Constructor Summary
Constructors Constructor Description Scaling()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract Vector2apply(float sourceWidth, float sourceHeight, float targetWidth, float targetHeight)Returns the size of the source scaled to the target.
-
-
-
Field Detail
-
temp
protected static final Vector2 temp
-
fit
public static final Scaling 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.
-
contain
public static final Scaling contain
Scales the source to fit the target while keeping the same aspect ratio, but the source is not scaled at all if smaller in both directions. This may cause the source to be smaller than the target in one or both directions.
-
fill
public static final Scaling 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
public static final Scaling 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
public static final Scaling 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
public static final Scaling stretch
Scales the source to fill the target. This may cause the source to not keep the same aspect ratio.
-
stretchX
public static final Scaling 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
public static final Scaling 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
public static final Scaling none
The source is not scaled.
-
-
Method Detail
-
apply
public abstract Vector2 apply(float sourceWidth, float sourceHeight, float targetWidth, float targetHeight)
Returns the size of the source scaled to the target. Note the same Vector2 instance is always returned and should never be cached.
-
-