Class: ChunkyPNG::Chunk::Text
Overview
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.
Instance Attribute Summary collapse
-
#keyword ⇒ Object
Returns the value of attribute keyword.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#content ⇒ Object
Creates the content to write to the stream, by concatenating the keyword with the value, joined by a null character.
-
#initialize(keyword, value) ⇒ Text
constructor
A new instance of Text.
Methods inherited from Base
Constructor Details
#initialize(keyword, value) ⇒ Text
Returns a new instance of Text.
252 253 254 255 |
# File 'lib/chunky_png/chunk.rb', line 252 def initialize(keyword, value) super('tEXt') @keyword, @value = keyword, value end |
Instance Attribute Details
#keyword ⇒ Object
Returns the value of attribute keyword.
250 251 252 |
# File 'lib/chunky_png/chunk.rb', line 250 def keyword @keyword end |
#value ⇒ Object
Returns the value of attribute value.
250 251 252 |
# File 'lib/chunky_png/chunk.rb', line 250 def value @value end |
Class Method Details
.read(type, content) ⇒ Object
257 258 259 260 |
# File 'lib/chunky_png/chunk.rb', line 257 def self.read(type, content) keyword, value = content.unpack('Z*a*') new(keyword, value) end |
Instance Method Details
#content ⇒ Object
Creates the content to write to the stream, by concatenating the keyword with the value, joined by a null character.
266 267 268 |
# File 'lib/chunky_png/chunk.rb', line 266 def content [keyword, value].pack('Z*a*') end |