Class: Axon::PNGWriter

Inherits:
Object
  • Object
show all
Includes:
PNGNativeWriter
Defined in:
lib/axon/png_writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PNGNativeWriter

#png_native_write

Constructor Details

#initialize(image) ⇒ PNGWriter

Returns a new instance of PNGWriter.



9
10
11
# File 'lib/axon/png_writer.rb', line 9

def initialize(image)
  @image = image
end

Instance Attribute Details

#imageObject (readonly)

Returns the value of attribute image.



7
8
9
# File 'lib/axon/png_writer.rb', line 7

def image
  @image
end

Instance Method Details

#dataObject



17
18
19
20
21
22
23
# File 'lib/axon/png_writer.rb', line 17

def data
  s = StringIO.new
  s.set_encoding 'BINARY' if s.respond_to?(:set_encoding)

  write(s)
  s.string
end

#write(io) ⇒ Object



13
14
15
# File 'lib/axon/png_writer.rb', line 13

def write(io)
  png_native_write(io)
end