npcolor

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2019 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package npcolor implements the color types and models used by Netpbm.

RGBAM and RGBAM64 are analogous to the color package's RGBA and RGBA64 in that they represent, respectively, colors with 8 bits and 16 bits per color channel. They additionally store a maximum channel value. Consequently, while a color.RGBA has a hard-wired upper bound of 255 per color channel, npcolor.RGBAM supports any upper bound from 1–255. Likewise, while a color.RGBA64 has a hard-wired upper bound of 65,535 per color channel, npcolor.RGBAM64 supports any upper bound from 1–65,535.

RGBM and RGBM64 are also analogous to the color package's RGBA and RGBA64 in that they represent, respectively, colors with 8 bits and 16 bits per color channel. While color.RGBA and color.RGBA64 store red, green, blue, and alpha channels, npcolor.RGBM and npcolor.RGBM64 lack alpha channels. However, they store a maximum channel value. Consequently, while a color.RGBA has a hard-wired upper bound of 255 per color channel, npcolor.RGBM supports any upper bound from 1–255. Likewise, while a color.RGBA64 has a hard-wired upper bound of 65,535 per color channel, npcolor.RGBM64 supports any upper bound from 1–65,535.

GrayM and GrayM32 are analogous to the color package's Gray and Gray16 in that they represent, respectively, 8-bit and 16-bit grayscale values. However, while a color.Gray value has a hard-wired upper bound of 255, npcolor.GrayM supports any upper bound from 1–255. Likewise, while a color.Gray16 value has a hard-wired upper bound of 65,535, npcolor.GrayM32 supports any upper bound from 1–65,535.

GrayAM and GrayAM32 have no analogue in the color package. They represent, respectively, 8-bit and 16-bit grayscale values with an alpha channel. Like the other colors represented in this package, these support variable maximum channel values. npcolor.GrayAM supports any upper bound from 1–255, and npcolor.GrayM32 supports any upper bound from 1–65,535.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GrayAM added in v1.2.0

type GrayAM struct {
	Y, A, M uint8
}

GrayAM represents an 8-bit grayscale value with an alpha channel and the value to represent 100% white.

func (GrayAM) RGBA added in v1.2.0

func (c GrayAM) RGBA() (r, g, b, a uint32)

RGBA converts a GrayAM to alpha-premultiplied R, G, B, and A.

type GrayAM48 added in v1.2.0

type GrayAM48 struct {
	Y, A, M uint16
}

GrayAM48 represents a 16-bit grayscale value with an alpha channel and the value to represent 100% white.

func (GrayAM48) RGBA added in v1.2.0

func (c GrayAM48) RGBA() (r, g, b, a uint32)

RGBA converts a GrayAM48 to alpha-premultiplied R, G, B, and A.

type GrayAM48Model added in v1.2.0

type GrayAM48Model struct {
	M uint16 // Maximum value of the luminance channel
}

A GrayAM48Model represents the maximum value of a GrayAM48 (0-65535).

func (GrayAM48Model) Convert added in v1.2.0

func (model GrayAM48Model) Convert(c color.Color) color.Color

Convert converts an arbitrary color to a GrayAM48.

type GrayAMModel added in v1.2.0

type GrayAMModel struct {
	M uint8 // Maximum value of the luminance channel
}

A GrayAMModel represents the maximum value of a GrayAM (0-255).

func (GrayAMModel) Convert added in v1.2.0

func (model GrayAMModel) Convert(c color.Color) color.Color

Convert converts an arbitrary color to a GrayAM.

type GrayM

type GrayM struct {
	Y, M uint8
}

GrayM represents an 8-bit grayscale value and the value to represent 100% white. Because GrayM does not support alpha channels it does make sense to describe it as either "alpha-premultiplied" or "non-alpha-premultiplied".

func (GrayM) RGBA

func (c GrayM) RGBA() (r, g, b, a uint32)

RGBA converts a GrayM to alpha-premultiplied R, G, B, and A.

