Class: Phantom::SVG::Parser::PNGWriter

Inherits:
AbstractImageWriter show all
Defined in:
lib/phantom/parser/png_writer.rb

Overview

Image writer.

Instance Method Summary collapse

Methods inherited from AbstractImageWriter

#initialize

Constructor Details

This class inherits a constructor from Phantom::SVG::Parser::AbstractImageWriter

Instance Method Details

#write(path, object) ⇒ Object

Write png file from object to path. Return write size.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/phantom/parser/png_writer.rb', line 16

def write(path, object)
  return 0 if path.nil? || path.empty? || object.nil?

  object.set_size

  apngasm = APNG::APNGAsm.new
  convert_frames(apngasm, object)
  result = apngasm.assemble(path)

  result
end