rgb

package
v0.0.0-...-9d42f3e Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package rgb provides RGB image which implements image.Image interface.

Index

Constants

This section is empty.

Variables

View Source
var ColorModel = color.ModelFunc(rgbModel)

ColorModel is RGB color model instance

Functions

This section is empty.

Types

type Image

type Image struct {
	// Pix holds the image's stream, in R, G, B order.
	Pix []uint8
	// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
	Stride int
	// Rect is the image's bounds.
	Rect image.Rectangle
}

Image represent image data which has RGB colors. Image is compatible with image.RGBA, but does not have alpha channel to reduce using memory.

func NewImage

func NewImage(r image.Rectangle) *Image

NewImage allocates and returns RGB image

func (*Image) At

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

At implements image.Image.At

func (*Image) Bounds

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

Bounds implements image.Image.At

func (*Image) ColorModel

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

ColorModel returns RGB color model.

func (*Image) RGBAAt

func (p *Image) RGBAAt(x, y int) color.RGBA

RGBAAt returns the color of the pixel at (x, y) as RGBA.

type RGB

type RGB struct {
	R, G, B uint8
}

RGB color

func (RGB) RGBA

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

RGBA implements Color.RGBA

Jump to

Keyboard shortcuts

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