Static Methodswift-png 4.4.5PNG
deconvolve(_:as:depth:kernel:)
Converts a pixel array to an image data buffer, using the given pixel kernel.
PNG.swift:1126static func deconvolve<A, T, C>(_ pixels: [C], as _: A.Type, depth: Int, kernel: (C) -> (T, T)) -> [UInt8] where A : FixedWidthInteger, A : UnsignedInteger, T : FixedWidthInteger, T : UnsignedInteger
Parameters
Returns
An image data buffer. This array has a length of pixels.count
, multiplied by twice the stride of A
.
This function maps the given kernel
function over each element in pixels
, receiving (T, T)
intensity pairs in return. It then converts them into atoms of type A
, scaling each intensity value to the range specified by the given color depth
. The elements of the generated (A, A)
pairs are then stored sequentially as big-endian integers in the returned image data buffer.
A worked example of how to use this function to implement a custom color target can be found in the custom color targets tutorial.
Other members in extension
Protocols
protocol BytestreamDestination
A destination bytestream.
protocol BytestreamSource
A source bytestream.
protocol Color<Aggregate>
A color target.
protocol Error
Functionality common to all library error types.
Types
struct Background
A background descriptor.
struct Chromaticity
A chromaticity descriptor.
struct Chunk
A chunk type identifier.
struct ColorProfile
An embedded color profile.
enum ColorRendering
A color rendering mode.
struct Context
A decoding context.
enum DecodingError
A decoding error.
enum Format
A color format.
enum FormattingError
A formatting error.
struct Gamma
A gamma descriptor.
struct Header
An image header.
struct Histogram
A palette frequency histogram.
struct Image
A rectangular image.
struct Layout
An image layout.
enum LexingError
A lexing error.
struct Metadata
The metadata in a PNG image.
struct Palette
An image palette.
enum ParsingError
A parsing error.
struct Percentmille
A rational percentmille value.
struct PhysicalDimensions
A physical dimensions descriptor.
struct RGBA<T>
An RGBA color target.
struct SignificantBits
A color precision descriptor.
enum Standard
A PNG standard.
struct SuggestedPalette
A suggested image palette.
struct Text
A text comment.
struct TimeModified
An image modification time.
struct Transparency
A transparency descriptor.
struct VA<T>
A grayscale-alpha color target.
Show obsolete interfaces (2)
Hide obsolete interfaces
enum Bytestream
A namespace for bytestream utilities.
enum Data
A namespace containing the
Image
type.
Type members
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, T, 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)) -> 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, A) -> C
) -> [C] Converts an image data buffer to a pixel array, 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.
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
) -> [UInt8] Converts a pixel array to an image data buffer, 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 premultiply<T>(T, alpha: T
) -> T Premultiplies a color component with an alpha value.
static func straighten<T>(T, alpha: T
) -> T Straightens a premultiplied color component given an alpha value.