Includes some methods to the RubyMotion's CGSize class to improve the arithmetic operations performed usually on the Layers and Sprites.
When needed an Array can be converted to a Size, using the 'to_size' method. For more information see the Array documentation page.
Returns the Size divided by two:
# The following is [150, 100] [300, 200].to_size.half
Returns the Size width divided by two:
# The following is 150 [300, 200].to_size.half_width
Returns the Size width multiplied by two:
# The following is 200 [100, 300].to_size.double_width
Divides the Size height by two:
# The following is 100 [300, 200].to_size.half_height
Multiplies the Size height by two:
# The following is 600 [100, 300].to_size.double_height
From Pixel Coordinates
Converts the Size from Pixel coordinates to Metric coordinates:
To Pixel Coordinates
Converts the Size from Metric coordinates to Pixel coordinates: