Home » openjdk-7 » sun » java2d » pipe » [javadoc | source]
sun.java2d.pipe
public class: Region [javadoc | source]
java.lang.Object
   sun.java2d.pipe.Region

Direct Known Subclasses:
    ImmutableRegion

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
Field Summary
static final  int INIT_SIZE     
static final  int GROW_SIZE     
public static final  Region EMPTY_REGION     
public static final  Region WHOLE_REGION     
 int lox     
 int loy     
 int hix     
 int hiy     
 int endIndex     
 int[] bands     
static final  int INCLUDE_A     
static final  int INCLUDE_B     
static final  int INCLUDE_COMMON     
Constructor:
 protected Region(int lox,
    int loy,
    int hix,
    int hiy) 
Method from sun.java2d.pipe.Region Summary:
appendSpans,   clipAdd,   clipBoxToBounds,   contains,   dimAdd,   encompasses,   encompassesXYWH,   encompassesXYXY,   equals,   filter,   getBounds,   getBoundsIntersection,   getBoundsIntersection,   getBoundsIntersectionXYWH,   getBoundsIntersectionXYXY,   getDifference,   getExclusiveOr,   getHeight,   getHiX,   getHiY,   getInstance,   getInstance,   getInstance,   getInstance,   getInstance,   getInstanceXYWH,   getInstanceXYXY,   getIntersection,   getIntersection,   getIntersectionXYWH,   getIntersectionXYXY,   getIterator,   getLoX,   getLoY,   getSpanIterator,   getSpanIterator,   getTranslatedRegion,   getUnion,   getWidth,   hashCode,   intersectsQuickCheck,   intersectsQuickCheckXYXY,   isEmpty,   isInsideQuickCheck,   isInsideXYWH,   isInsideXYXY,   isRectangular,   setOutputArea,   setOutputArea,   setOutputAreaXYWH,   setOutputAreaXYXY,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.java2d.pipe.Region Detail:
 public  void appendSpans(SpanIterator si) 
    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.
 public static int clipAdd(int v,
    int dv) 
    Adds the delta {@code dv} to the value {@code v} with appropriate clipping to the bounds of Integer resolution. If the answer would be greater than {@code Integer.MAX_VALUE} then {@code Integer.MAX_VALUE} is returned. If the answer would be less than {@code Integer.MIN_VALUE} then {@code Integer.MIN_VALUE} is returned. Otherwise the sum is returned.
 public  void clipBoxToBounds(int[] bbox) 
    Clips the indicated bbox array to the bounds of this Region.
 public boolean contains(int x,
    int y) 
    Returns true iff this Region contains the specified coordinate.
 public static int dimAdd(int start,
    int dim) 
    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.
 public boolean encompasses(Region r) 
    Quickly checks if this Region surrounds the specified Region object.

    This method will return false if this Region object is not a simple rectangle.

 public boolean encompassesXYWH(int x,
    int y,
    int w,
    int h) 
    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.

 public boolean encompassesXYXY(int lox,
    int loy,
    int hix,
    int hiy) 
    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.

 public boolean equals(Object o) 
 public SpanIterator filter(SpanIterator si) 
    Returns a SpanIterator that is the argument iterator filtered by this region.
 public  void getBounds(int[] pathbox) 
    Gets the bbox of the available spans, clipped to the OutputArea.
 public Region getBoundsIntersection(Rectangle r) 
    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.

 public Region getBoundsIntersection(Region r) 
    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.

 public Region getBoundsIntersectionXYWH(int x,
    int y,
    int w,
    int h) 
    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.

 public Region getBoundsIntersectionXYXY(int lox,
    int loy,
    int hix,
    int hiy) 
    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.

 public Region getDifference(Region r) 
    Returns a Region object that represents the difference of the specified Region object subtracted from this object.

    If {@code A} and {@code B} are both Region Objects and C = A.getDifference(B); then a point will be contained in {@code C} iff it is contained in {@code A} but not contained in {@code B}.

    The return value may be this same object or the argument Region object if no clipping occurs.

 public Region getExclusiveOr(Region r) 
    Returns a Region object that represents the exclusive or of this object with the specified Region object.

    If {@code A} and {@code B} are both Region Objects and C = A.getExclusiveOr(B); then a point will be contained in {@code C} iff it is contained in either {@code A} or {@code 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.

 public final int getHeight() 
    Returns the height of this Region clipped to the range (0 - MAX_INT).
 public final int getHiX() 
    Returns the highest X coordinate in the Region.
 public final int getHiY() 
    Returns the highest Y coordinate in the Region.
 public static Region getInstance(Rectangle r) 
    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.

 public static Region getInstance(int[] box) 
    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.

 public static Region getInstance(Shape s,
    AffineTransform at) 
    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.
 public static Region getInstance(Region devBounds,
    Shape s,
    AffineTransform at) 
    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.

 public static Region getInstance(Region devBounds,
    boolean normalize,
    Shape s,
    AffineTransform at) 
    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.

 public static Region getInstanceXYWH(int x,
    int y,
    int w,
    int h) 
    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.

 public static Region getInstanceXYXY(int lox,
    int loy,
    int hix,
    int hiy) 
    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.

 public Region getIntersection(Rectangle r) 
    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.
 public Region getIntersection(Region r) 
    Returns a Region object that represents the intersection of this object with the specified Region object.

    If {@code A} and {@code B} are both Region Objects and C = A.getIntersection(B); then a point will be contained in {@code C} iff it is contained in both {@code A} and {@code B}.

    The return value may be this same object or the argument Region object if no clipping occurs.

 public Region getIntersectionXYWH(int x,
    int y,
    int w,
    int h) 
    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.
 public Region getIntersectionXYXY(int lox,
    int loy,
    int hix,
    int hiy) 
    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.
 public RegionIterator getIterator() 
    Gets an iterator object to iterate over the spans in this region.
 public final int getLoX() 
    Returns the lowest X coordinate in the Region.
 public final int getLoY() 
    Returns the lowest Y coordinate in the Region.
 public SpanIterator getSpanIterator() 
    Gets a span iterator object that iterates over the spans in this region
 public SpanIterator getSpanIterator(int[] bbox) 
    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).
 public Region getTranslatedRegion(int dx,
    int dy) 
    Returns a Region object that represents the same list of rectangles as the current Region object, translated by the specified dx, dy translation factors.
 public Region getUnion(Region r) 
    Returns a Region object that represents the union of this object with the specified Region object.

    If {@code A} and {@code B} are both Region Objects and C = A.getUnion(B); then a point will be contained in {@code C} iff it is contained in either {@code A} or {@code B}.

    The return value may be this same object or the argument Region object if no augmentation occurs.

 public final int getWidth() 
    Returns the width of this Region clipped to the range (0 - MAX_INT).
 public int hashCode() 
 public boolean intersectsQuickCheck(Region r) 
    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.

 public boolean intersectsQuickCheckXYXY(int lox,
    int loy,
    int hix,
    int hiy) 
    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.

 public boolean isEmpty() 
    Returns true iff this Region encloses no area.
 public boolean isInsideQuickCheck(Region r) 
    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.

 public boolean isInsideXYWH(int x,
    int y,
    int w,
    int h) 
    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.
 public boolean isInsideXYXY(int lox,
    int loy,
    int hix,
    int hiy) 
    Returns true iff this Region lies inside the indicated rectangular area specified in lox, loy, hix, hiy format.
 public boolean isRectangular() 
    Returns true iff this Region represents a single simple rectangular area.
 public  void setOutputArea(Rectangle r) 
    Sets the rectangle of interest for storing and returning region bands.

    This method can also be used to initialize a simple rectangular region.

 public  void setOutputArea(int[] box) 
    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.

 public  void setOutputAreaXYWH(int x,
    int y,
    int w,
    int h) 
    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.

 public  void setOutputAreaXYXY(int lox,
    int loy,
    int hix,
    int hiy) 
    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.

 public String toString()