Class: MineSkin::Preview::Skin2D
- Inherits:
-
Object
- Object
- MineSkin::Preview::Skin2D
- Includes:
- Compositor, Unit
- Defined in:
- lib/mineskin/preview/skin2d.rb
Overview
2D preview of skin
Instance Method Summary collapse
-
#initialize(skin_data) ⇒ Skin2D
constructor
Initializes object with skin data.
-
#render(width, background: 'white') ⇒ Magick::Image
Renders preview.
Methods included from Compositor
Methods included from Unit
Constructor Details
#initialize(skin_data) ⇒ Skin2D
Initializes object with skin data
13 14 15 |
# File 'lib/mineskin/preview/skin2d.rb', line 13 def initialize(skin_data) @skin_data = skin_data end |
Instance Method Details
#render(width, background: 'white') ⇒ Magick::Image
Renders preview
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mineskin/preview/skin2d.rb', line 21 def render(width, background: 'white') @unit = image_unit size: width, count: 12 @image = Magick::Image.new(width, 5 * width / 6) do self.background_color = background end render_head! render_body! render_legs! render_arms! @image end |