Class: PNG::IDAT
Instance Method Summary collapse
- #<<(data) ⇒ Object
- #chunk_name ⇒ Object
- #encode ⇒ Object
-
#initialize(uncompressed = "") ⇒ IDAT
constructor
I don’t like that @compressed contains different values depending on how you’re using it maybe we should introduce a builder?.
- #uncompressed ⇒ Object
Methods inherited from Chunk
Constructor Details
#initialize(uncompressed = "") ⇒ IDAT
I don’t like that @compressed contains different values depending on how you’re using it maybe we should introduce a builder?
5 6 7 8 |
# File 'lib/spittle/png/idat.rb', line 5 def initialize( uncompressed="" ) @compressed = "" @compressed += Zlib::Deflate.deflate( uncompressed.pack("C*") ) unless uncompressed == "" end |
Instance Method Details
#<<(data) ⇒ Object
10 11 12 |
# File 'lib/spittle/png/idat.rb', line 10 def <<( data ) @compressed << data end |
#chunk_name ⇒ Object
22 23 24 |
# File 'lib/spittle/png/idat.rb', line 22 def chunk_name "IDAT" end |
#encode ⇒ Object
14 15 16 |
# File 'lib/spittle/png/idat.rb', line 14 def encode @compressed end |
#uncompressed ⇒ Object
18 19 20 |
# File 'lib/spittle/png/idat.rb', line 18 def uncompressed @uncompressed ||= Zlib::Inflate.inflate( @compressed ).unpack("C*") end |