CGRect


Function Summary
BOOLCGRectContainsRect(lhsRect, rhsRect)
          Returns a BOOL indicating whether CGRect lhsRect contains CGRect rhsRect.
BOOLCGRectIntersectsRect(lhsRect, rhsRect)
          Returns YES if the two rectangles intersect.
CGRectCGRectIntegral(aRect)
          Makes the origin and size of a CGRect all integers.
CGRectCGRectIntersection(lhsRect, rhsRect)
          Returns the intersection of the two provided rectangles as a new rectangle.
CGRectCPRectInset(aRect, dX, dY)
          Makes a CGRect with an origin and size equal to aRect less the dX/dY insets specified.
CGRectCPRectIntersection(lhsRect, rhsRect)
          Returns the intersection of the two provided rectangles as a new rectangle.
CGRectCPRectCreateCopy(aRect)
          Creates a copy of the provided rectangle.
CGRectCPRectMake(x, y, width, height)
          Returns a CGRect made of the specified arguments.
CGRectCPRectOffset(aRect, dX, dY)
          Creates a new rectangle with its origin offset by dX and dY.
CGRectCPRectStandardize(aRect)
CGRectCPRectUnion(lhsRect, rhsRect)
          Returns the smallest rectangle that can contain the two argument CGRects.
BOOLCPRectContainsPoint(aRect, aPoint)
          Returns YES if the CGRect, aRect, contains the CGPoint, aPoint.
BOOLCPRectContainsRect(lhsRect, rhsRect)
          Returns a BOOL indicating whether CGRect possibleOuter contains CGRect possibleInner.
BOOLCPRectEqualToRect(lhsRect, rhsRect)
          Test whether the two CGRects have the same origin and size.
intCPRectGetHeight(aRect)
intCPRectGetMaxX(aRect)
intCPRectGetMaxY(aRect)
floatCPRectGetMidX(aRect)
floatCPRectGetMidY(aRect)
intCPRectGetMinX(aRect)
intCPRectGetMinY(aRect)
intCPRectGetWidth(aRect)
BOOLCPRectIntersectsRect(lhsRect, rhsRect)
          Returns YES if the two rectangles intersect.
BOOLCPRectIsEmpty(aRect)
          Returns YES if the CGRect has no area.
BOOLCPRectIsNull(aRect)
          Returns YES if the CGRect has no area.
CGStringCPStringFromRect(aRect)
          Returns a human readable string of the provided CGRect.
CGRectCPRectFromString(aString)
          Returns a CGRect created from a string.
CGRectCPRectMakeZero()
          Returns a rectangle at origin (0,0) and size of (0,0).

Function Detail

CGRectContainsRect

function CGRectContainsRect(lhsRect, rhsRect)
Returns a BOOL indicating whether CGRect lhsRect contains CGRect rhsRect.
Arguments
lhsRect - the CGRect to test if rhsRect is inside of
rhsRect - the CGRect to test if it fits inside lhsRect.
Returns:
YES if rhsRect fits inside lhsRect.

CGRectIntersectsRect

function CGRectIntersectsRect(lhsRect, rhsRect)
Returns YES if the two rectangles intersect
Arguments
lhsRect - the first CGRect
rhsRect - the second CGRect
Returns:
YES if the two rectangles have any common spaces, and NO, otherwise.

CGRectIntegral

function CGRectIntegral(aRect)
Makes the origin and size of a CGRect all integers. Specifically, by making the southwest corner the origin (rounded down), and the northeast corner a CGSize (rounded up).
Arguments
aRect - the rectangle to operate on
Returns:
the modified rectangle (same as the input)

CGRectIntersection

function CGRectIntersection(lhsRect, rhsRect)
Returns the intersection of the two provided rectangles as a new rectangle.
Arguments
lhsRect - the first rectangle used for calculation
rhsRect - the second rectangle used for calculation
Returns:
the intersection of the two rectangles

CPRectInset

function CPRectInset(aRect, dX, dY)
Makes a CGRect with an origin and size equal to aRect less the dX/dY insets specified.
Arguments
aRect
dX - the size of the inset in the x-axis
dY - the size of the inset in the y-axis
Returns:
a rectangle like aRect with an inset

CPRectIntersection

function CPRectIntersection(lhsRect, rhsRect)
Returns the intersection of the two provided rectangles as a new rectangle
Arguments
lhsRect - the first rectangle used for calculation
rhsRect - the second rectangle used for calculation
Returns:
the intersection of the two rectangles

