MBMLGeometryFunctions Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | MBMLGeometryFunctions.h |
Overview
This class implements MBML functions for working with geometric values.
These functions are exposed to the Mockingbird environment via
<Function ... /> declarations in the MBDataEnvironmentModule.xml
file.
For more information on MBML functions, see the MBMLFunction class.
Accessing components of rectangles
+ rectOrigin:
Returns the origin point of the given rectangle, as a comma-separated string
in the format “x,y”.
+ (id)rectOrigin:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the origin point of the rectangle expressed as a comma-separated string.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.All other cases are considered errors.
Expression usage
^rectOrigin(10,20,80,90)
The expression above would return the string “10,20”.
Declared In
MBMLGeometryFunctions.h
+ rectSize:
Returns the size of the given rectangle, as a comma-separated string
in the format “width,height”.
+ (id)rectSize:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the size of the rectangle expressed as a comma-separated string.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.All other cases are considered errors.
Expression usage
^rectSize(10,20,80,90)
The expression above would return the string “80,90”.
Declared In
MBMLGeometryFunctions.h
+ rectX:
Returns an NSNumber containing the x coordinate of the given rectangle’s
origin point.
+ (id)rectX:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the x coordinate of the rectangle’s origin.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.All other cases are considered errors.
Expression usage
^rectX(10,20,80,90)
The expression above would return the value 10.
Declared In
MBMLGeometryFunctions.h
+ rectY:
Returns an NSNumber containing the y coordinate of the given rectangle’s
origin point.
+ (id)rectY:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the y coordinate of the rectangle’s origin.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.All other cases are considered errors.
Expression usage
^rectY(10,20,80,90)
The expression above would return the value 20.
Declared In
MBMLGeometryFunctions.h
+ rectWidth:
Returns an NSNumber containing the width of the given rectangle.
+ (id)rectWidth:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the width of the rectangle.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.All other cases are considered errors.
Expression usage
^rectWidth(10,20,80,90)
The expression above would return the value 80.
Declared In
MBMLGeometryFunctions.h
+ rectHeight:
Returns an NSNumber containing the height of the given rectangle.
+ (id)rectHeight:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the height of the rectangle.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.All other cases are considered errors.
Expression usage
^rectHeight(10,20,80,90)
The expression above would return the value 90.
Declared In
MBMLGeometryFunctions.h
Adjusting rectangles
+ insetRect:
Adjusts the given rectangle by applying the specified insets to each edge,
and returns the resulting rectangle as a comma-separated string in the
format “origin-x,origin-y,width,height”.
+ (id)insetRect:(NSArray *)paramsParameters
params |
The function’s input parameters. |
|---|
Return Value
A string containing the adjusted rectangle.
Discussion
This Mockingbird function accepts two pipe-separated object expressions as parameters: the source rectangle and the edge insets.
The source rectangle expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.
The edge insets expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
topInset,leftInset,bottomInset,rightInset”.If the expression yields an
NSValue, it is expected to contain aUIEdgeInsetsvalue.
Any other value for either input parameter is considered an error.
Expression usage
^insetRect(10,10,100,100|-5,-5,15,15)
The expression above would return the string “5,5,90,90”.
Declared In
MBMLGeometryFunctions.h
+ insetRectTop:
Adjusts the given rectangle by applying an inset to the top edge, and
returns the resulting rectangle as a comma-separated string in the format
“origin-x,origin-y,width,height”.
+ (id)insetRectTop:(NSArray *)paramsParameters
params |
The function’s input parameters. |
|---|
Return Value
A string containing the adjusted rectangle.
Discussion
This Mockingbird function accepts two pipe-separated expressions as parameters: the source rectangle and the inset amount.
The source rectangle expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.
The inset amount is interpreted as a numeric expression indicating the amount by which the edge of the source rectangle will be adjusted.
A negative inset amount makes the rectangle taller by moving the top edge upwards; a positive value makes the rectangle shorter by lowering the top edge.
Expression usage
^insetRectTop(10,10,100,100|-5)
The expression above would return the string “10,5,100,105”.
Declared In
MBMLGeometryFunctions.h
+ insetRectLeft:
Adjusts the given rectangle by applying an inset to the left edge, and
returns the resulting rectangle as a comma-separated string in the format
“origin-x,origin-y,width,height”.
+ (id)insetRectLeft:(NSArray *)paramsParameters
params |
The function’s input parameters. |
|---|
Return Value
A string containing the adjusted rectangle.
Discussion
This Mockingbird function accepts two pipe-separated expressions as parameters: the source rectangle and the inset amount.
The source rectangle expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.
The inset amount is interpreted as a numeric expression indicating the amount by which the edge of the source rectangle will be adjusted.
A negative inset amount makes the rectangle wider by moving the left edge further leftwards; a positive value makes the rectangle narrower by moving the left edge rightwards.
Expression usage
^insetRectLeft(50,50,50,50|25)
The expression above would return the string “75,50,25,50”.
Declared In
MBMLGeometryFunctions.h
+ insetRectBottom:
Adjusts the given rectangle by applying an inset to the bottom edge, and
returns the resulting rectangle as a comma-separated string in the format
“origin-x,origin-y,width,height”.
+ (id)insetRectBottom:(NSArray *)paramsParameters
params |
The function’s input parameters. |
|---|
Return Value
A string containing the adjusted rectangle.
Discussion
This Mockingbird function accepts two pipe-separated expressions as parameters: the source rectangle and the inset amount.
The source rectangle expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.
The inset amount is interpreted as a numeric expression indicating the amount by which the edge of the source rectangle will be adjusted.
A negative inset amount makes the rectangle taller by moving the bottom edge downwards; a positive value makes the rectangle shorter by raising the bottom edge.
Expression usage
^insetRectBottom(20,20,100,100|25)
The expression above would return the string “20,20,100,75”.
Declared In
MBMLGeometryFunctions.h
+ insetRectRight:
Adjusts the given rectangle by applying an inset to the right edge, and
returns the resulting rectangle as a comma-separated string in the format
“origin-x,origin-y,width,height”.
+ (id)insetRectRight:(NSArray *)paramsParameters
params |
The function’s input parameters. |
|---|
Return Value
A string containing the adjusted rectangle.
Discussion
This Mockingbird function accepts two pipe-separated expressions as parameters: the source rectangle and the inset amount.
The source rectangle expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
origin-x,origin-y,width,height”.If the expression yields an
NSValue, it is expected to contain aCGRectvalue.
The inset amount is interpreted as a numeric expression indicating the amount by which the edge of the source rectangle will be adjusted.
A negative inset amount makes the rectangle larger by moving the right edge further rightwards; a positive value makes the rectangle smaller by moving the right edge leftwards.
Expression usage
^insetRectRight(10,10,50,50|-10)
The expression above would return the string “10,10,60,50”.
Declared In
MBMLGeometryFunctions.h
Accessing the width and height components of sizes
+ sizeWidth:
Returns an NSNumber containing the width component of the given size.
+ (id)sizeWidth:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the width component of the given size.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
width,height”.If the expression yields an
NSValue, it is expected to contain aCGSizevalue.All other cases are considered errors.
Expression usage
^sizeWidth(10,20)
The expression above would return the value 10.
Declared In
MBMLGeometryFunctions.h
+ sizeHeight:
Returns an NSNumber containing the height component of the given size.
+ (id)sizeHeight:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the height component of the given size.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
width,height”.If the expression yields an
NSValue, it is expected to contain aCGSizevalue.All other cases are considered errors.
Expression usage
^sizeHeight(10,20)
The expression above would return the value 20.
Declared In
MBMLGeometryFunctions.h
Accessing the x and y coordinates of points
+ pointX:
Returns an NSNumber containing the x coordinate of the given point.
+ (id)pointX:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the x coordinate of the given point.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
x,y”.If the expression yields an
NSValue, it is expected to contain aCGPointvalue.All other cases are considered errors.
Expression usage
^pointX(10,20)
The expression above would return the value 10.
Declared In
MBMLGeometryFunctions.h
+ pointY:
Returns an NSNumber containing the y coordinate of the given point.
+ (id)pointY:(id)paramParameters
param |
The function’s input parameter. |
|---|
Return Value
The function result, the y coordinate of the given point.
Discussion
This Mockingbird function accepts a single parameter, an object expression
that’s expected to yield an NSString or an NSValue instance. This
expression is interpreted as follows:
If the expression yields a string, it is expected to be a comma-separated string in the format “
x,y”.If the expression yields an
NSValue, it is expected to contain aCGPointvalue.All other cases are considered errors.
Expression usage
^pointY(10,20)
The expression above would return the value 20.
Declared In
MBMLGeometryFunctions.h