Instance Methodswift-png 4.4.5PNG
premultiplied(as:)
The color obtained by premultiplying the red, green, and blue components of this color with its alpha channel, performing the premultiplication in the given integer type.
PNG.RGBA.swift:146func premultiplied<U>(as _: U.Type) -> PNG.RGBA<T> where U : FixedWidthInteger, U : UnsignedInteger
Parameters
- _
The integer type to perform the premultiplications in.
U.bitWidth
must be less thanT.bitWidth
.
Returns
The premultiplied color.
Premultiplication in a different integer type is sometimes necessary to reproduce the output of other image processing frameworks.
The premultiplied color is obtained by invoking premultiply(_:alpha:)
on r
, g
, and b
, after scaling them to the range of U
. The returned components are then scaled back to the range of T
. The rescaling operation also affects the a
component.
Other members in extension
Typealiases
typealias Aggregate
Palette aggregates are (red, green, blue, alpha) quadruplets.
Type members
init(PNG.VA<T>
) Creates an RGBA color from a grayscale-alpha color.
init(T
) Creates an opaque, monochromatic RGBA color.
init(T, T
) Creates a monochromatic RGBA color.
init(T, T, T
) Creates an opaque RGBA color.
init(T, T, T, T
) Creates an RGBA color.
static func pack([`Self`], as: PNG.Format, indexer: ([(r: UInt8, g: UInt8, b: UInt8, a: UInt8)]) -> (Aggregate) -> Int
) -> [UInt8] Packs an array of RGBA pixels to an image data storage buffer.
static func unpack([UInt8], of: PNG.Format, deindexer: ([(r: UInt8, g: UInt8, b: UInt8, a: UInt8)]) -> (Int) -> Aggregate
) -> [`Self`] Unpacks an image data storage buffer to an array of RGBA pixels.
Instance members
var premultiplied: `Self`
The color obtained by premultiplying the red, green, and blue components of this color with its alpha channel.
var straightened: `Self`
The color obtained by straightening the red, green, and blue components of this color according to its alpha channel.
var va: PNG.VA<T>
The grayscale-alpha color obtained by discarding the green and blue components of this color.
func straightened<U>(as: U.Type
) -> PNG.RGBA<T> The color obtained by straightening the red, green, and blue components of this color according to its alpha channel, performing the straightening in the given integer type.