types

package
v0.0.0-...-a6ebd1b Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: NCSA Imports: 3 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BGRModel color.Model = color.ModelFunc(bgrModel)
)
View Source
var (
	RGBModel color.Model = color.ModelFunc(rgbModel)
)

Functions

This section is empty.

Types

type BGR

type BGR struct {
	B, G, R uint8
}

BGR represents a traditional 32-bit alpha-premultiplied color, having 8 bits for each of red, green, blue.

func (BGR) RGBA

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

type BGRImage

type BGRImage struct {
	// Pix holds the image's pixels, in R, G, B 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
}

BGRImage is an in-memory image whose At method returns RGB values.

func NewBGRImage

func NewBGRImage(r image.Rectangle) *BGRImage

NewBGRImage returns a new BGRImage image with the given bounds.

func (BGRImage) At

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

func (*BGRImage) BGRAt

func (p *BGRImage) BGRAt(x, y int) BGR

func (BGRImage) Bounds

func (p BGRImage) Bounds() image.Rectangle

func (BGRImage) ColorModel

func (p BGRImage) ColorModel() color.Model

func (*BGRImage) FillFromBGRImage

func (p *BGRImage) FillFromBGRImage(bgrImage *RGBImage) error

func (*BGRImage) FillFromGrayImage

func (p *BGRImage) FillFromGrayImage(grayImage *image.Gray) error

func (*BGRImage) FillFromNRGBAImage

func (p *BGRImage) FillFromNRGBAImage(nrgbaImage *image.NRGBA) error

func (*BGRImage) FillFromRGBAImage

func (p *BGRImage) FillFromRGBAImage(rgbaImage *image.RGBA) error

func (*BGRImage) FillFromRGBImage

func (p *BGRImage) FillFromRGBImage(rgbImage *RGBImage) error

func (*BGRImage) FillFromYCBCRImage

func (p *BGRImage) FillFromYCBCRImage(ycImage *image.YCbCr) error

func (BGRImage) Mode

func (p BGRImage) Mode() Mode

func (*BGRImage) PixOffset

func (p *BGRImage) PixOffset(x, y int) int

PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).

func (*BGRImage) Set

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

func (*BGRImage) SetBGR

func (p *BGRImage) SetBGR(x, y int, c BGR)

func (*BGRImage) SubImage

func (p *BGRImage) SubImage(r image.Rectangle) Image

SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.

type Image

type Image interface {
	image.Image
	Mode() Mode
}

type Mode

type Mode int

mode represents the image mode

const (
	RGBMode Mode = iota
	BGRMode
	NonInterlacedRGBMode
	NonInterlacedBGRMode
	InvalidMode Mode = 9999
)

type RGB

type RGB struct {
	R, G, B uint8
}

RGB represents a traditional 32-bit alpha-premultiplied color, having 8 bits for each of red, green, blue.

func (RGB) RGBA

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

type RGBImage

type RGBImage struct {
	// Pix holds the image's pixels, in R, G, B 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
}

RGBImage is an in-memory image whose At method returns RGB values.

func NewRGBImage

func NewRGBImage(r image.Rectangle) *RGBImage

NewRGBImage returns a new RGBImage image with the given bounds.

func (RGBImage) At

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

func (RGBImage) Bounds

func (p RGBImage) Bounds() image.Rectangle

func (RGBImage) ColorModel

func (p RGBImage) ColorModel() color.Model

func (*RGBImage) FillFromBGRImage

func (p *RGBImage) FillFromBGRImage(bgrImage *BGRImage) error

func (*RGBImage) FillFromGrayImage

func (p *RGBImage) FillFromGrayImage(grayImage *image.Gray) error

func (*RGBImage) FillFromNRGBAImage

func (p *RGBImage) FillFromNRGBAImage(nrgbaImage *image.NRGBA) error

func (*RGBImage) FillFromRGBAImage

func (p *RGBImage) FillFromRGBAImage(rgbaImage *image.RGBA) error

func (*RGBImage) FillFromRGBImage

func (p *RGBImage) FillFromRGBImage(rgbImage *RGBImage) error

func (*RGBImage) FillFromYCBCRImage

func (p *RGBImage) FillFromYCBCRImage(ycImage *image.YCbCr) error

func (RGBImage) Mode

func (p RGBImage) Mode() Mode

func (*RGBImage) PixOffset

func (p *RGBImage) PixOffset(x, y int) int

PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).

func (*RGBImage) RGBAt

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

func (*RGBImage) Set

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

func (*RGBImage) SetRGB

func (p *RGBImage) SetRGB(x, y int, c RGB)

func (*RGBImage) SubImage

func (p *RGBImage) SubImage(r image.Rectangle) Image

SubImage returns an image representing the portion of the image p visible through r. The returned value shares pixels with the original image.

Jump to

Keyboard shortcuts

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