Class: ChunkyPNG::Chunk::ImageData

Inherits:
Generic show all
Defined in:
lib/chunky_png/chunk.rb

Instance Attribute Summary

Attributes inherited from Generic

#content

Attributes inherited from Base

#type

Class Method Summary (collapse)

Methods inherited from Generic

#initialize, read

Methods inherited from Base

#initialize, #write, #write_with_crc

Constructor Details

This class inherits a constructor from ChunkyPNG::Chunk::Generic

Class Method Details

+ (Object) combine_chunks(data_chunks)



247
248
249
# File 'lib/chunky_png/chunk.rb', line 247

def self.combine_chunks(data_chunks)
  Zlib::Inflate.inflate(data_chunks.map { |c| c.content }.join(''))
end

+ (Object) split_in_chunks(data, level = Zlib::DEFAULT_COMPRESSION, chunk_size = 2147483647)



251
252
253
254
255
# File 'lib/chunky_png/chunk.rb', line 251

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