Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## quicktime.qd
Class QDRect

    java.lang.Object
      |
      +--quicktime.util.QTByteObject
            |
            +--quicktime.qd.QDRect

All Implemented Interfaces:
  java.lang.Cloneable, quicktime.jdirect.PrimitivesLib, java.io.Serializable, com.apple.jdirect.SharedLibrary, quicktime.jdirect.SharedLibrary

public final class QDRect
extends QTByteObject
implements quicktime.jdirect.PrimitivesLib, java.lang.Cloneable

This class corresponds to the Rect and FixedRect Data structures. It has a current limitation of x and y < 32767 and x+width, y+height < 32767.

The width and height values are the number of pixels that will be seen - thus if x == 1 and width is 3, the pixels drawn will be pixels at 1, 2, 3.

See Also:
  Serialized Form

Field Summary
`static int` | `kIsFixedRect` These constants are used in the fromArray call to indicate which of the 2 formats the byte array is encoded in.
`static int` | `kIsRect` These constants are used in the fromArray call to indicate which of the 2 formats the byte array is encoded in.

Fields inherited from interface quicktime.jdirect.PrimitivesLib
`JDirect_MacOSX, libraryInstance`

Constructor Summary
`QDRect()` Constructs a new rectangle, with (0, 0) origin and 0 width and height
`QDRect(java.awt.Dimension size)` Deprecated. since QTJava 4.0
`QDRect(float width, float height)` Constructs a rectangle and initializes it with the specified width and height parameters.
`QDRect(float x, float y, float width, float height)` Constructs and initializes a rectangle with the specified parameters.
`QDRect(int width, int height)` Constructs a rectangle and initializes it with the specified width and height parameters.
`QDRect(int x, int y, int width, int height)` Constructs and initializes a rectangle with the specified parameters.
`QDRect(java.awt.Point origin)` Deprecated. since QTJava 4.0
`QDRect(java.awt.Point origin, java.awt.Dimension size)` Deprecated. since QTJava 4.0
`QDRect(QDDimension size)` Constructs a QDRect with an origin of 0,0 and specified size.
`QDRect(QDPoint origin)` Constructs a QDRect with an origin specified and 0 width and height.
`QDRect(QDPoint origin, QDDimension size)` Constructs a QDRect with an origin and size specified.
`QDRect(java.awt.Rectangle rect)` Deprecated. since QTJava 4.0

