image

package
v0.0.0-...-0980464 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GrayA

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

GrayA is an in-memory image whose At method returns color.GrayA values.

func NewGrayA

func NewGrayA(r image.Rectangle) *GrayA

NewGrayA returns a new GrayA image with the given bounds.

func (*GrayA) At

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

func (*GrayA) Bounds

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

func (*GrayA) ColorModel

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

func (*GrayA) GrayAAt

func (p *GrayA) GrayAAt(x, y int) ccolor.GrayA

func (*GrayA) Opaque

func (p *GrayA) Opaque() bool

Opaque scans the entire image and reports whether it is fully opaque.

func (*GrayA) PixOffset

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

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

func (*GrayA) Set

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

func (*GrayA) SetGrayA

func (p *GrayA) SetGrayA(x, y int, c ccolor.GrayA)

func (*GrayA) SubImage

func (p *GrayA) 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.

type GrayA32

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

GrayA32 is an in-memory image whose At method returns color.RGBA64 values.

func NewGrayA32

func NewGrayA32(r image.Rectangle) *GrayA32

NewGrayA32 returns a new GrayA32 image with the given bounds.

func (*GrayA32) At

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

func (*GrayA32) Bounds

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

func (*GrayA32) ColorModel

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

func (*GrayA32) GrayA32At

func (p *GrayA32) GrayA32At(x, y int) ccolor.GrayA32

func (*GrayA32) Opaque

func (p *GrayA32) Opaque() bool

Opaque scans the entire image and reports whether it is fully opaque.

func (*GrayA32) PixOffset

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

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

func (*GrayA32) Set

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

func (*GrayA32) SetGrayA32

func (p *GrayA32) SetGrayA32(x, y int, c ccolor.GrayA32)

func (*GrayA32) SubImage

func (p *GrayA32) 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.

type Image

type Image struct {
	Bytes    []byte
	Mimetype string
	image.Config
	Mask *Image
	// contains filtered or unexported fields
}

Image is a raster image that is loaded lazily. Keeping the original bytes allows the renderer to optimize rendering in some cases.

func NewJPEGImage

func NewJPEGImage(r io.Reader) (*Image, error)

NewJPEGImage parses a JPEG image.

func NewJPEGMaskedImage

func NewJPEGMaskedImage(r io.Reader, mask *Image) (*Image, error)

NewJPEGMaskedImage parses a JPEG image and a separate mask. This allows for a brightness-only JPEG to act as mask.

func NewPNGImage

func NewPNGImage(r io.Reader) (*Image, error)

NewPNGImage parses a PNG image

func (*Image) At

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

func (*Image) Bounds

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

func (*Image) ColorModel

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

func (*Image) Image

func (i *Image) Image() (image.Image, error)

func (*Image) Opaque

func (i *Image) Opaque() bool

type ImageEncoding

type ImageEncoding int

ImageEncoding defines whether the embedded image shall be embedded as lossless (typically PNG) or lossy (typically JPG).

const (
	Lossless ImageEncoding = iota
	Lossy
)

see ImageEncoding

type RGB

type RGB 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
}

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

func NewRGB

func NewRGB(r image.Rectangle) *RGB

NewRGBA returns a new RGB image with the given bounds.

func (*RGB) At

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

func (*RGB) Bounds

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

func (*RGB) ColorModel

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

func (*RGB) Opaque

func (p *RGB) Opaque() bool

Opaque scans the entire image and reports whether it is fully opaque.

func (*RGB) PixOffset

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

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

func (*RGB) RGBA64At

func (p *RGB) RGBA64At(x, y int) color.RGBA64

func (*RGB) RGBAt

func (p *RGB) RGBAt(x, y int) ccolor.RGB

func (*RGB) Set

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

func (*RGB) SetRGB

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

func (*RGB) SubImage

func (p *RGB) 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.

type RGB48

type RGB48 struct {
	// Pix holds the image's pixels, in R, G, B order and big-endian format. The pixel at
	// (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*6].
	Pix []uint8
	// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
	Stride int
	// Rect is the image's bounds.
	Rect image.Rectangle
}

RGB48 is an in-memory image whose At method returns color.RGBA64 values.

func NewRGB48

func NewRGB48(r image.Rectangle) *RGB48

NewRGB48 returns a new RGB48 image with the given bounds.

func (*RGB48) At

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

func (*RGB48) Bounds

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

func (*RGB48) ColorModel

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

func (*RGB48) Opaque

func (p *RGB48) Opaque() bool

Opaque scans the entire image and reports whether it is fully opaque.

func (*RGB48) PixOffset

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

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

func (*RGB48) RGB48At

func (p *RGB48) RGB48At(x, y int) ccolor.RGB48

func (*RGB48) RGBA64At

func (p *RGB48) RGBA64At(x, y int) color.RGBA64

func (*RGB48) Set

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

func (*RGB48) SetRGB48

func (p *RGB48) SetRGB48(x, y int, c ccolor.RGB48)

func (*RGB48) SubImage

func (p *RGB48) 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.

Jump to

Keyboard shortcuts

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