com.aspose.imaging
Class RectangleF

java.lang.Object
  extended by 
      extended by com.aspose.imaging.RectangleF

public class RectangleF
extends

Stores a set of four floating-point numbers that represent the location and size of a rectangle.


Constructor Summary
RectangleF()
           
RectangleF(float x, float y, float width, float height)
           Initializes a new instance of the RectangleF structure with the specified location and size.
RectangleF(PointF location, SizeF size)
           Initializes a new instance of the RectangleF structure with the specified location and size.
 
Method Summary
 java.lang.Object clone()
           
 RectangleF Clone()
           
 void CloneTo(RectangleF that)
           
 boolean contains(float x, float y)
           Determines if the specified point is contained within this RectangleF structure.
 boolean contains(PointF point)
           Determines if the specified point is contained within this RectangleF structure.
 boolean contains(RectangleF rect)
           Determines if the rectangular region represented by rect is entirely contained within this RectangleF structure.
 boolean equals(java.lang.Object obj)
           Tests whether obj is a RectangleF with the same location and size of this RectangleF.
static boolean equals(RectangleF obj1, RectangleF obj2)
           
static RectangleF fromLeftTopRightBottom(float left, float top, float right, float bottom)
           Creates a RectangleF structure with upper-left corner and lower-right corner at the specified locations.
static RectangleF fromPoints(PointF point1, PointF point2)
           Creates a new Rectangle froms two points specified.
 float getBottom()
           Gets the y-coordinate that is the sum of RectangleF.Y and RectangleF.Height of this RectangleF structure.
static RectangleF getEmpty()
           Gets a new instance of the RectangleF structure that has RectangleF.X, RectangleF.Y, RectangleF.Width and RectangleF.Height values set to zero.
 float getHeight()
           Gets the height of this RectangleF structure.
 float getLeft()
           Gets the x-coordinate of the left edge of this RectangleF structure.
 PointF getLocation()
           Gets the coordinates of the upper-left corner of this RectangleF structure.
 float getRight()
           Gets the x-coordinate that is the sum of RectangleF.X and RectangleF.Width of this RectangleF structure.
 SizeF getSize()
           Gets the size of this RectangleF.
 float getTop()
           Gets the y-coordinate of the top edge of this RectangleF structure.
 float getWidth()
           Gets the width of this RectangleF structure.
 float getX()
           Gets the x-coordinate of the upper-left corner of this RectangleF structure.
 float getY()
           Gets the y-coordinate of the upper-left corner of this RectangleF structure.
 int hashCode()
           Gets the hash code for this RectangleF structure.
 void inflate(float x, float y)
           Inflates this RectangleF structure by the specified amount.
static RectangleF inflate(RectangleF rect, float x, float y)
           Creates and returns an inflated copy of the specified RectangleF structure.
 void inflate(SizeF size)
           Inflates this RectangleF by the specified amount.
 void intersect(RectangleF rect)
           Replaces this RectangleF structure with the intersection of itself and the specified RectangleF structure.
static RectangleF intersect(RectangleF a, RectangleF b)
           Returns a RectangleF structure that represents the intersection of two rectangles.
 boolean intersectsWith(RectangleF rect)
           Determines if this rectangle intersects with rect.
 boolean isEmpty()
           Gets a value indicating whether the RectangleF.Width or RectangleF.Height property of this RectangleF has a value of zero.
 void normalize()
           Normalizes the rectangle by making it's width and height positive, left less than right and top less than bottom.
 void offset(float x, float y)
           Adjusts the location of this rectangle by the specified amount.
 void offset(PointF pos)
           Adjusts the location of this rectangle by the specified amount.
static boolean op_Equality(RectangleF left, RectangleF right)
           Tests whether two RectangleF structures have equal location and size.
static boolean op_Inequality(RectangleF left, RectangleF right)
           Tests whether two RectangleF structures differ in location or size.
 void setBottom(float value)
           Sets the y-coordinate that is the sum of RectangleF.Y and RectangleF.Height of this RectangleF structure.
 void setHeight(float value)
           Sets the height of this RectangleF structure.
 void setLeft(float value)
           Sets the x-coordinate of the left edge of this RectangleF structure.
 void setLocation(PointF value)
           Sets the coordinates of the upper-left corner of this RectangleF structure.
 void setRight(float value)
           Sets the x-coordinate that is the sum of RectangleF.X and RectangleF.Width of this RectangleF structure.
 void setSize(SizeF value)
           Gets the size of this RectangleF.
 void setTop(float value)
           Sets the y-coordinate of the top edge of this RectangleF structure.
 void setWidth(float value)
           Sets the width of this RectangleF structure.
 void setX(float value)
           Sets the x-coordinate of the upper-left corner of this RectangleF structure.
 void setY(float value)
           Sets the y-coordinate of the upper-left corner of this RectangleF structure.
static RectangleF toRectangleF(Rectangle rect)
           Converts the specified Rectangle structure to a RectangleF structure.
 java.lang.String toString()
           Converts the attributes of this RectangleF to a human-readable string.
