llamaimage

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidFormat = errors.New("invalid format")

Functions

func DrawRadialGradient added in v0.2.0

func DrawRadialGradient(mainImage *image.RGBA, center Point, from, to color.RGBA)

Draws a Radial Gradient on the image with respect to transparent colors and the center point

func FillColor added in v0.1.3

func FillColor(img *image.RGBA, colorData color.RGBA)

func FillGradient added in v0.1.3

func FillGradient(img *image.RGBA, startColor, endColor color.RGBA, orientation GradientOrientation)

func HexToRGBA

func HexToRGBA(hexCode string) (c color.RGBA, err error)

Convers hex color to color.RGBA

valid format: #000000 || #000

returns an error on inavlid fomat

func MergeRGBA added in v0.2.0

func MergeRGBA(main, overlay color.RGBA) color.RGBA

Merges two color.RGBA color

func NewImage added in v0.1.3

func NewImage(width, height int) *image.RGBA

func OpenImage

func OpenImage(imageBytes io.Reader) (decodedImage image.Image, err error)

func OpenImageByBytes

func OpenImageByBytes(imageBytes []byte) (decodedImage image.Image, err error)

func OpenImageByPath

func OpenImageByPath(imagePath string) (decodedImage image.Image, err error)

func OpenImageFromEFS

func OpenImageFromEFS(fileStorage fs.FS, path string) (decodedImage image.Image, err error)

func Paste added in v0.1.3

func Paste(img draw.Image, overlay image.Image, X, Y int)

func Resize

func Resize(mainImage image.Image, width, height float64, mode ResizeMode) image.Image

func Save

func Save(mainImage image.Image, path string) error

func SaveToStream

func SaveToStream(mainImage image.Image, writer io.Writer) error

func Write added in v0.1.3

func Write(img draw.Image, text string, textColor color.Color, fontStyle font.Face, X, Y int)

Types

type Gradient added in v0.2.0

type Gradient struct {
	R, G, B, A float64
	// contains filtered or unexported fields
}

func GetGradientColors added in v0.2.0

func GetGradientColors(of, with color.RGBA, radius float64) *Gradient

func (*Gradient) At added in v0.2.0

func (d *Gradient) At(radius float64) color.RGBA

type GradientOrientation

type GradientOrientation uint8
const (
	GradientOrientationHorizontal GradientOrientation = iota
	GradientOrientationVertical
)

type LlamaFont added in v0.1.3

type LlamaFont struct{ *truetype.Font }

func OpenFont

func OpenFont(fontBytes []byte) (*LlamaFont, error)

func (*LlamaFont) FitHeight added in v0.1.4

func (f *LlamaFont) FitHeight(maxHeight int) (font.Face, int)

func (*LlamaFont) FitTextWidth added in v0.1.4

func (f *LlamaFont) FitTextWidth(text string, fontSize float64, maxWidth int) (font.Face, int)

func (*LlamaFont) GetHeight added in v0.1.3

func (f *LlamaFont) GetHeight(fontSize float64) int

func (*LlamaFont) GetTextSize added in v0.1.3

func (f *LlamaFont) GetTextSize(fontSize float64, text string) (width, height int)

func (*LlamaFont) GetWidth added in v0.1.3

func (f *LlamaFont) GetWidth(fontSize float64, text string) int

func (*LlamaFont) NewFace added in v0.1.3

func (f *LlamaFont) NewFace(size float64) font.Face

type Point added in v0.2.0

type Point struct{ X, Y float64 }

type ResizeMode added in v0.1.5

type ResizeMode uint8
const (
	ResizeFit ResizeMode = iota
	ResizeFill
)

type Vector added in v0.1.8

type Vector struct {
	// contains filtered or unexported fields
}

func NewVector added in v0.1.8

func NewVector(width, height int) *Vector

func (*Vector) Draw added in v0.1.8

func (v *Vector) Draw(on draw.Image, with image.Image, onX, onY int) *Vector

func (*Vector) DrawOp added in v0.1.8

func (v *Vector) DrawOp(on draw.Image, with image.Image, onX, onY int) *Vector

func (*Vector) DrawOpX added in v0.2.0

func (v *Vector) DrawOpX(on draw.Image, with image.Image, onX, onY int) *Vector

func (*Vector) DrawX added in v0.2.0

func (v *Vector) DrawX(on draw.Image, with image.Image, onX, onY int) *Vector

func (*Vector) From added in v0.1.8

func (v *Vector) From(x, y int) *Vector

func (*Vector) Height added in v0.2.0

func (v *Vector) Height() int

func (*Vector) Reset added in v0.2.0

func (v *Vector) Reset() *Vector

func (*Vector) To added in v0.1.8

func (v *Vector) To(x, y int) *Vector

func (*Vector) Width added in v0.2.0

func (v *Vector) Width() int

Jump to

Keyboard shortcuts

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