Class: Rixmap::Format::PNG::Chunk::IHDRChunk

Inherits:
BaseChunk
  • Object
show all
Defined in:
lib/rixmap/format/png/chunk.rb

Overview

IHDRイメージヘッダチャンク.

Constant Summary collapse

TYPE =

IHDRチャンクタイプ

"IHDR"
LAYOUT =

pack用IHDRデータレイアウト

"N2C5"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseChunk

#copysafe?, #data, #data=, #optional?, #private?, #standard?, #type

Constructor Details

#initialize(width = 0, height = 0, depth = 0, colortype = COLORTYPE_TRUECOLOR, compress = COMPRESSION_DEFLATE, filter = FILTER_ADAPTIVE, interlace = INTERLACE_NONE) ⇒ IHDRChunk

Returns a new instance of IHDRChunk.



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/rixmap/format/png/chunk.rb', line 138

def initialize(width = 0, height = 0, depth = 0,
               colortype = COLORTYPE_TRUECOLOR,
               compress = COMPRESSION_DEFLATE,
               filter = FILTER_ADAPTIVE,
               interlace = INTERLACE_NONE)
  @width     = width
  @height    = height
  @depth     = depth
  @colortype = colortype
  @compress  = compress
  @filter    = filter
  @interlace = interlace

  super(IHDRChunk::TYPE)
end

Instance Attribute Details

#colortypeObject

Returns the value of attribute colortype.



133
134
135
# File 'lib/rixmap/format/png/chunk.rb', line 133

def colortype
  @colortype
end

#compressObject

Returns the value of attribute compress.



134
135
136
# File 'lib/rixmap/format/png/chunk.rb', line 134

def compress
  @compress
end

#depthObject

Returns the value of attribute depth.



132
133
134
# File 'lib/rixmap/format/png/chunk.rb', line 132

def depth
  @depth
end

#filterObject

Returns the value of attribute filter.



135
136
137
# File 'lib/rixmap/format/png/chunk.rb', line 135

def filter
  @filter
end

#heightObject

Returns the value of attribute height.



131
132
133
# File 'lib/rixmap/format/png/chunk.rb', line 131

def height
  @height
end

#interlaceObject

Returns the value of attribute interlace.



136
137
138
# File 'lib/rixmap/format/png/chunk.rb', line 136

def interlace
  @interlace
end

#widthObject

Returns the value of attribute width.



130
131
132
# File 'lib/rixmap/format/png/chunk.rb', line 130

def width
  @width
end

Instance Method Details

#packObject



154
155
156
# File 'lib/rixmap/format/png/chunk.rb', line 154

def pack()
  @data = [@width, @height, @depth, @colortype, @compress, @filter, @interlace].pack(IHDRChunk::LAYOUT)
end

#unpackObject



158
159
160
# File 'lib/rixmap/format/png/chunk.rb', line 158

def unpack()
  @width, @height, @depth, @colortype, @compress, @filter, @interlace = @data.unpack(IHDRChunk::LAYOUT)
end