Class: Imogen::Iiif::Transform

Inherits:
Object
  • Object
show all
Defined in:
lib/imogen/iiif.rb

Direct Known Subclasses

Region, Region::Featured, Rotation, Size

Instance Method Summary collapse

Constructor Details

#initialize(src) ⇒ Transform

Returns a new instance of Transform.



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/imogen/iiif.rb', line 5

def initialize(src)
  @width = 0
  @height = 0
  if src.respond_to? :width and src.respond_to? :height
    img = src
    @width = src.width
    @height = src.height
  else
    raise "#{src.class.name} does not report width and height"
  end
end

Instance Method Details

#max(x, y) ⇒ Object



16
17
18
# File 'lib/imogen/iiif.rb', line 16

def max(x,y)
  (x > y) ? x : y
end

#min(x, y) ⇒ Object



19
20
21
# File 'lib/imogen/iiif.rb', line 19

def min(x,y)
  (x < y) ? x : y
end