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 TypeMethodDescriptiondoublearea()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleheight()Returns the value of theheightrecord component.intintArea()intintintWidth()inverted()booleanisEmpty()static booleanlonglongArea()longlongstatic SizeofScaledArea(Size size, long scaledArea) scaled(double amount) Rescales both dimensions by the given amount.toString()Returns a string representation of this record class.doublewidth()Returns the value of thewidthrecord 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 with1indicating 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 thecomparemethod from their corresponding wrapper classes.
-