Protocol

PNG.Color

A color target.

Declaration

protocol Color

Overview

The library provides two built-in color targets, VA and RGBA. A worked example of how to implement a custom color target can be found in the custom color targets tutorial.

Topics

Unpacking functions

static func unpack([UInt8], of:Format, deindexer:([(r:UInt8, g:UInt8, b:UInt8, a:UInt8)]) -> (Int) -> Aggregate) -> [Self]

Unpacks an image data storage buffer to an array of this color target, using a custom deindexing function.

Required.

static func unpack([UInt8], of:Format) -> [Self]

Unpacks an image data storage buffer to an array of this color target.

Required.
Default implementation provided when Aggregate is (UInt8, UInt8).
Default implementation provided when Aggregate is (UInt8, UInt8, UInt8, UInt8).

Packing functions

static func pack([Self], as:Format, indexer:([(r:UInt8, g:UInt8, b:UInt8, a:UInt8)]) -> (Aggregate) -> Int) -> [UInt8]

Packs an array of this color target to an image data storage buffer, using a custom indexing function.

Required.

static func pack([Self], as:Format) -> [UInt8]

Packs an array of this color target to an image data storage buffer.

Required.
Default implementation provided when Aggregate is (UInt8, UInt8).
Default implementation provided when Aggregate is (UInt8, UInt8, UInt8, UInt8).

Associated types

associatedtype Aggregate

A palette aggregate type.

Required.

See also

struct PNG.RGBA<T>

An RGBA color target.

struct PNG.VA<T>

A grayscale-alpha color target.

static func convolve<A, T, C>([UInt8], dereference:(Int) -> A, kernel:(T) -> C) -> [C]

Converts an image data buffer to a pixel array, using the given pixel kernel and dereferencing function.

static func convolve<A, T, C>([UInt8], dereference:(Int) -> (A, A), kernel:((T, T)) -> C) -> [C]

Converts an image data buffer to a pixel array, using the given pixel kernel and dereferencing function.

static func convolve<A, T, C>([UInt8], dereference:(Int) -> (A, A, A), kernel:((T, T, T)) -> C) -> [C]

Converts an image data buffer to a pixel array, using the given pixel kernel and dereferencing function.

static func convolve<A, T, C>([UInt8], dereference:(Int) -> (A, A, A, A), kernel:((T, T, T, T)) -> C) -> [C]

Converts an image data buffer to a pixel array, using the given pixel kernel and dereferencing function.

static func convolve<A, T, C>([UInt8], of:A.Type, depth:Int, kernel:(T, A) -> C) -> [C]

Converts an image data buffer to a pixel array, using the given pixel kernel.

static func convolve<A, T, C>([UInt8], of:A.Type, depth:Int, kernel:((T, T)) -> C) -> [C]

Converts an image data buffer to a pixel array, using the given pixel kernel.

static func convolve<A, T, C>([UInt8], of:A.Type, depth:Int, kernel:((T, T, T), (A, A, A)) -> C) -> [C]

Converts an image data buffer to a pixel array, using the given pixel kernel.

static func convolve<A, T, C>([UInt8], of:A.Type, depth:Int, kernel:((T, T, T, T)) -> C) -> [C]

Converts an image data buffer to a pixel array, using the given pixel kernel.

static func deconvolve<A, T, C>([C], reference:(A) -> Int, kernel:(C) -> T) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel and referencing function.

static func deconvolve<A, T, C>([C], reference:((A, A)) -> Int, kernel:(C) -> (T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel and referencing function.

static func deconvolve<A, T, C>([C], reference:((A, A, A)) -> Int, kernel:(C) -> (T, T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel and referencing function.

static func deconvolve<A, T, C>([C], reference:((A, A, A, A)) -> Int, kernel:(C) -> (T, T, T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel and referencing function.

static func deconvolve<A, T, C>([C], as:A.Type, depth:Int, kernel:(C) -> T) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel.

static func deconvolve<A, T, C>([C], as:A.Type, depth:Int, kernel:(C) -> (T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel.

static func deconvolve<A, T, C>([C], as:A.Type, depth:Int, kernel:(C) -> (T, T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel.

static func deconvolve<A, T, C>([C], as:A.Type, depth:Int, kernel:(C) -> (T, T, T, T)) -> [UInt8]

Converts a pixel array to an image data buffer, using the given pixel kernel.