static RectangleF union(RectangleF a, RectangleF b)
           Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RectangleF

public RectangleF()

RectangleF

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

Initializes a new instance of the RectangleF structure with the specified location and size.

Parameters:
x - The x-coordinate of the upper-left corner of the rectangle.
y - The y-coordinate of the upper-left corner of the rectangle.
width - The width of the rectangle.
height - The height of the rectangle.

RectangleF

public RectangleF(PointF location,
                  SizeF size)

Initializes a new instance of the RectangleF structure with the specified location and size.

Parameters:
location - A PointF that represents the upper-left corner of the rectangular region.
size - A SizeF that represents the width and height of the rectangular region.
Method Detail

clone

public java.lang.Object clone()

Clone

public RectangleF Clone()

CloneTo

public void CloneTo(RectangleF that)

contains

public boolean contains(float x,
                        float y)

Determines if the specified point is contained within this RectangleF structure.

Parameters:
x - The x-coordinate of the point to test.
y - The y-coordinate of the point to test.
Returns:
This method returns true if the point defined by x and y is contained within this RectangleF structure; otherwise false.

contains

public boolean contains(PointF point)

Determines if the specified point is contained within this RectangleF structure.

Parameters:
point - The PointF to test.
Returns:
This method returns true if the point represented by the point parameter is contained within this RectangleF structure; otherwise false.

contains

public boolean contains(RectangleF rect)

Determines if the rectangular region represented by rect is entirely contained within this RectangleF structure.

Parameters:
rect - The RectangleF to test.
Returns:
This method returns true if the rectangular region represented by rect is entirely contained within the rectangular region represented by this RectangleF; otherwise false.

equals

public boolean equals(java.lang.Object obj)

Tests whether obj is a RectangleF with the same location and size of this RectangleF.

Parameters:
obj - The System.Object to test.
Returns:
This method returns true if obj is a RectangleF and its X, Y, Width, and Height properties are equal to the corresponding properties of this RectangleF; otherwise, false.

equals

public static boolean equals(RectangleF obj1,
                             RectangleF obj2)

fromLeftTopRightBottom

public static RectangleF fromLeftTopRightBottom(float left,
                                                float top,
                                                float right,
                                                float bottom)

Creates a RectangleF structure with upper-left corner and lower-right corner at the specified locations.

Parameters:
left - The x-coordinate of the upper-left corner of the rectangular region.
top - The y-coordinate of the upper-left corner of the rectangular region.
right - The x-coordinate of the lower-right corner of the rectangular region.
bottom - The y-coordinate of the lower-right corner of the rectangular region.
Returns:
The new RectangleF that this method creates.

fromPoints

public static RectangleF fromPoints(PointF point1,
                                    PointF point2)

Creates a new Rectangle froms two points specified. Two verticles of the created Rectangle will be equal to the passed point1 and point2. These would be typically the opposite vertices.

Parameters:
point1 - The first Point for the new rectangle.
point2 - The second Point for the new rectangle.
Returns:
A newly created Rectangle.

getBottom

public float getBottom()

Gets the y-coordinate that is the sum of RectangleF.Y and RectangleF.Height of this RectangleF structure.

Returns:
The y-coordinate that is the sum of RectangleF.Y and RectangleF.Height of this RectangleF structure.

getEmpty

public static RectangleF getEmpty()

Gets a new instance of the RectangleF structure that has RectangleF.X, RectangleF.Y, RectangleF.Width and RectangleF.Height values set to zero.


getHeight

public float getHeight()

Gets the height of this RectangleF structure.

Returns:
The height of this RectangleF structure.

getLeft

public float getLeft()

Gets the x-coordinate of the left edge of this RectangleF structure.

Returns:
The x-coordinate of the left edge of this RectangleF structure.

getLocation

public PointF getLocation()

Gets the coordinates of the upper-left corner of this RectangleF structure.

Returns:
A PointF that represents the upper-left corner of this RectangleF structure.

getRight

public float getRight()

Gets the x-coordinate that is the sum of RectangleF.X and RectangleF.Width of this RectangleF structure.

Returns:
The x-coordinate that is the sum of RectangleF.X and RectangleF.Width of this RectangleF structure.

getSize

public SizeF getSize()

Gets the size of this RectangleF.

Returns:
A SizeF that represents the width and height of this RectangleF structure.

getTop

public float getTop()

Gets the y-coordinate of the top edge of this RectangleF structure.

Returns:
The y-coordinate of the top edge of this RectangleF structure.

getWidth

public float getWidth()

Gets the width of this RectangleF structure.

Returns:
The width of this RectangleF structure.

getX

public float getX()

Gets the x-coordinate of the upper-left corner of this RectangleF structure.

Returns:
The x-coordinate of the upper-left corner of this RectangleF structure.

getY

public float getY()

Gets the y-coordinate of the upper-left corner of this RectangleF structure.

Returns:
The y-coordinate of the upper-left corner of this RectangleF structure.

hashCode

public int hashCode()

Gets the hash code for this RectangleF structure.

