struct PNG::PackedData(T)

Overview

PackedData is a wrapper around a Slice data which performs R/W operations on data packed within the type

Included Modules

Defined in:

png/packed_data.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(size : Int, depth : UInt8, begin_bit : Int32 = 0) #

[View source]
def self.new(data : Slice(T), depth : UInt8, size : Int32 | Nil = nil, begin_bit : Int32 = 0) #

[View source]

Instance Method Detail

def [](range : Range) #

[View source]
def clone #

[View source]
def data : Slice(T) #

[View source]
def data=(data : Slice(T)) #

[View source]
def depth : UInt8 #

[View source]
def size #
Description copied from module Indexable(T)

Returns the number of elements in this container.


[View source]
def unsafe_fetch(index : Int) #
Description copied from module Indexable(T)

Returns the element at the given index, without doing any bounds check.

Indexable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they access elements with #[](index) and #[]?(index).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.


[View source]
def unsafe_put(index : Int, value : T) #
Description copied from module Indexable::Mutable(T)

Sets the element at the given index to value, without doing any bounds check.

Indexable::Mutable makes sure to invoke this method with index in 0...size, so converting negative indices to positive ones is not needed here.

Clients never invoke this method directly. Instead, they modify elements with #[]=(index, value).

This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.


[View source]
def word_bit(index : Int) #

[View source]