-
- All Implemented Interfaces:
-
java.lang.Comparable
public class AspectRatio implements Comparable<AspectRatio>
A simple class representing an aspect ratio.
-
-
Method Summary
Modifier and Type Method Description static AspectRatioof(@NonNull() 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(@NonNull() String string)Parses an aspect ratio string, for example those previously obtainedwith toString. intgetX()intgetY()booleanmatches(@NonNull() Size size)booleanmatches(@NonNull() Size size, float tolerance)booleanequals(Object o)StringtoString()floattoFloat()inthashCode()intcompareTo(@NonNull() AspectRatio another)AspectRatioflip()Returns a flipped aspect ratio, which means inverting its dimensions. -
-
Method Detail
-
of
@NonNull() static AspectRatio of(@NonNull() 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(@NonNull() 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(@NonNull() AspectRatio another)
-
flip
@NonNull() AspectRatio flip()
Returns a flipped aspect ratio, which means inverting its dimensions.
-
-
-
-