Returns:
The hash code for this RectangleF.

inflate

public void inflate(float x,
                    float y)

Inflates this RectangleF structure by the specified amount.

Parameters:
x - The amount to inflate this RectangleF structure horizontally.
y - The amount to inflate this RectangleF structure vertically.

inflate

public static RectangleF inflate(RectangleF rect,
                                 float x,
                                 float y)

Creates and returns an inflated copy of the specified RectangleF structure. The copy is inflated by the specified amount. The original rectangle remains unmodified.

Parameters:
rect - The RectangleF to be copied. This rectangle is not modified.
x - The amount to inflate the copy of the rectangle horizontally.
y - The amount to inflate the copy of the rectangle vertically.
Returns:
The inflated RectangleF.

inflate

public void inflate(SizeF size)

Inflates this RectangleF by the specified amount.

Parameters:
size - The amount to inflate this rectangle.

intersect

public void intersect(RectangleF rect)

Replaces this RectangleF structure with the intersection of itself and the specified RectangleF structure.

Parameters:
rect - The rectangle to intersect.

intersect

public static RectangleF intersect(RectangleF a,
                                   RectangleF b)

Returns a RectangleF structure that represents the intersection of two rectangles. If there is no intersection, and empty RectangleF is returned.

Parameters:
a - A first rectangle to intersect.
b - A second rectangle to intersect.
Returns:
A third RectangleF structure the size of which represents the overlapped area of the two specified rectangles.

intersectsWith

public boolean intersectsWith(RectangleF rect)

Determines if this rectangle intersects with rect.

Parameters:
rect - The rectangle to test.
Returns:
This method returns true if there is any intersection.

isEmpty

public boolean isEmpty()

Gets a value indicating whether the RectangleF.Width or RectangleF.Height property of this RectangleF has a value of zero.

Returns:
This property returns true if the RectangleF.Width or RectangleF.Height property of this RectangleF has a value of zero; otherwise, false.

normalize

public void normalize()

Normalizes the rectangle by making it's width and height positive, left less than right and top less than bottom.


offset

public void offset(float x,
                   float y)

Adjusts the location of this rectangle by the specified amount.

Parameters:
x - The amount to offset the location horizontally.
y - The amount to offset the location vertically.

offset

public void offset(PointF pos)

Adjusts the location of this rectangle by the specified amount.

Parameters:
pos - The amount to offset the location.

op_Equality

public static boolean op_Equality(RectangleF left,
                                  RectangleF right)

Tests whether two RectangleF structures have equal location and size.

Parameters:
left - The RectangleF structure that is to the left of the equality operator.
right - The RectangleF structure that is to the right of the equality operator.
Returns:
This operator returns true if the two specified RectangleF structures have equal RectangleF.X, RectangleF.Y, RectangleF.Width, and RectangleF.Height properties.

op_Inequality

public static boolean op_Inequality(RectangleF left,
                                    RectangleF right)

Tests whether two RectangleF structures differ in location or size.

Parameters:
left - The RectangleF structure that is to the left of the inequality operator.
right - The RectangleF structure that is to the right of the inequality operator.
Returns:
This operator returns true if any of the RectangleF.X , RectangleF.Y, RectangleF.Width, or RectangleF.Height properties of the two RectangleF structures are unequal; otherwise false.

setBottom

public void setBottom(float value)

Sets the y-coordinate that is the sum of RectangleF.Y and RectangleF.Height of this RectangleF structure.


setHeight

public void setHeight(float value)

Sets the height of this RectangleF structure.


setLeft

public void setLeft(float value)

Sets the x-coordinate of the left edge of this RectangleF structure.


setLocation

public void setLocation(PointF value)

Sets the coordinates of the upper-left corner of this RectangleF structure.


setRight

public void setRight(float value)

Sets the x-coordinate that is the sum of RectangleF.X and RectangleF.Width of this RectangleF structure.


setSize

public void setSize(SizeF value)

Gets the size of this RectangleF.


setTop

public void setTop(float value)

Sets the y-coordinate of the top edge of this RectangleF structure.


setWidth

public void setWidth(float value)

Sets the width of this RectangleF structure.


setX

public void setX(float value)

Sets the x-coordinate of the upper-left corner of this RectangleF structure.


setY

public void setY(float value)

Sets the y-coordinate of the upper-left corner of this RectangleF structure.


toRectangleF

public static RectangleF toRectangleF(Rectangle rect)

Converts the specified Rectangle structure to a RectangleF structure.

Parameters:
rect - The Rectangle structure to convert.
Returns:
The RectangleF structure that is converted from the specified Rectangle structure.

toString

public java.lang.String toString()

Converts the attributes of this RectangleF to a human-readable string.

Returns:
A string that contains the position, width, and height of this RectangleF structure.

union

public static RectangleF union(RectangleF a,
                               RectangleF b)

Creates the smallest possible third rectangle that can contain both of two rectangles that form a union.

Parameters:
a - A first rectangle to union.
b - A second rectangle to union.
Returns:
A third RectangleF structure that contains both of the two rectangles that form the union.