img

package
v0.0.0-...-fac9772 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Rectangle = 0
	Circle    = 1
	Polygon   = 2
)

Variables

This section is empty.

Functions

func BLoadImage

func BLoadImage(byt []byte) (img image.Image, err error)

Load image from bytes

func BWriteImage

func BWriteImage(img image.Image) (byt []byte, err error)

Encode image to byte array

func LoadImage

func LoadImage(path string) (img image.Image, err error)

Load image from file

func TrimWhitespace

func TrimWhitespace(img image.Image) image.Image

Removes whitespace around image. Returns new image.

func WriteImage

func WriteImage(path string, img image.Image) (err error)

Write image as file

Types

type Mask

type Mask struct {
	draw.Image
}

func NewMask

func NewMask(rect image.Rectangle) *Mask

func (*Mask) DrawShape

func (m *Mask) DrawShape(shape Shape)

Draw single shape to mask

func (*Mask) DrawShapes

func (m *Mask) DrawShapes(shapes []Shape)

Draw multiple shapes to mask. Shapes will overlap eachother

func (*Mask) DrawToImage

func (m *Mask) DrawToImage(img image.Image) image.Image

Draws given image to a buffer using m as a mask. Returns said buffer

type Shape

type Shape struct {
	Type    int
	Opacity int
	Pos     Vector
	Size    Vector
	Points  []Vector
}

func (*Shape) Rect

func (s *Shape) Rect() image.Rectangle

Get image rect of the shape

type Vector

type Vector struct {
	X int
	Y int
}

Jump to

Keyboard shortcuts

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