Class: Png2swf::DefineBitsLossless2

Inherits:
Object
  • Object
show all
Extended by:
OilyPng2swf::DefineBitsLossless2
Defined in:
lib/png2swf/define_bits_lossless2.rb

Class Method Summary collapse

Methods included from OilyPng2swf::DefineBitsLossless2

bitmap_data

Class Method Details

.image2data(image) ⇒ Object



17
18
19
20
# File 'lib/png2swf/define_bits_lossless2.rb', line 17

def self.image2data image
  zlib_bitmap_data = Zlib::Deflate.deflate(bitmap_data(image.pixels))
  ::Base64.encode64(zlib_bitmap_data).split.join
end

.image2data_from_blob(blob) ⇒ Object



13
14
15
# File 'lib/png2swf/define_bits_lossless2.rb', line 13

def self.image2data_from_blob blob
  image2data(ChunkyPNG::Image.from_blob(blob))
end

.image2data_from_file(filepath) ⇒ Object



9
10
11
# File 'lib/png2swf/define_bits_lossless2.rb', line 9

def self.image2data_from_file filepath
  image2data(ChunkyPNG::Image.from_file(filepath))
end