img

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(a, b color.Color) color.Color

Add 颜色(RGBA)相加

func Draw

func Draw(dst image.Image, r image.Rectangle, src image.Image, sp image.Point, op Op)

Draw calls DrawMask with a nil mask.

func DrawMask

func DrawMask(dst image.Image, r image.Rectangle, src image.Image, sp image.Point, mask image.Image, mp image.Point, op Op)

func LinearGradient

func LinearGradient(start, end color.Color, width, height int, mode int) *image.RGBA

LinearGradient 线性渐变 mode 为方向, 0 - x轴, 1 - y轴, 2 - 左上到右下, 3 - 右上到左下 | 其他值无效

func LinearGradientHollowMask

func LinearGradientHollowMask(start, end, hollow color.Color, width, height, mode, border int, mask image.Image) *image.RGBA

LinearGradientHollowMask 线性渐变 掏空出一个 mask 形状填充 hollow 颜色,border为边界范围

func Mul

func Mul(src color.Color, num float64) color.Color

Mul 颜色(RGBA)乘以指定常数

func Resize

func Resize(newSize image.Point, src image.Image) image.Image

Resize 缩放图像

func RevertX

func RevertX(src image.Image) image.Image

Types

type CircleMask

type CircleMask struct {
	Radius int
}

CircleMask 圆形遮罩

func (CircleMask) At

func (c CircleMask) At(x, y int) color.Color

func (CircleMask) Bounds

func (c CircleMask) Bounds() image.Rectangle

func (CircleMask) ColorModel

func (c CircleMask) ColorModel() color.Model

type Op

type Op int

Op is a Porter-Duff compositing operator.

const (
	// Over specifies “(src in mask) over dst”.
	Over Op = iota
	// Src specifies “src in mask”.
	Src
)

type RoundedRectMask

type RoundedRectMask struct {
	End    image.Point
	Radius int
}

RoundedRectMask 圆角矩形遮罩

func (RoundedRectMask) At

func (r RoundedRectMask) At(x, y int) color.Color

func (RoundedRectMask) Bounds

func (r RoundedRectMask) Bounds() image.Rectangle

func (RoundedRectMask) ColorModel

func (r RoundedRectMask) ColorModel() color.Model

Source Files

  • draw.go
  • gradient.go
  • mask.go
  • revert.go
  • scale.go

Jump to

Keyboard shortcuts

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