ChunkyPNG::Chunk::Text

The Text (tEXt) chunk contains keyword/value metadata about the PNG stream. In this chunk, the value is stored uncompressed.

The tEXt chunk only supports Latin-1 encoded textual data. If you need UTF-8 support, check out the InternationalText chunk type.

@see ChunkyPNG::Chunk::CompressedText @see ChunkyPNG::Chunk::InternationalText

Attributes

keyword[RW]
value[RW]

Public Class Methods

new(keyword, value) click to toggle source
# File lib/chunky_png/chunk.rb, line 252
def initialize(keyword, value)
  super('tEXt')
  @keyword, @value = keyword, value
end
read(type, content) click to toggle source
# File lib/chunky_png/chunk.rb, line 257
def self.read(type, content)
  keyword, value = content.unpack('Z*a*')
  new(keyword, value)
end

Public Instance Methods

content() click to toggle source

Creates the content to write to the stream, by concatenating the keyword with the value, joined by a null character.

@return The content that should be written to the datastream.

# File lib/chunky_png/chunk.rb, line 266
def content
  [keyword, value].pack('Z*a*')
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.