class
PNGChunks::PNGChunk
- PNGChunks::PNGChunk
- Reference
- Object
Overview
PNGChunk represents a single PNG chunk, which is effectively the pair of the type (such as IHDR) and the data.
Defined in:
png-chunks.crConstructors
-
.new(type_bytes : Slice(UInt8), data : Slice(UInt8))
Creates a new
PNGChunkout of a type and data, bothBytes.
Instance Method Summary
-
#crc : UInt32
The chunk's CRC32 checksum, calculated from the chunk's type and data.
-
#data : Bytes
The chunk's data.
-
#type
The chunk's type as a string.
-
#type_bytes : Bytes
The chunk's type as
Bytes. -
#valid? : Bool
A boolean representing whether the chunk is valid.
Constructor Detail
def self.new(type_bytes : Slice(UInt8), data : Slice(UInt8))
#
Creates a new PNGChunk out of a type and data, both Bytes.
type_bytes = "IHDR".bytes
data = make_ihdr_bytes
chunk = PNGChunks::PNGChunk(type_bytes, data)
Instance Method Detail
def type_bytes : Bytes
#
The chunk's type as Bytes. For example, IHDR is Bytes[0x49, 0x48, 0x44, 0x52].