Skip to content

Commit

Permalink
[core] Add NIRectExpand.
Browse files Browse the repository at this point in the history
  • Loading branch information
jverkoey committed Oct 22, 2012
1 parent be3ebee commit da8a358
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/core/src/NIFoundationMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ extern "C" {
*/
CGRect NIRectContract(CGRect rect, CGFloat dx, CGFloat dy);

/**
* Modifies only the right and bottom edges of a CGRect.
*
* @return a CGRect with dx and dy added to the width and height.
*
* Example result: CGRectMake(x, y, w + dx, h + dy)
*/
CGRect NIRectExpand(CGRect rect, CGFloat dx, CGFloat dy);

/**
* Modifies only the top and left edges of a CGRect.
*
Expand Down
6 changes: 6 additions & 0 deletions src/core/src/NIFoundationMethods.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ CGRect NIRectContract(CGRect rect, CGFloat dx, CGFloat dy) {
}


///////////////////////////////////////////////////////////////////////////////////////////////////
CGRect NIRectExpand(CGRect rect, CGFloat dx, CGFloat dy) {
return CGRectMake(rect.origin.x, rect.origin.y, rect.size.width + dx, rect.size.height + dy);
}


///////////////////////////////////////////////////////////////////////////////////////////////////
CGRect NIRectShift(CGRect rect, CGFloat dx, CGFloat dy) {
return CGRectOffset(NIRectContract(rect, dx, dy), dx, dy);
Expand Down

0 comments on commit da8a358

Please sign in to comment.