-
- All Implemented Interfaces:
-
java.lang.Comparable
public class AspectRatio implements Comparable<AspectRatio>
A simple class representing an aspect ratio.
-
-
Field Summary
Fields Modifier and Type Field Description final static HashMap<String, AspectRatio>sCache
-
Method Summary
Modifier and Type Method Description static AspectRatioof(Size size)Creates an aspect ratio for the given size. static AspectRatioof(int x, int y)Creates an aspect ratio with the given values. static AspectRatioparse(String string)Parses an aspect ratio string, for example those previously obtainedwith toString. intgetX()intgetY()booleanmatches(Size size)booleanmatches(Size size, float tolerance)booleanequals(Object o)StringtoString()floattoFloat()inthashCode()intcompareTo(AspectRatio another)AspectRatioflip()Returns a flipped aspect ratio, which means inverting its dimensions. -
-
Method Detail
-
of
@NonNull() static AspectRatio of(Size size)
Creates an aspect ratio for the given size.
- Parameters:
size- the size
-
of
@NonNull() static AspectRatio of(int x, int y)
Creates an aspect ratio with the given values.
- Parameters:
x- the widthy- the height
-
parse
@NonNull() static AspectRatio parse(String string)
Parses an aspect ratio string, for example those previously obtainedwith toString.
- Parameters:
string- a string of the format x:y where x and y are integers
-
getX
int getX()
-
getY
int getY()
-
toFloat
float toFloat()
-
hashCode
int hashCode()
-
compareTo
int compareTo(AspectRatio another)
-
flip
@NonNull() AspectRatio flip()
Returns a flipped aspect ratio, which means inverting its dimensions.
-
-
-
-