class ChunkyPNG::Chunk::CompressedText
The CompressedText
(zTXt) chunk contains keyword/value metadata about the PNG stream. In this chunk, the value is compressed using Deflate compression.
@see www.w3.org/TR/PNG/#11zTXt @see ChunkyPNG::Chunk::CompressedText
@see ChunkyPNG::Chunk::InternationalText
Attributes
keyword[RW]
value[RW]
Public Class Methods
new(keyword, value)
click to toggle source
Calls superclass method
ChunkyPNG::Chunk::Base::new
# File lib/chunky_png/chunk.rb 334 def initialize(keyword, value) 335 super("zTXt") 336 @keyword, @value = keyword, value 337 end
read(type, content)
click to toggle source
# File lib/chunky_png/chunk.rb 339 def self.read(type, content) 340 keyword, compression, value = content.unpack("Z*Ca*") 341 raise ChunkyPNG::NotSupported, "Compression method #{compression.inspect} not supported!" unless compression == ChunkyPNG::COMPRESSION_DEFAULT 342 new(keyword, Zlib::Inflate.inflate(value)) 343 end
Public Instance Methods
content()
click to toggle source
Creates the content to write to the stream, by concatenating the keyword with the deflated value, joined by a null character.
@return The content that should be written to the datastream.
# File lib/chunky_png/chunk.rb 349 def content 350 [ 351 keyword, 352 ChunkyPNG::COMPRESSION_DEFAULT, 353 Zlib::Deflate.deflate(value), 354 ].pack("Z*Ca*") 355 end