canvas

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RotatePoint

func RotatePoint(x, y, sin, cos float64) (float64, float64)

RotatePoint is the point of rotation

func RotatedSize

func RotatedSize(w, h int, angle float64) (int, int)

RotatedSize is the size of rotation

Types

type AreaRect

type AreaRect struct {
	MinX, MaxX, MinY, MaxY int
}

AreaRect .

func MakeAreaRect

func MakeAreaRect(x0, y0, x1, y1 int) *AreaRect

MakeAreaRect .

type DrawStringParams

type DrawStringParams struct {
	Color   color.Color
	Size    int
	Width   int
	Height  int
	FontDPI int
	Text    string
	Font    *truetype.Font
}

DrawStringParams .

type Matrix

type Matrix struct {
	XX, YX, XY, YY, X0, Y0 float64
}

Matrix .

func (Matrix) Multiply

func (a Matrix) Multiply(b Matrix) Matrix

Multiply is the matrix calculation of multiply

func (Matrix) Rotate

func (a Matrix) Rotate(angle float64) Matrix

Rotate is the matrix calculation of rotation

func (Matrix) Translate

func (a Matrix) Translate(x, y float64) Matrix

Translate is the matrix calculation of translate

type NRGBA

type NRGBA interface {
	image.Image
	Get() *image.NRGBA
	DrawImage(img Palette, dotRect *PositionRect, posRect *AreaRect)
	DrawString(params *DrawStringParams, pt fixed.Point26_6) error
	CalcMarginBlankArea() *AreaRect
	Rotate(angle int)
	CropCircle(x, y, radius, zoom int)
	SubImage(r image.Rectangle)
}

NRGBA .

func CreateNRGBACanvas

func CreateNRGBACanvas(width, height int, isAlpha bool) NRGBA

CreateNRGBACanvas is the canvas that creates the NRGBA

func NewNRGBA

func NewNRGBA(r image.Rectangle, isAlpha bool) NRGBA

NewNRGBA .

type Palette

type Palette interface {
	image.Image
	Get() *image.Paletted
	CalcMarginBlankArea() *AreaRect
	Rotate(angle int)
	Distort(amplude float64, period float64)
	DrawBeeline(point1 image.Point, point2 image.Point, lineColor color.RGBA)
	DrawCircle(x, y, radius int, c color.RGBA)
	DrawHorizLine(fromX, toX, y int, c color.RGBA)
	AngleSwapPoint(x, y, r, angle float64) (tarX, tarY float64)
	DrawString(params *DrawStringParams, pt fixed.Point26_6) error
}

Palette .

func CreatePaletteCanvas

func CreatePaletteCanvas(width, height int, colour []color.RGBA) Palette

CreatePaletteCanvas is the canvas that creates the palette

func NewPalette

func NewPalette(r image.Rectangle, p color.Palette) Palette

NewPalette .

type PositionRect

type PositionRect struct {
	X, Y, Width, Height int
}

PositionRect .

func MakePositionRect

func MakePositionRect(x, y, h, w int) *PositionRect

MakePositionRect .

Jump to

Keyboard shortcuts

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