Class: Pixitar::Image
- Inherits:
-
Object
- Object
- Pixitar::Image
- Defined in:
- lib/pixitar.rb
Instance Attribute Summary collapse
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#image_lib ⇒ Object
readonly
Returns the value of attribute image_lib.
Instance Method Summary collapse
- #compose(filename) ⇒ Object
-
#initialize(image_lib = ChunkyPNG::Image, height = 400, width = 400) ⇒ Image
constructor
A new instance of Image.
- #save(filename) ⇒ Object
Constructor Details
#initialize(image_lib = ChunkyPNG::Image, height = 400, width = 400) ⇒ Image
Returns a new instance of Image.
9 10 11 12 |
# File 'lib/pixitar.rb', line 9 def initialize(image_lib = ChunkyPNG::Image, height = 400, width = 400) @image_lib = image_lib @image = image_lib.new(height, width) end |
Instance Attribute Details
#image ⇒ Object (readonly)
Returns the value of attribute image.
7 8 9 |
# File 'lib/pixitar.rb', line 7 def image @image end |
#image_lib ⇒ Object (readonly)
Returns the value of attribute image_lib.
6 7 8 |
# File 'lib/pixitar.rb', line 6 def image_lib @image_lib end |
Instance Method Details
#compose(filename) ⇒ Object
14 15 16 17 |
# File 'lib/pixitar.rb', line 14 def compose(filename) canvas = image_lib.from_file(filename) image.compose!(canvas, 0, 0) end |
#save(filename) ⇒ Object
19 20 21 |
# File 'lib/pixitar.rb', line 19 def save(filename) image.save(filename, interlace: true) end |