Class: ChunkyPNG::Chunk::ImageData
- Defined in:
- lib/chunky_png/chunk.rb
Instance Attribute Summary
Attributes inherited from Generic
Attributes inherited from Base
Class Method Summary collapse
- .combine_chunks(data_chunks) ⇒ Object
- .split_in_chunks(data, level = Zlib::DEFAULT_COMPRESSION, chunk_size = 2147483647) ⇒ Object
Methods inherited from Generic
Methods inherited from Base
#initialize, #write, #write_with_crc
Constructor Details
This class inherits a constructor from ChunkyPNG::Chunk::Generic
Class Method Details
.combine_chunks(data_chunks) ⇒ Object
253 254 255 256 257 258 259 |
# File 'lib/chunky_png/chunk.rb', line 253 def self.combine_chunks(data_chunks) zstream = Zlib::Inflate.new data_chunks.each { |c| zstream << c.content } inflated = zstream.finish zstream.close inflated end |
.split_in_chunks(data, level = Zlib::DEFAULT_COMPRESSION, chunk_size = 2147483647) ⇒ Object
261 262 263 264 265 |
# File 'lib/chunky_png/chunk.rb', line 261 def self.split_in_chunks(data, level = Zlib::DEFAULT_COMPRESSION, chunk_size = 2147483647) streamdata = Zlib::Deflate.deflate(data, level) # TODO: Split long streamdata over multiple chunks [ChunkyPNG::Chunk::ImageData.new("IDAT", streamdata)] end |