class Castaway::RelativeTo

Public Class Methods

new(image_file_name, production) click to toggle source
# File lib/castaway/relative_to.rb, line 6
def initialize(image_file_name, production)
  path = production.resource(image_file_name)
  image = MiniMagick::Image.new(path)
  @width = image.width.to_f
  @height = image.height.to_f
  @production = production
end

Public Instance Methods

position(x, y) click to toggle source
# File lib/castaway/relative_to.rb, line 14
def position(x, y)
  Castaway::Point.new(x / @width, y / @height) * @production.resolution
end