Class: SugarCube::CoreGraphics::Size

Inherits:
Array
  • Object
show all
Includes:
SugarCube::CGSizeExtensions
Defined in:
lib/sugarcube/core_graphics.rb

Instance Method Summary collapse

Methods included from SugarCube::CGSizeExtensions

#==, included, #infinite?, #inspect, #to_hash, #to_s

Methods inherited from Array

#to_pointer

Instance Method Details

#+(size) ⇒ Object

adds the sizes



326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/sugarcube/core_graphics.rb', line 326

def +(size)
  case size
  when Size, CGSize
    width = self.width + size.width
    height = self.height + size.height
    Size[width, height]
  when Point, CGPoint
    Rect[size, self]
  else
    super
  end
end

#heightObject



317
318
319
# File 'lib/sugarcube/core_graphics.rb', line 317

def height
  return self[1]
end

#height=(val) ⇒ Object



321
322
323
# File 'lib/sugarcube/core_graphics.rb', line 321

def height= val
  self[1] = val
end

#widthObject



309
310
311
# File 'lib/sugarcube/core_graphics.rb', line 309

def width
  return self[0]
end

#width=(val) ⇒ Object



313
314
315
# File 'lib/sugarcube/core_graphics.rb', line 313

def width= val
  self[0] = val
end