image

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0, MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DarkenTarget added in v0.2.3

func DarkenTarget(dst draw.Image) draw.Image

DarkenTarget 按非预乘颜色逐通道取较暗值,同时合成源和底图透明度。

func MultiplyTarget added in v0.2.3

func MultiplyTarget(dst draw.Image) draw.Image

MultiplyTarget 在插值器写入源像素时执行正片叠底。 At 返回透明色,使 draw.Over 不提前合成;Set 使用底图的真实像素, 按预乘颜色公式同时保留源和目标透明度,无需分配整页离屏图。

Types

type DarkenImage added in v0.2.3

type DarkenImage struct{ image.Image }

DarkenImage 保留文档显式声明的变暗混合模式,不修改源像素。

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)

Image 并发安全地按需解码并应用掩码,缓存像素与错误,不因读取配置而解码。

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 MultiplyImage added in v0.2.3

type MultiplyImage struct{ image.Image }

MultiplyImage 标记以正片叠底方式绘制的图片,不改变共享的源像素。

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