APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.utils

public abstract Class Scaling

extends Object
Class Inheritance
Imports
com.badlogic.gdx.math.Vector2

Various scaling types for fitting one rectangle into another.
Author
Nathan Sweet

Field Summary

Modifier and TypeField and Description
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.

public static final Scaling
fill

Scales the source to fill the target while keeping the same aspect ratio.

public static final Scaling
fillX

Scales the source to fill the target in the x direction while keeping the same aspect ratio.

public static final Scaling
fillY

Scales the source to fill the target in the y direction while keeping the same aspect ratio.

public static final Scaling
fit

Scales the source to fit the target while keeping the same aspect ratio.

public static final Scaling
none

The source is not scaled.

public static final Scaling
stretch

Scales the source to fill the target.

public static final Scaling
stretchX

Scales the source to fill the target in the x direction, without changing the y direction.

public static final Scaling
stretchY

Scales the source to fill the target in the y direction, without changing the x direction.

protected static final Vector2

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract Vector2
apply(float sourceWidth, float sourceHeight, float targetWidth, float targetHeight)

Returns the size of the source scaled to the target.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

containback to summary
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.

fillback to summary
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.

fillXback to summary
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.

fillYback to summary
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.

fitback to summary
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.

noneback to summary
public static final Scaling none

The source is not scaled.

stretchback to summary
public static final Scaling stretch

Scales the source to fill the target. This may cause the source to not keep the same aspect ratio.

stretchXback to summary
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.

stretchYback to summary
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.

tempback to summary
protected static final Vector2 temp

Constructor Detail

Scalingback to summary
public Scaling()

Method Detail

applyback to summary
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.