Sha256: ba5a4a9eb89b6a379b5c48861605a52e5ed157d1549216e324d013f4dff13d3f

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

class CGSize

  def half_width
    width / 2
  end

  def double_width
    width * 2
  end

  def half_height
    height / 2
  end

  def double_height
    height * 2
  end

  def from_pixel_coordinates
    CGSizeMake(self.width.from_pixels, self.height.from_pixels)
  end

  def to_pixel_coordinates
    CGSizeMake(self.width.to_pixels, self.height.to_pixels)
  end

  def half
    self / 2
  end

  def /(other)
    case other
    when Numeric
      return CGSizeMake(self.width / other, self.height / other)
    when CGSizeMake
      return CGSizeMake(self.width / other.width, self.height / other.height)
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joybox-1.1.1 motion/joybox/common/cg_size.rb
joybox-1.1.0 motion/joybox/common/cg_size.rb