npcolor

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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