image

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ColorModel = color.ModelFunc(rgbModel)

ColorModel is the color model for RGB24 images, converting any color to 24-bit RGB format.

Functions

This section is empty.

Types

type RGB

type RGB struct {
	R, G, B uint8
}

RGB represents a 24-bit color consisting of red, green, and blue components. Each component is an 8-bit value, giving a total of 16,777,216 possible colors.

func (RGB) RGBA

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

RGBA returns the alpha-premultiplied red, green, blue and alpha values for the RGB color. The alpha value is always fully opaque (0xFFFF). The red, green, and blue values are returned in the range [0, 0xFFFF].

type RGB24

type RGB24 struct {
	// Pix holds the image's pixels, in RGB order. The pixel at (x, y)
	// starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*3].
	Pix []uint8
	// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
	Stride int
	// Rect is the image's bounds.
	Rect image.Rectangle
}

RGB24 represents an in-memory image with 24-bit RGB color. Each pixel is stored as three consecutive bytes in RGB order. This format is commonly used for uncompressed image data from video frames.

func NewRGB24 added in v1.6.7

func NewRGB24(r image.Rectangle) *RGB24

NewRGB24 returns a new RGB24 image with the given bounds. The image's pixels are initialized to zero (black).

func (*RGB24) At

func (p *RGB24) At(x, y int) color.Color

At returns the color of the pixel at (x, y). At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid. At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right pixel.

func (*RGB24) Bounds

func (p *RGB24) Bounds() image.Rectangle

Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0).

func (*RGB24) ColorModel

func (p *RGB24) ColorModel() color.Model

ColorModel returns the RGB color model.

func (*RGB24) RGBAt added in v1.8.1

func (p *RGB24) RGBAt(x, y int) RGB

RGBAt returns the RGB color of the pixel at (x, y). If the point is outside the image bounds, RGBAt returns zero RGB.

func (*RGB24) Set added in v1.6.7

func (p *RGB24) Set(x, y int, c color.Color)

Set sets the pixel at (x, y) to the given color. If the point is outside the image bounds, Set is a no-op.

Jump to

Keyboard shortcuts

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