Record Class Size
java.lang.Object
java.lang.Record
is.galia.image.Size
- Record Components:
width
- Width in pixels.height
- Height in pixels.
Two-dimensional area, typically an image area. Values are stored as doubles.
Zero-dimensions are allowed, but not negative ones.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
area()
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.double
height()
Returns the value of theheight
record component.int
intArea()
int
int
intWidth()
inverted()
boolean
isEmpty()
static boolean
long
longArea()
long
long
static Size
ofScaledArea
(Size size, long scaledArea) scaled
(double amount) Rescales both dimensions by the given amount.toString()
Returns a string representation of this record class.double
width()
Returns the value of thewidth
record component.
-
Constructor Details
-
Size
public Size(double width, double height) Floating-point constructor. -
Size
public Size(long width, long height) Integer constructor. The arguments will be converted to doubles for storage. -
Size
Copy constructor.
-
-
Method Details
-
isPyramid
-
ofScaledArea
-
area
public double area() -
width
-
height
-
intArea
public int intArea() -
intWidth
public int intWidth()- Returns:
- Rounded width.
-
intHeight
public int intHeight()- Returns:
- Rounded height.
-
inverted
- Returns:
- New instance with swapped width and height.
-
isEmpty
public boolean isEmpty()- Returns:
- true if either dimension is < 0.5.
-
longArea
public long longArea() -
longWidth
public long longWidth()- Returns:
- Rounded width.
-
longHeight
public long longHeight()- Returns:
- Rounded height.
-
scaled
Rescales both dimensions by the given amount.- Parameters:
amount
- Positive number with1
indicating no scale.- Returns:
- New instance.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecompare
method from their corresponding wrapper classes.
-