Method Summary
`void` | `add(float newX, float newY)` Adds a point to the QDRect.
`void` | `add(int newX, int newY)` Adds a point to the QDRect.
`void` | `add(java.awt.Point pt)` Deprecated. as of QTJava 4.0
`void` | `add(QDPoint pt)` Adds a QDPoint to the QDRect.
`java.lang.Object` | `clone()` Return a copy of the QDRect
`QDRect` | `copy()` Returns a copy of the QDRect with the correct return type.
`boolean` | `equals(java.lang.Object obj)` Checks whether two QDRects are equal.
`static QDRect` | `fromArray(byte[] rectBytes, int flag)` Creates a QDRect from an array of bytes.
`static EndianDescriptor` | `getEndianDescriptorFixedRect()` Returns the EndianDescriptor for FixedRect Rect.
`static EndianDescriptor` | `getEndianDescriptorRect()` Returns the EndianDescriptor for QDRect Rect.
`byte[]` | `getFixedRect()` Returns the bytes for the FixedRect
`int` | `getHeight()` Get the height of the QDRect.
`float` | `getHeightF()` Get the height of the QDRect.
`byte[]` | `getRect()` Returns the bytes for the QDRect
`int` | `getWidth()` Get the width of the QDRect.
`float` | `getWidthF()` Get the width of the QDRect.
`int` | `getX()` Get the x location of the rect.
`float` | `getXF()` Get the x location of the rect.
`int` | `getY()` Get the y location of the rect.
`float` | `getYF()` Get the y location of the rect.
`void` | `grow(float h, float v)` Grows the QDRect horizontally and vertically.
`void` | `grow(int h, int v)` Grows the QDRect horizontally and vertically.
`int` | `hashCode()` Returns the hashcode for this Rectangle.
`boolean` | `inside(float x, float y)` Checks if the specified point lies inside a QDRect.
`boolean` | `inside(int x, int y)` Checks if the specified point lies inside a QDRect.
`QDRect` | `intersection(QDRect r)` Computes the intersection of two QDRects, returning the largets rect that encompasses both rects.
`boolean` | `intersects(QDRect r)` Checks if two QDRects intersect.
`boolean` | `isDifferentOrigin(QDRect rect)` Returns true if the QDRect argument has a different origin.
`boolean` | `isDifferentSize(QDRect rect)` Returns true if the QDRect argument is a different size.
`boolean` | `isEmpty()` Determines whether the QDRect is empty.
`void` | `move(float x, float y)` Moves the QDRect to x, y.
`void` | `move(int x, int y)` Moves the QDRect to x, y.
`void` | `reshape(float x, float y, float width, float height)` Reshapes the QDRect to x, y, width and height.
`void` | `reshape(int x, int y, int width, int height)` Reshapes the QDRect to x, y, width and height.
`void` | `resize(float width, float height)` Resizes the QDRect.
`void` | `resize(int width, int height)` Resizes the QDRect.
`void` | `setHeight(float height)` Set the height of the QDRect.
`void` | `setHeight(int height)` Set the height of the QDRect.
`void` | `setWidth(float width)` Set the width of the QDRect.
`void` | `setWidth(int width)` Set the width of the QDRect.
`void` | `setX(float x)` Set the x location of the rect.
`void` | `setX(int x)` Set the x location of the rect.
`void` | `setY(float y)` Set the y location of the rect.
`void` | `setY(int y)` Set the y location of the rect.
`java.lang.String` | `toString()` Returns the String representation of this QDRect's values.
`void` | `translate(float deltaX, float deltaY)` Translates the QDRect deltaX and deltaY.
`void` | `translate(int deltaX, int deltaY)` Translates the QDRect deltaX and deltaY.
`QDRect` | `union(QDRect r)` Computes the union of two QDRects, returning the smallest Rect that is the union of the two QDRects.

Methods inherited from class quicktime.util.QTByteObject
`fromArray, getBytes, getSize`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### kIsRect

    public static final int kIsRect

  These constants are used in the fromArray call to indicate which of the 2 formats the byte array is encoded in.

### kIsFixedRect

    public static final int kIsFixedRect

  These constants are used in the fromArray call to indicate which of the 2 formats the byte array is encoded in.

Constructor Detail

### QDRect

    public QDRect()

  Constructs a new rectangle, with (0, 0) origin and 0 width and height

### QDRect

    public QDRect(int x,
                  int y,
                  int width,
                  int height)

  Constructs and initializes a rectangle with the specified parameters. Int values will be cast to shorts.
  Parameters:
    `x` - the x coordinate
    `y` - the y coordinate
    `width` - the width of the rectangle
    `height` - the height of the rectangle

### QDRect

    public QDRect(float x,
                  float y,
                  float width,
                  float height)

  Constructs and initializes a rectangle with the specified parameters.
  Parameters:
    `x` - the x coordinate
    `y` - the y coordinate
    `width` - the width of the rectangle
    `height` - the height of the rectangle

### QDRect

    public QDRect(int width,
                  int height)

  Constructs a rectangle and initializes it with the specified width and height parameters.
  Parameters:
    `width` - the width of the rectangle
    `height` - the height of the rectangle

### QDRect

    public QDRect(float width,
                  float height)

  Constructs a rectangle and initializes it with the specified width and height parameters.
  Parameters:
    `width` - the width of the rectangle
    `height` - the height of the rectangle

### QDRect

    public QDRect(QDPoint origin)

  Constructs a QDRect with an origin specified and 0 width and height.
  Parameters:
    `origin` - the origin point of the QDRect

### QDRect

    public QDRect(java.awt.Point origin)

  Deprecated. since QTJava 4.0

  Constructs a QDRect with an origin specified and 0 width and height.
  Parameters:
    `origin` - the origin point of the QDRect
  See Also:
    `QDRect( QDPoint )`