type GrayM32

type GrayM32 struct {
	Y, M uint16
}

GrayM32 represents a 16-bit grayscale value and the value to represent 100% white. Because GrayM16 does not support alpha channels it does make sense to describe it as either "alpha-premultiplied" or "non-alpha-premultiplied".

func (GrayM32) RGBA

func (c GrayM32) RGBA() (r, g, b, a uint32)

RGBA converts a GrayM32 to alpha-premultiplied R, G, B, and A.

type GrayM32Model

type GrayM32Model struct {
	M uint16 // Maximum value of the luminance channel
}

A GrayM32Model represents the maximum value of a GrayM32 (0-65535).

func (GrayM32Model) Convert

func (model GrayM32Model) Convert(c color.Color) color.Color

Convert converts an arbitrary color to a GrayM32.

type GrayMModel

type GrayMModel struct {
	M uint8 // Maximum value of the luminance channel
}

A GrayMModel represents the maximum value of a GrayM (0-255).

func (GrayMModel) Convert

func (model GrayMModel) Convert(c color.Color) color.Color

Convert converts an arbitrary color to a GrayM.

type RGBAM

type RGBAM struct {
	R, G, B, A, M uint8
}

RGBAM represents a 32-bit color and the value used for 100% of a color channel.

func (RGBAM) RGBA

func (c RGBAM) RGBA() (r, g, b, a uint32)

RGBA converts an RGBAM to alpha-premultiplied R, G, B, and A.

type RGBAM64

type RGBAM64 struct {
	R, G, B, A, M uint16
}

RGBAM64 represents a 48-bit color and the value used for 100% of a color channel.

func (RGBAM64) RGBA

func (c RGBAM64) RGBA() (r, g, b, a uint32)

RGBA converts an RGBAM64 to alpha-premultiplied R, G, B, and A.

type RGBAM64Model

type RGBAM64Model struct {
	M uint16 // Maximum value of each color channel
}

An RGBAM64Model represents the maximum value of an RGBAM64 (0-65535).

func (RGBAM64Model) Convert

func (model RGBAM64Model) Convert(c color.Color) color.Color

Convert converts an arbitrary color to an RGBAM64.

type RGBAMModel

type RGBAMModel struct {
	M uint8 // Maximum value of each color channel
}

An RGBAMModel represents the maximum value of an RGBM (0-255).

func (RGBAMModel) Convert

func (model RGBAMModel) Convert(c color.Color) color.Color

Convert converts an arbitrary color to an RGBM.

type RGBM

type RGBM struct {
	R, G, B, M uint8
}

RGBM represents a 24-bit color and the value used for 100% of a color channel. Because RGBM does not support alpha channels it does not make sense to describe it as either "alpha-premultiplied" or "non-alpha-premultiplied".

func (RGBM) RGBA

func (c RGBM) RGBA() (r, g, b, a uint32)

RGBA converts an RGBM to alpha-premultiplied R, G, B, and A.

type RGBM64

type RGBM64 struct {
	R, G, B, M uint16
}

RGBM64 represents a 48-bit color and the value used for 100% of a color channel.

func (RGBM64) RGBA

func (c RGBM64) RGBA() (r, g, b, a uint32)

RGBA converts an RGBM64 to alpha-premultiplied R, G, B, and A.

type RGBM64Model

type RGBM64Model struct {
	M uint16 // Maximum value of each color channel
}

An RGBM64Model represents the maximum value of an RGBM64 (0-65535).

func (RGBM64Model) Convert

func (model RGBM64Model) Convert(c color.Color) color.Color

Convert converts an arbitrary color to an RGBM64.

type RGBMModel

type RGBMModel struct {
	M uint8 // Maximum value of each color channel
}

An RGBMModel represents the maximum value of an RGBM (0-255).

func (RGBMModel) Convert

func (model RGBMModel) Convert(c color.Color) color.Color

Convert converts an arbitrary color to an RGBM.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL