Class: Spritely::Generators::ChunkyPng
- Inherits:
-
Base
- Object
- Struct
- Base
- Spritely::Generators::ChunkyPng
show all
- Defined in:
- lib/spritely/generators/chunky_png.rb
Instance Attribute Summary
Attributes inherited from Base
#sprite_map
Instance Method Summary
collapse
Methods inherited from Base
create!, #ensure_directory_exists!
Instance Method Details
#build! ⇒ Object
7
8
9
10
11
12
|
# File 'lib/spritely/generators/chunky_png.rb', line 7
def build!
sprite_map.images.each do |image|
png = ::ChunkyPNG::Image.from_blob(image.data)
canvas.replace!(png, image.left, image.top)
end
end
|
#save! ⇒ Object
14
15
16
17
|
# File 'lib/spritely/generators/chunky_png.rb', line 14
def save!
canvas.metadata['cache_key'] = sprite_map.cache_key
canvas.save(sprite_map.filename, :fast_rgba)
end
|