### QDRect

    public QDRect(QDDimension size)

  Constructs a QDRect with an origin of 0,0 and specified size.
  Parameters:
    `size` - the size of the QDRect.

### QDRect

    public QDRect(java.awt.Dimension size)

  Deprecated. since QTJava 4.0

  Constructs a QDRect with an origin of 0,0 and specified size.
  Parameters:
    `size` - the size of the QDRect.
  See Also:
    `QDRect(QDDimension)`

### QDRect

    public QDRect(java.awt.Rectangle rect)

  Deprecated. since QTJava 4.0

  Constructs a QDRect with an origin of 0,0 and specified size. NOTE: This method is deprecated. There is no direct method replacement
  Parameters:
    `rect` - the Rectangle

### QDRect

    public QDRect(QDPoint origin,
                  QDDimension size)

  Constructs a QDRect with an origin and size specified.
  Parameters:
    `origin` - the origin point of the QDRect
    `size` - the size of the QDRect.

### QDRect

    public QDRect(java.awt.Point origin,
                  java.awt.Dimension size)

  Deprecated. since QTJava 4.0

  Constructs a QDRect with an origin and size specified.
  Parameters:
    `origin` - the origin point of the QDRect
    `size` - the size of the QDRect.
  See Also:
    `QDRect(QDPoint, QDDimension)`

Method Detail

### getEndianDescriptorFixedRect

    public static final EndianDescriptor getEndianDescriptorFixedRect()

  Returns the EndianDescriptor for FixedRect Rect.
  Returns:
    an EndianDescriptor

### getEndianDescriptorRect

    public static final EndianDescriptor getEndianDescriptorRect()

  Returns the EndianDescriptor for QDRect Rect.
  Returns:
    an EndianDescriptor

### fromArray

    public static QDRect fromArray(byte[] rectBytes,
                                   int flag)

  Creates a QDRect from an array of bytes. The minimum length of the array must equate to the requirements of the size of the native structure to store the result.
  - kIsRect, length == 8, top, left, right, bottom of 2 bytes each
  - kIsFixedRect, length == 16, left, top, right, bottom of 4 bytes each (fixed format 16.16)
  Parameters:
    `rectBytes` - the byte array containing the rect values
    `flag` - flag that describes the format of the byte array
  Returns:
    a QDRect
  Throws:
    `java.lang.IllegalArgumentException` - if mismatch between minimum length of byte array and format flag

### getRect

    public byte[] getRect()

  Returns the bytes for the QDRect

### getFixedRect

    public byte[] getFixedRect()

  Returns the bytes for the FixedRect

### getX

    public int getX()

  Get the x location of the rect.
  Returns:
    the current x location

### getXF

    public float getXF()

  Get the x location of the rect.
  Returns:
    the current x location

### setX

    public void setX(int x)

  Set the x location of the rect.
  Parameters:
    `x` - the new x location

### setX

    public void setX(float x)

  Set the x location of the rect.
  Parameters:
    `x` - the new x location

### getY

    public int getY()

  Get the y location of the rect.
  Returns:
    the current y location

### getYF

    public float getYF()

  Get the y location of the rect.
  Returns:
    the current y location

### setY

    public void setY(int y)

  Set the y location of the rect.
  Parameters:
    `y` - the new y location

### setY

    public void setY(float y)

  Set the y location of the rect.
  Parameters:
    `y` - the new y location

### isDifferentSize

    public boolean isDifferentSize(QDRect rect)

  Returns true if the QDRect argument is a different size.

### isDifferentOrigin

    public boolean isDifferentOrigin(QDRect rect)

  Returns true if the QDRect argument has a different origin.

### getWidth

    public int getWidth()

  Get the width of the QDRect.
  Returns:
    the current width

### getWidthF

    public float getWidthF()

  Get the width of the QDRect.
  Returns:
    the current width

### setWidth

    public void setWidth(int width)

  Set the width of the QDRect.
  Parameters:
    `width` - the new width

### setWidth

    public void setWidth(float width)

  Set the width of the QDRect.
  Parameters:
    `width` - the new width

