java.lang.Object | |
↳ | sun.java2d.pipe.Region |
This class encapsulates a definition of a two dimensional region which consists of a number of Y ranges each containing multiple X bands.
A rectangular Region is allowed to have a null band list in which case the rectangular shape is defined by the bounding box parameters (lox, loy, hix, hiy).
The band list, if present, consists of a list of rows in ascending Y order, ending at endIndex which is the index beyond the end of the last row. Each row consists of at least 3 + 2n entries (n >= 1) where the first 3 entries specify the Y range as start, end, and the number of X ranges in that Y range. These 3 entries are followed by pairs of X coordinates in ascending order:
bands[rowstart+0] = Y0; // starting Y coordinate bands[rowstart+1] = Y1; // ending Y coordinate - endY > startY bands[rowstart+2] = N; // number of X bands - N >= 1 bands[rowstart+3] = X10; // starting X coordinate of first band bands[rowstart+4] = X11; // ending X coordinate of first band bands[rowstart+5] = X20; // starting X coordinate of second band bands[rowstart+6] = X21; // ending X coordinate of second band ... bands[rowstart+3+N*2-2] = XN0; // starting X coord of last band bands[rowstart+3+N*2-1] = XN1; // ending X coord of last band bands[rowstart+3+N*2] = ... // start of next Y row
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Appends the list of spans returned from the indicated
SpanIterator.
| |||||||||||
Adds the delta
dv to the value v with
appropriate clipping to the bounds of Integer resolution. | |||||||||||
Clips the indicated bbox array to the bounds of this Region.
| |||||||||||
Returns true iff this Region contains the specified coordinate.
| |||||||||||
Adds the dimension
dim to the coordinate
start with appropriate clipping. | |||||||||||
Quickly checks if this Region surrounds the specified
Region object.
| |||||||||||
Quickly checks if this Region surrounds the specified
rectangular area specified in x, y, width, height format.
| |||||||||||
Quickly checks if this Region surrounds the specified
rectangular area specified in lox, loy, hix, hiy format.
| |||||||||||
Indicates whether some other object is "equal to" this one.
| |||||||||||
Returns a SpanIterator that is the argument iterator filtered by
this region.
| |||||||||||
Gets the bbox of the available spans, clipped to the OutputArea.
| |||||||||||
Returns a Region object that represents the bounds of the
intersection of this object with the bounds of the specified
Region object.
| |||||||||||
Returns a Region object that represents the intersection of
this object with the bounds of the specified Region object.
| |||||||||||
Returns a Region object that represents the bounds of the
intersection of this object with the bounds of the specified
rectangular area in x, y, width, height format.
| |||||||||||
Returns a Region object that represents the bounds of the
intersection of this object with the bounds of the specified
rectangular area in lox, loy, hix, hiy format.
| |||||||||||
Returns a Region object that represents the difference of the
specified Region object subtracted from this object.
| |||||||||||
Returns a Region object that represents the exclusive or of this
object with the specified Region object.
| |||||||||||
Returns the height of this Region clipped to the range (0 - MAX_INT).
| |||||||||||
Returns the highest X coordinate in the Region.
| |||||||||||
Returns the highest Y coordinate in the Region.
| |||||||||||
Returns a Region object covering the pixels which would be
touched by a fill or clip operation on a Graphics implementation
on the specified Shape object under the optionally specified
AffineTransform object.
| |||||||||||
Returns a Region object covering the pixels which would be
touched by a fill or clip operation on a Graphics implementation
on the specified Shape object under the optionally specified
AffineTransform object further restricted by the specified
device bounds.
| |||||||||||
Returns a Region object with a rectangle of interest specified
by the indicated Rectangle object.
| |||||||||||
Returns a Region object with a rectangle of interest specified
by the indicated span array.
| |||||||||||
Returns a Region object covering the pixels which would be
touched by a fill or clip operation on a Graphics implementation
on the specified Shape object under the optionally specified
AffineTransform object further restricted by the specified
device bounds.
| |||||||||||
Returns a Region object with a rectangle of interest specified
by the indicated rectangular area in x, y, width, height format.
| |||||||||||
Returns a Region object with a rectangle of interest specified
by the indicated rectangular area in lox, loy, hix, hiy format.
| |||||||||||
Returns a Region object that represents the intersection of this
object with the specified Region object.
| |||||||||||
Returns a Region object that represents the intersection of
this object with the specified Rectangle.
| |||||||||||
Returns a Region object that represents the intersection of
this object with the specified rectangular area.
| |||||||||||
Returns a Region object that represents the intersection of
this object with the specified rectangular area.
| |||||||||||
Gets an iterator object to iterate over the spans in this region.
| |||||||||||
Returns the lowest X coordinate in the Region.
| |||||||||||
Returns the lowest Y coordinate in the Region.
| |||||||||||
Gets a span iterator object that iterates over the spans in this region
| |||||||||||
Gets a span iterator object that iterates over the spans in this region
but clipped to the bounds given in the argument (xlo, ylo, xhi, yhi).
| |||||||||||
Returns a Region object that represents the same list of
rectangles as the current Region object, translated by
the specified dx, dy translation factors.
| |||||||||||
Returns a Region object that represents the union of this
object with the specified Region object.
| |||||||||||
Returns the width of this Region clipped to the range (0 - MAX_INT).
| |||||||||||
Returns a hash code value for the object.
| |||||||||||
Quickly checks if this Region intersects the specified
Region object.
| |||||||||||
Quickly checks if this Region intersects the specified
rectangular area specified in lox, loy, hix, hiy format.
| |||||||||||
Returns true iff this Region encloses no area.
| |||||||||||
Quickly checks if this Region lies inside the specified
Region object.
| |||||||||||
Returns true iff this Region lies inside the indicated
rectangular area specified in x, y, width, height format
with appropriate clipping performed as per the dimAdd method.
| |||||||||||
Returns true iff this Region lies inside the indicated
rectangular area specified in lox, loy, hix, hiy format.
| |||||||||||
Returns true iff this Region represents a single simple
rectangular area.
| |||||||||||
Sets the rectangle of interest for storing and returning
region bands.
| |||||||||||
Sets the rectangle of interest for storing and returning
region bands.
| |||||||||||
Sets the rectangle of interest for storing and returning
region bands.
| |||||||||||
Sets the rectangle of interest for storing and returning
region bands.
| |||||||||||
Returns a string representation of the object.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Appends the list of spans returned from the indicated SpanIterator. Each span must be at a higher starting Y coordinate than the previous data or it must have a Y range equal to the highest Y band in the region and a higher X coordinate than any of the spans in that band.
Adds the delta dv
to the value v
with
appropriate clipping to the bounds of Integer resolution.
If the answer would be greater than Integer.MAX_VALUE
then Integer.MAX_VALUE
is returned.
If the answer would be less than Integer.MIN_VALUE
then Integer.MIN_VALUE
is returned.
Otherwise the sum is returned.
Clips the indicated bbox array to the bounds of this Region.
Returns true iff this Region contains the specified coordinate.
Adds the dimension dim
to the coordinate
start
with appropriate clipping. If
dim
is non-positive then the method returns
the start coordinate. If the sum overflows an integer
data type then the method returns Integer.MAX_VALUE
.
Quickly checks if this Region surrounds the specified Region object.
This method will return false if this Region object is not a simple rectangle.
Quickly checks if this Region surrounds the specified rectangular area specified in x, y, width, height format.
This method will return false if this Region object is not a simple rectangle.
Quickly checks if this Region surrounds the specified rectangular area specified in lox, loy, hix, hiy format.
This method will return false if this Region object is not a simple rectangle.
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y) consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.
o | the reference object with which to compare. |
---|
true
if this object is the same as the obj
argument; false
otherwise.Returns a SpanIterator that is the argument iterator filtered by this region.
Gets the bbox of the available spans, clipped to the OutputArea.
Returns a Region object that represents the bounds of the intersection of this object with the bounds of the specified Region object.
The return value may be this same object if no clipping occurs and this Region is rectangular.
Returns a Region object that represents the intersection of this object with the bounds of the specified Region object.
The return value may be this same object or the argument Region object if no clipping occurs and the Regions are rectangular.
Returns a Region object that represents the bounds of the intersection of this object with the bounds of the specified rectangular area in x, y, width, height format.
The return value may be this same object if no clipping occurs and this Region is rectangular.
Returns a Region object that represents the bounds of the intersection of this object with the bounds of the specified rectangular area in lox, loy, hix, hiy format.
The return value may be this same object if no clipping occurs and this Region is rectangular.
Returns a Region object that represents the difference of the specified Region object subtracted from this object.
If A
and B
are both Region Objects and
C = A.getDifference(B);
then a point will
be contained in C
iff it is contained in
A
but not contained in B
.
The return value may be this same object or the argument Region object if no clipping occurs.
Returns a Region object that represents the exclusive or of this object with the specified Region object.
If A
and B
are both Region Objects and
C = A.getExclusiveOr(B);
then a point will
be contained in C
iff it is contained in either
A
or B
, but not if it is contained in both.
The return value may be this same object or the argument Region object if either is empty.
Returns the height of this Region clipped to the range (0 - MAX_INT).
Returns the highest X coordinate in the Region.
Returns the highest Y coordinate in the Region.
Returns a Region object covering the pixels which would be touched by a fill or clip operation on a Graphics implementation on the specified Shape object under the optionally specified AffineTransform object.
s | a non-null Shape object specifying the geometry enclosing the pixels of interest |
---|---|
at | an optional AffineTransform to be applied to the
coordinates as they are returned in the iteration, or
null if untransformed coordinates are desired
|
Returns a Region object covering the pixels which would be touched by a fill or clip operation on a Graphics implementation on the specified Shape object under the optionally specified AffineTransform object further restricted by the specified device bounds. If the normalize parameter is true then coordinate normalization is performed as per the 2D Graphics non-antialiasing implementation of the VALUE_STROKE_NORMALIZE hint.
Note that only the bounds of the specified Region are used to restrict the resulting Region. If devBounds is non-rectangular and clipping to the specific bands of devBounds is needed, then an intersection of the resulting Region with devBounds must be performed in a subsequent step.
devBounds | a non-null Region specifying some bounds to clip the geometry to |
---|---|
normalize | a boolean indicating whether or not to apply normalization |
s | a non-null Shape object specifying the geometry enclosing the pixels of interest |
at | an optional AffineTransform to be applied to the
coordinates as they are returned in the iteration, or
null if untransformed coordinates are desired
|
Returns a Region object with a rectangle of interest specified by the indicated Rectangle object.
This method can also be used to create a simple rectangular region.
Returns a Region object with a rectangle of interest specified by the indicated span array.
This method can also be used to create a simple rectangular region.
Returns a Region object covering the pixels which would be touched by a fill or clip operation on a Graphics implementation on the specified Shape object under the optionally specified AffineTransform object further restricted by the specified device bounds.
Note that only the bounds of the specified Region are used to restrict the resulting Region. If devBounds is non-rectangular and clipping to the specific bands of devBounds is needed, then an intersection of the resulting Region with devBounds must be performed in a subsequent step.
devBounds | a non-null Region specifying some bounds to clip the geometry to |
---|---|
s | a non-null Shape object specifying the geometry enclosing the pixels of interest |
at | an optional AffineTransform to be applied to the
coordinates as they are returned in the iteration, or
null if untransformed coordinates are desired
|
Returns a Region object with a rectangle of interest specified by the indicated rectangular area in x, y, width, height format.
This method can also be used to create a simple rectangular region.
Returns a Region object with a rectangle of interest specified by the indicated rectangular area in lox, loy, hix, hiy format.
This method can also be used to create a simple rectangular region.
Returns a Region object that represents the intersection of this object with the specified Region object.
If A
and B
are both Region Objects and
C = A.getIntersection(B);
then a point will
be contained in C
iff it is contained in both
A
and B
.
The return value may be this same object or the argument Region object if no clipping occurs.
Returns a Region object that represents the intersection of this object with the specified Rectangle. The return value may be this same object if no clipping occurs.
Returns a Region object that represents the intersection of this object with the specified rectangular area. The return value may be this same object if no clipping occurs.
Returns a Region object that represents the intersection of this object with the specified rectangular area. The return value may be this same object if no clipping occurs.
Gets an iterator object to iterate over the spans in this region.
Returns the lowest X coordinate in the Region.
Returns the lowest Y coordinate in the Region.
Gets a span iterator object that iterates over the spans in this region
Gets a span iterator object that iterates over the spans in this region but clipped to the bounds given in the argument (xlo, ylo, xhi, yhi).
Returns a Region object that represents the same list of rectangles as the current Region object, translated by the specified dx, dy translation factors.
Returns a Region object that represents the union of this object with the specified Region object.
If A
and B
are both Region Objects and
C = A.getUnion(B);
then a point will
be contained in C
iff it is contained in either
A
or B
.
The return value may be this same object or the argument Region object if no augmentation occurs.
Returns the width of this Region clipped to the range (0 - MAX_INT).
Returns a hash code value for the object. This method is
supported for the benefit of hashtables such as those provided by
java.util.Hashtable
.
The general contract of hashCode
is:
hashCode
method on each of
the two objects must produce the same integer result.
equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
Quickly checks if this Region intersects the specified Region object.
This method tests only against the bounds of this region and does not bother to test if the rectangular region actually intersects any bands.
Quickly checks if this Region intersects the specified rectangular area specified in lox, loy, hix, hiy format.
This method tests only against the bounds of this region and does not bother to test if the rectangular region actually intersects any bands.
Returns true iff this Region encloses no area.
Quickly checks if this Region lies inside the specified Region object.
This method will return false if the specified Region object is not a simple rectangle.
Returns true iff this Region lies inside the indicated rectangular area specified in x, y, width, height format with appropriate clipping performed as per the dimAdd method.
Returns true iff this Region lies inside the indicated rectangular area specified in lox, loy, hix, hiy format.
Returns true iff this Region represents a single simple rectangular area.
Sets the rectangle of interest for storing and returning region bands. The rectangle is specified as a span array.
This method can also be used to initialize a simple rectangular region.
Sets the rectangle of interest for storing and returning region bands.
This method can also be used to initialize a simple rectangular region.
Sets the rectangle of interest for storing and returning
region bands. The rectangle is specified in x, y, width, height
format and appropriate clipping is performed as per the method
dimAdd
.
This method can also be used to initialize a simple rectangular region.
Sets the rectangle of interest for storing and returning region bands. The rectangle is specified in lox, loy, hix, hiy format.
This method can also be used to initialize a simple rectangular region.
Returns a string representation of the object. In general, the
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())