Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.swt.graphics.custom
Class DirtyRectangle  view DirtyRectangle download DirtyRectangle.java

java.lang.Object
  extended byorg.eclipse.swt.graphics.custom.DirtyRectangle
All Implemented Interfaces:
java.io.Serializable, org.eclipse.swt.internal.SerializableCompatibility

public class DirtyRectangle
extends java.lang.Object
implements org.eclipse.swt.internal.SerializableCompatibility

Custom version of org.eclipse.swt.graphics.Rectangle. Added method add(x,y,w,h) to avoid creating intermediate Rectangle objects. Instances of this class represent rectangular areas in an (x, y) coordinate system. The top left corner of the rectangle is specified by its x and y values, and the extent of the rectangle is specified by its width and height.

The coordinate space for rectangles and points is considered to have increasing values downward and to the right from its origin making this the normal, computer graphics oriented notion of (x, y) coordinates rather than the strict mathematical one.

Application code does not need to explicitly release the resources managed by each instance when those instances are no longer required, and thus no dispose() method is provided.


Field Summary
 int height
          the height of the rectangle
 int width
          the width of the rectangle
 int x
          the x coordinate of the rectangle
 int y
          the y coordinate of the rectangle
 
Constructor Summary
DirtyRectangle(int x, int y, int width, int height)
          Construct a new instance of this class given the x, y, width and height values.
 
Method Summary
 void add(DirtyRectangle rect)
          Destructively replaces the x, y, width and height values in the receiver with ones which represent the union of the rectangles specified by the receiver and the given rectangle.
 void add(int xx, int yy, int ww, int hh)
           
 void add(org.eclipse.swt.graphics.Rectangle rect)
           
 void clear()
           
 boolean contains(int x, int y)
          Returns true if the point specified by the arguments is inside the area specified by the receiver, and false otherwise.
 boolean contains(org.eclipse.swt.graphics.Point pt)
          Returns true if the given point is inside the area specified by the receiver, and false otherwise.
 boolean equals(java.lang.Object object)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 int hashCode()
          Returns an integer hash code for the receiver.
 void init(int x, int y, int w, int h)
           
 void init(org.eclipse.swt.graphics.Rectangle rect)
           
 DirtyRectangle intersection(DirtyRectangle rect)
          Returns a new rectangle which represents the intersection of the receiver and the given rectangle.
 boolean intersects(DirtyRectangle rect)
          Returns true if the given rectangle intersects with the receiver and false otherwise.
 boolean isEmpty()
          Returns true if the receiver does not cover any area in the (x, y) coordinate plane, and false if the receiver does cover some area in the plane.
 java.lang.String toString()
          Returns a string containing a concise, human-readable description of the receiver.
 DirtyRectangle union(DirtyRectangle rect)
          Returns a new rectangle which represents the union of the receiver and the given rectangle.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public int x
the x coordinate of the rectangle


y

public int y
the y coordinate of the rectangle


width

public int width
the width of the rectangle


height

public int height
the height of the rectangle

Constructor Detail

DirtyRectangle

public DirtyRectangle(int x,
                      int y,
                      int width,
                      int height)
Construct a new instance of this class given the x, y, width and height values.

Method Detail

init

public void init(int x,
                 int y,
                 int w,
                 int h)

init

public void init(org.eclipse.swt.graphics.Rectangle rect)

add

public void add(DirtyRectangle rect)
Destructively replaces the x, y, width and height values in the receiver with ones which represent the union of the rectangles specified by the receiver and the given rectangle.

The union of two rectangles is the smallest single rectangle that completely covers both of the areas covered by the two given rectangles.


add

public void add(org.eclipse.swt.graphics.Rectangle rect)

add

public void add(int xx,
                int yy,
                int ww,
                int hh)

contains

public boolean contains(int x,
                        int y)
Returns true if the point specified by the arguments is inside the area specified by the receiver, and false otherwise.


contains

public boolean contains(org.eclipse.swt.graphics.Point pt)
Returns true if the given point is inside the area specified by the receiver, and false otherwise.


equals

public boolean equals(java.lang.Object object)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.


hashCode

public int hashCode()
Returns an integer hash code for the receiver. Any two objects which return true when passed to equals must return the same value for this method.


intersection

public DirtyRectangle intersection(DirtyRectangle rect)
Returns a new rectangle which represents the intersection of the receiver and the given rectangle.

The intersection of two rectangles is the rectangle that covers the area which is contained within both rectangles.


intersects

public boolean intersects(DirtyRectangle rect)
Returns true if the given rectangle intersects with the receiver and false otherwise.

Two rectangles intersect if the area of the rectangle representing their intersection is not empty.


isEmpty

public boolean isEmpty()
Returns true if the receiver does not cover any area in the (x, y) coordinate plane, and false if the receiver does cover some area in the plane.

A rectangle is considered to cover area in the (x, y) coordinate plane if both its width and height are non-zero.


toString

public java.lang.String toString()
Returns a string containing a concise, human-readable description of the receiver.


union

public DirtyRectangle union(DirtyRectangle rect)
Returns a new rectangle which represents the union of the receiver and the given rectangle.

The union of two rectangles is the smallest single rectangle that completely covers both of the areas covered by the two given rectangles.


clear

public void clear()