Class: ChunkyPNG::Chunk::Header
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#compression ⇒ Object
Returns the value of attribute compression.
-
#depth ⇒ Object
Returns the value of attribute depth.
-
#filtering ⇒ Object
Returns the value of attribute filtering.
-
#height ⇒ Object
Returns the value of attribute height.
-
#interlace ⇒ Object
Returns the value of attribute interlace.
-
#width ⇒ Object
Returns the value of attribute width.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(attrs = {}) ⇒ Header
constructor
A new instance of Header.
Methods inherited from Base
Constructor Details
#initialize(attrs = {}) ⇒ Header
Returns a new instance of Header.
50 51 52 53 54 55 56 57 |
# File 'lib/chunky_png/chunk.rb', line 50 def initialize(attrs = {}) super('IHDR', attrs) @depth ||= 8 @color ||= ChunkyPNG::COLOR_TRUECOLOR @compression ||= ChunkyPNG::COMPRESSION_DEFAULT @filtering ||= ChunkyPNG::FILTERING_DEFAULT @interlace ||= ChunkyPNG::INTERLACING_NONE end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
48 49 50 |
# File 'lib/chunky_png/chunk.rb', line 48 def color @color end |
#compression ⇒ Object
Returns the value of attribute compression.
48 49 50 |
# File 'lib/chunky_png/chunk.rb', line 48 def compression @compression end |
#depth ⇒ Object
Returns the value of attribute depth.
48 49 50 |
# File 'lib/chunky_png/chunk.rb', line 48 def depth @depth end |
#filtering ⇒ Object
Returns the value of attribute filtering.
48 49 50 |
# File 'lib/chunky_png/chunk.rb', line 48 def filtering @filtering end |
#height ⇒ Object
Returns the value of attribute height.
48 49 50 |
# File 'lib/chunky_png/chunk.rb', line 48 def height @height end |
#interlace ⇒ Object
Returns the value of attribute interlace.
48 49 50 |
# File 'lib/chunky_png/chunk.rb', line 48 def interlace @interlace end |
#width ⇒ Object
Returns the value of attribute width.
48 49 50 |
# File 'lib/chunky_png/chunk.rb', line 48 def width @width end |
Class Method Details
.read(type, content) ⇒ Object
59 60 61 62 63 |
# File 'lib/chunky_png/chunk.rb', line 59 def self.read(type, content) fields = content.unpack('NNC5') self.new(:width => fields[0], :height => fields[1], :depth => fields[2], :color => fields[3], :compression => fields[4], :filtering => fields[5], :interlace => fields[6]) end |
Instance Method Details
#content ⇒ Object
65 66 67 |
# File 'lib/chunky_png/chunk.rb', line 65 def content [width, height, depth, color, compression, filtering, interlace].pack('NNC5') end |