CPRectCreateCopy

function CPRectCreateCopy(aRect)
Creates a copy of the provided rectangle
Arguments
aRect - the CGRect that will be copied
Returns:
the rectangle copy

CPRectMake

function CPRectMake(x, y, width, height)
Returns a CGRect made of the specified arguments
Arguments
x - the x-coordinate of the rectangle's origin
y - the y-coordinate of the rectangle's origin
width - the width of the new rectangle
height - the height of the new rectangle
Returns:
the new rectangle

CPRectOffset

function CPRectOffset(aRect, dX, dY)
Creates a new rectangle with its origin offset by dX and dY.
Arguments
aRect - the rectangle to copy the origin and size from
dX - the amount added to the x-size of the new rectangle
dY - the amount added to the y-size of the new rectangle
Returns:
the new rectangle with modified size

CPRectStandardize

function CPRectStandardize(aRect)
Arguments
aRect - a CGRect

CPRectUnion

function CPRectUnion(lhsRect, rhsRect)
Returns the smallest rectangle that can contain the two argument CGRects.
Arguments
lhsRect - the first CGRect to use for the union calculation
rhsRect - the second CGRect to use for the union calculation
Returns:
the union rectangle

CPRectContainsPoint

function CPRectContainsPoint(aRect, aPoint)
Returns YES if the CGRect, aRect, contains the CGPoint, aPoint.
Arguments
aRect - the rectangle to test with
aPoint - the point to test with
Returns:
YES if the rectangle contains the point, NO otherwise.

CPRectContainsRect

function CPRectContainsRect(lhsRect, rhsRect)
Returns a BOOL indicating whether CGRect possibleOuter contains CGRect possibleInner.
Arguments
lhsRect
rhsRect
Returns:
YES if possibleInner fits inside possibleOuter.

CPRectEqualToRect

function CPRectEqualToRect(lhsRect, rhsRect)
Test whether the two CGRects have the same origin and size
Arguments
lhsRect - the first CGRect to compare
rhsRect - the second CGRect to compare
Returns:
YES if the two rectangles have the same origin and size. NO, otherwise.

CPRectGetHeight

function CPRectGetHeight(aRect)
Arguments
aRect - a CGRect

CPRectGetMaxX

function CPRectGetMaxX(aRect)
Arguments
aRect - a CGRect

CPRectGetMaxY

function CPRectGetMaxY(aRect)
Arguments
aRect - a CGRect

CPRectGetMidX

function CPRectGetMidX(aRect)
Arguments
aRect - a CGRect

CPRectGetMidY

function CPRectGetMidY(aRect)
Arguments
aRect - a CGRect

CPRectGetMinX

function CPRectGetMinX(aRect)
Arguments
aRect - a CGRect

CPRectGetMinY

function CPRectGetMinY(aRect)
Arguments
aRect - a CGRect

CPRectGetWidth

function CPRectGetWidth(aRect)
Arguments
aRect - a CGRect

CPRectIntersectsRect

function CPRectIntersectsRect(lhsRect, rhsRect)
Returns YES if the two rectangles intersect
Arguments
lhsRect - the first CGRect
rhsRect - the second CGRect
Returns:
YES if the two rectangles have any common spaces, and NO, otherwise.

CPRectIsEmpty

function CPRectIsEmpty(aRect)
Returns YES if the CGRect has no area. The test is performed by checking if the width and height are both zero.
Arguments
aRect - the CGRect to test
Returns:
YES if the CGRect has no area, and NO, otherwise.

CPRectIsNull

function CPRectIsNull(aRect)
Returns YES if the CGRect has no area. The test is performed by checking if the width and height are both zero.
Arguments
aRect
Returns:
YES if the CGRect has no area, and NO, otherwise.

CPStringFromRect

function CPStringFromRect(aRect)
Returns a human readable string of the provided CGRect.
Arguments
aRect - the rectangle to represent
Returns:
the string representation of the rectangle

CPRectFromString

function CPRectFromString(aString)
Returns a CGRect created from a string.
Arguments
aString - a string in the form generated by CPStringFromRect
Returns:
the rectangle created from the string

CPRectMakeZero

function CPRectMakeZero()
Returns a rectangle at origin (0,0) and size of (0,0).
Returns:
a zeroed out CGRect