Record Class Region
java.lang.Object
java.lang.Record
is.galia.image.Region
- Record Components:
x
- X origin.y
- Y origin.size
- Size.isFull
- Whentrue
, indicates a "full region" which renders its coordinate properties irrelevant.
Region on a plane with origin and dimensions.
A negative origin is allowed. Zero-dimensions are allowed, but not negative ones.
-
Constructor Summary
ConstructorsConstructorDescriptionRegion
(double x, double y, double width, double height) Region
(double x, double y, double width, double height, boolean isFull) Creates an instance of aRegion
record class.Region
(long x, long y, long width, long height) Region
(long x, long y, long width, long height, boolean isFull) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
Override that allows a small differences between float values.final int
hashCode()
Returns a hash code value for this object.double
height()
boolean
intersects
(Region other) int
int
intWidth()
int
intX()
int
intY()
boolean
isEmpty()
boolean
isFull()
Returns the value of theisFull
record component.long
long
long
longX()
long
longY()
moved
(double x, double y) oriented
(Size fullSize, Orientation orientation) resized
(double width, double height) scaled
(double amount) scaled
(double xAmount, double yAmount) size()
Returns the value of thesize
record component.Warning:Rectangle
does not support coordinates larger thanInteger.MAX_VALUE
,toString()
Returns a string representation of this record class.double
width()
double
x()
Returns the value of thex
record component.double
y()
Returns the value of they
record component.
-
Constructor Details
-
Region
-
Region
-
Region
public Region(double x, double y, double width, double height) -
Region
public Region(double x, double y, double width, double height, boolean isFull) -
Region
public Region(long x, long y, long width, long height) -
Region
public Region(long x, long y, long width, long height, boolean isFull) -
Region
Copy constructor.
-
-
Method Details
-
contains
- Returns:
- Whether the given rectangle is entirely contained within the instance.
-
equals
-
clippedTo
-
width
public double width() -
height
public double height() -
intX
public int intX()- Returns:
- Rounded value of
x()
.
-
intY
public int intY()- Returns:
- Rounded value of
y()
.
-
intWidth
public int intWidth()- Returns:
- Rounded value of
width()
.
-
intHeight
public int intHeight()- Returns:
- Rounded value of
height()
.
-
intersects
-
isEmpty
public boolean isEmpty()- Returns:
- Whether the instance has zero dimensions and is not
full
.
-
longX
public long longX()- Returns:
- Rounded value of
x()
.
-
longY
public long longY()- Returns:
- Rounded value of
y()
.
-
longWidth
public long longWidth()- Returns:
- Rounded value of
width()
.
-
longHeight
public long longHeight()- Returns:
- Rounded value of
height()
.
-
moved
-
oriented
- Parameters:
fullSize
- Raw source image dimensions.orientation
- Orientation to apply.- Returns:
- New oriented instance derived from the current one.
-
resized
- Returns:
- New instance with the same origin and the given size.
-
scaled
- Returns:
- New instance with origin and size scaled by the given amount.
-
scaled
- Returns:
- New instance with origin and dimensions scaled by the given amounts.
-
size
-
toAWTRectangle
Warning:Rectangle
does not support coordinates larger thanInteger.MAX_VALUE
, -
toString
-
hashCode
-
x
-
y
-
isFull
-