Class: MineSkin::Preview::Cape2D

Inherits:
Object
  • Object
show all
Includes:
Compositor, Unit
Defined in:
lib/mineskin/preview/cape2d.rb

Instance Method Summary collapse

Methods included from Compositor

#composite_texture!, #resize

Methods included from Unit

#image_unit

Constructor Details

#initialize(cape_data) ⇒ Cape2D

Returns a new instance of Cape2D.



9
10
11
# File 'lib/mineskin/preview/cape2d.rb', line 9

def initialize(cape_data)
  @cape_data = cape_data
end

Instance Method Details

#render(width, background: 'white') ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/mineskin/preview/cape2d.rb', line 13

def render(width, background: 'white')
  @unit = image_unit size: width, count: 40
  @image = Magick::Image.new(width, 65 * width / 100) do
    self.background_color = background
  end
  render_cape!
  @image
end