public class

RegionClipSpanIterator

extends Object
implements SpanIterator
java.lang.Object
   ↳ sun.java2d.pipe.RegionClipSpanIterator

Class Overview

This class clips a SpanIterator to a Region and outputs the resulting spans as another SpanIterator. Spans are output in the usual y/x order, unless the input span iterator doesn't conform to this order, or the iterator's span straddle more than one band of the Region used for clipping. Principle of operation: The iterator maintains a several cursors onto the RegionIterator in order to avoid having to buffer spans from the SpanIterator. They are: resetState The initial state of the RegionIterator lwm Low Water Mark, a running start point for processing each band. Usually goes down, but can be reset to resetState if a span has a lower start coordinate than the previous one. row The start of the current band of the RegionIterator box The current span of the current row The main nextSpan() loop implements a coroutine like structure, with three producers to get the next span, row and box calling each other to iterate through the span iterator and region. REMIND: Needs a native implementation!

Summary

Public Constructors
RegionClipSpanIterator(Region rgn, SpanIterator spanIter)
Public Methods
long getNativeIterator()
This method returns a native pointer to a function block that can be used by a native method to perform the same iteration cycle that the above methods provide while avoiding upcalls to the Java object.
void getPathBox(int[] pathbox)
This method returns the bounding box of the spans that the iterator will be returning.
void intersectClipBox(int lox, int loy, int hix, int hiy)
This method constrains the spans returned by nextSpan() to the rectangle whose bounds are given.
boolean nextSpan(int[] resultbox)
This method returns the next span in the shape being iterated.
void skipDownTo(int y)
This method tells the iterator that it may skip all spans whose Y range is completely above the indicated Y coordinate.
Protected Methods
void finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
[Expand]
Inherited Methods
From class java.lang.Object
From interface sun.java2d.pipe.SpanIterator

Public Constructors

public RegionClipSpanIterator (Region rgn, SpanIterator spanIter)

Public Methods

public long getNativeIterator ()

This method returns a native pointer to a function block that can be used by a native method to perform the same iteration cycle that the above methods provide while avoiding upcalls to the Java object. The definition of the structure whose pointer is returned by this method is defined in:

     src/share/native/sun/java2d/pipe/SpanIterator.h
 

public void getPathBox (int[] pathbox)

This method returns the bounding box of the spans that the iterator will be returning. The array must be of length at least 4 and upon return, it will be filled with the values:

     {PathMinX, PathMinY, PathMaxX, PathMaxY}.
 

public void intersectClipBox (int lox, int loy, int hix, int hiy)

This method constrains the spans returned by nextSpan() to the rectangle whose bounds are given.

public boolean nextSpan (int[] resultbox)

This method returns the next span in the shape being iterated. The array must be of length at least 4 and upon return, it will be filled with the values:

     {SpanMinX, SpanMinY, SpanMaxX, SpanMaxY}.
 

public void skipDownTo (int y)

This method tells the iterator that it may skip all spans whose Y range is completely above the indicated Y coordinate.

Protected Methods

protected void finalize ()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. A subclass overrides the finalize method to dispose of system resources or to perform other cleanup.

The general contract of finalize is that it is invoked if and when the JavaTM virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized. The finalize method may take any action, including making this object available again to other threads; the usual purpose of finalize, however, is to perform cleanup actions before the object is irrevocably discarded. For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.

The finalize method of class Object performs no special action; it simply returns normally. Subclasses of Object may override this definition.

The Java programming language does not guarantee which thread will invoke the finalize method for any given object. It is guaranteed, however, that the thread that invokes finalize will not be holding any user-visible synchronization locks when finalize is invoked. If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.

After the finalize method has been invoked for an object, no further action is taken until the Java virtual machine has again determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, including possible actions by other objects or classes which are ready to be finalized, at which point the object may be discarded.

The finalize method is never invoked more than once by a Java virtual machine for any given object.

Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.