CamelBones::NSSize
A CamelBones::NSSize object represents a two-dimensional size. It has width and height properties, both of which are floating point numbers.
Methods
- getWidth()
- Returns the value of the width property.
- getHeight()
- Returns the value of the height property.
- setWidth($newWidth)
- Stores the value of $newWidth in the width property.
- setHeight($newHeight)
- Stores the value of $newHeight in the height property.
- setAll($newWidth, $newHeight)
- Stores the value of $newWidth and $newHeight in the width and height properties, respectively.
- $hr = getHashref()
- Returns the size data as a reference to a hash with keys 'width' and 'height'.
- $ar = getArrayref()
- Returns the size data as an array reference. Properties are stored in the array in the order width, height.
Functions
- $isEQ = NSEqualSizes($size1, $size2)
- Returns true if both width and height properties are the same for both sizes, false if not.
- $size = NSMakeSize($newWidth, $newHeight)
- Creates a new NSSize structure with the specified properties.
- $size = NSSizeFromString($str)
- Creates a new NSSize structure from the string representation in $str.
- $str = NSStringFromSize($size)
- Returns a string representation of $size
NSSize function and method arguments
Naturally, a function or method that is declared as taking an NSSize structure as an argument will also take a CamelBones::NSSize object. However, a hash or array reference may be passed as well, as illustrated by these examples:
# Create a CamelBones::NSSize object my $size = NSMakeSize(1.0, 1.0); # Returns zero my $isEQ = NSEqualSizes($size, { width => 1.0, height => 5.0 } ); # Returns nonzero my $isEQ = NSEqualSizes($size, [1.0, 1.0]);
NSSize return values
Cocoa functions and methods that are declared as returning NSSize structures will return CamelBones::NSSize objects to Perl.