Pixel

public struct Pixel

A structure of 4 8-bit values that represent r, g, b, a values of a single point (i.e. a pixel)

  • Initializes a pixel whose color is a specified gray.

    Declaration

    Swift

    public init(gray: Int)

    Parameters

    gray

    the gray color of the pixel

  • Initializes a Pixel structure

    let p = Pixel(255, 255, 255, 255) // -> white
    

    Values are calculated from 0…255

    Declaration

    Swift

    public init(_ r: Int, _ g: Int, _ b: Int, _ a: UInt8)

    Parameters

    r

    the red component

    g

    the green component

    b

    the blue component

    a

    the alpha component