### getHeight

    public int getHeight()

  Get the height of the QDRect.
  Returns:
    the current height

### getHeightF

    public float getHeightF()

  Get the height of the QDRect.
  Returns:
    the current height

### setHeight

    public void setHeight(int height)

  Set the height of the QDRect.
  Parameters:
    `height` - the new height

### setHeight

    public void setHeight(float height)

  Set the height of the QDRect.
  Parameters:
    `height` - the new height

### reshape

    public void reshape(int x,
                        int y,
                        int width,
                        int height)

  Reshapes the QDRect to x, y, width and height.

### reshape

    public void reshape(float x,
                        float y,
                        float width,
                        float height)

  Reshapes the QDRect to x, y, width and height.

### move

    public void move(int x,
                     int y)

  Moves the QDRect to x, y.

### move

    public void move(float x,
                     float y)

  Moves the QDRect to x, y.

### translate

    public void translate(int deltaX,
                          int deltaY)

  Translates the QDRect deltaX and deltaY.

### translate

    public void translate(float deltaX,
                          float deltaY)

  Translates the QDRect deltaX and deltaY.

### resize

    public void resize(int width,
                       int height)

  Resizes the QDRect.

### resize

    public void resize(float width,
                       float height)

  Resizes the QDRect.

### inside

    public boolean inside(int x,
                          int y)

  Checks if the specified point lies inside a QDRect.
  Parameters:
    `x` - the x coordinate
    `y` - the y coordinate

### inside

    public boolean inside(float x,
                          float y)

  Checks if the specified point lies inside a QDRect.
  Parameters:
    `x` - the x coordinate
    `y` - the y coordinate

### intersects

    public boolean intersects(QDRect r)

  Checks if two QDRects intersect.

### intersection

    public QDRect intersection(QDRect r)

  Computes the intersection of two QDRects, returning the largets rect that encompasses both rects.
  Parameters:
    `r` - the rect to intersect with
  Returns:
    a QDRect

### union

    public QDRect union(QDRect r)

  Computes the union of two QDRects, returning the smallest Rect that is the union of the two QDRects.
  Parameters:
    `r` - the rect to unify with this
  Returns:
    a rect

### add

    public void add(int newX,
                    int newY)

  Adds a point to the QDRect. This results in the smallest QDRect that contains both the existing rectangle and the new point.

### add

    public void add(float newX,
                    float newY)

  Adds a point to the QDRect. This results in the smallest QDRect that contains both the existing rectangle and the new point.

### add

    public void add(java.awt.Point pt)

  Deprecated. as of QTJava 4.0

  Adds a point to the QDRect. This results in the smallest QDRect that contains both the existing rectangle and the new point.
  Parameters:
    `pt` - the Point to add
  See Also:
    `add(QDPoint)`

### add

    public void add(QDPoint pt)

  Adds a QDPoint to the QDRect. This results in the smallest QDRect that contains both the existing rectangle and the new point.
  Parameters:
    `pt` - the QDPoint to add

### grow

    public void grow(int h,
                     int v)

  Grows the QDRect horizontally and vertically. This method modifies the QDRect so that it is h units larger on both the left and right side, and v units larger at both the top and bottom.

### grow

    public void grow(float h,
                     float v)

  Grows the QDRect horizontally and vertically. This method modifies the QDRect so that it is h units larger on both the left and right side, and v units larger at both the top and bottom.

### isEmpty

    public boolean isEmpty()

  Determines whether the QDRect is empty.

### hashCode

    public int hashCode()

  Returns the hashcode for this Rectangle.
  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object obj)

  Checks whether two QDRects are equal.
  Overrides:
    `equals` in class `QTByteObject`

### toString

    public java.lang.String toString()

  Returns the String representation of this QDRect's values.
  Overrides:
    `toString` in class `QTByteObject`

### clone

    public java.lang.Object clone()

  Return a copy of the QDRect
  Returns:
    a QDRect

### copy

    public QDRect copy()

  Returns a copy of the QDRect with the correct return type.
  Returns:
    a QDRect

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD