types

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2021 License: NCSA Imports: 8 Imported by: 2

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) Channels

func (p BGRImage) Channels() int

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) Pixels

func (p BGRImage) Pixels() []uint8

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.Image

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

func (*BGRImage) ToRGBAImage

func (p *BGRImage) ToRGBAImage() *image.RGBA

type Image

type Image interface {
	image.Image
	Channels() int
	Pixels() []uint8
	Mode() Mode
}

type Mode

type Mode int

mode represents the image mode

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

func ModeString

func ModeString(s string) (Mode, error)

ModeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ModeValues

func ModeValues() []Mode

ModeValues returns all values of the enum

func (Mode) Channels

func (m Mode) Channels() int

func (Mode) IsAMode

func (i Mode) IsAMode() bool

IsAMode returns "true" if the value is listed in the enum definition. "false" otherwise

func (Mode) MarshalJSON

func (i Mode) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Mode

func (Mode) MarshalText

func (i Mode) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Mode

func (Mode) MarshalYAML

func (i Mode) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for Mode

func (*Mode) Scan

func (i *Mode) Scan(value interface{}) error

func (Mode) String

func (i Mode) String() string

func (*Mode) UnmarshalJSON

func (i *Mode) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for Mode

func (*Mode) UnmarshalText

func (i *Mode) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Mode

func (*Mode) UnmarshalYAML

func (i *Mode) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for Mode

func (Mode) Value

func (i Mode) Value() (driver.Value, error)

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) Channels

func (p RGBImage) Channels() int

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) Pixels

func (p RGBImage) Pixels() []uint8

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.Image

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

func (*RGBImage) ToRGBAImage

func (p *RGBImage) ToRGBAImage() *image.RGBA

type ResizeAlgorithm

type ResizeAlgorithm int
const (
	ResizeAlgorithmLinear ResizeAlgorithm = iota
	ResizeAlgorithmLinearASM
	ResizeAlgorithmHermite
	ResizeAlgorithmNearestNeighbor
	ResizeAlgorithmBiLinear    = ResizeAlgorithmLinear
	ResizeAlgorithmBiLinearASM = ResizeAlgorithmLinearASM
)

func ResizeAlgorithmString

func ResizeAlgorithmString(s string) (ResizeAlgorithm, error)

ResizeAlgorithmString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ResizeAlgorithmValues

func ResizeAlgorithmValues() []ResizeAlgorithm

ResizeAlgorithmValues returns all values of the enum

func (ResizeAlgorithm) IsAResizeAlgorithm

func (i ResizeAlgorithm) IsAResizeAlgorithm() bool

IsAResizeAlgorithm returns "true" if the value is listed in the enum definition. "false" otherwise

func (ResizeAlgorithm) MarshalJSON

func (i ResizeAlgorithm) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for ResizeAlgorithm

func (ResizeAlgorithm) MarshalText

func (i ResizeAlgorithm) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for ResizeAlgorithm

func (ResizeAlgorithm) MarshalYAML

func (i ResizeAlgorithm) MarshalYAML() (interface{}, error)

MarshalYAML implements a YAML Marshaler for ResizeAlgorithm

func (*ResizeAlgorithm) Scan

func (i *ResizeAlgorithm) Scan(value interface{}) error

func (ResizeAlgorithm) String

func (i ResizeAlgorithm) String() string

func (*ResizeAlgorithm) UnmarshalJSON

func (i *ResizeAlgorithm) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for ResizeAlgorithm

func (*ResizeAlgorithm) UnmarshalText

func (i *ResizeAlgorithm) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for ResizeAlgorithm

func (*ResizeAlgorithm) UnmarshalYAML

func (i *ResizeAlgorithm) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements a YAML Unmarshaler for ResizeAlgorithm

func (ResizeAlgorithm) Value

func (i ResizeAlgorithm) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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