picture

package
v0.0.0-...-b51443a Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QRCode

func QRCode(url string, size int) (image.Image, error)

QRCode make qr code demo:QRCode("https://bycoin.im?invitecode=XXXYYY", 256)

Types

type Canvas

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

Canvas wrapper image

func NewCanvas

func NewCanvas(width, height int, color *image.Uniform) *Canvas

NewCanvas return unicolor image

func NewCanvasWith

func NewCanvasWith(r io.Reader) (*Canvas, error)

NewCanvasWith make image with io.Reader

func (*Canvas) Draw

func (c *Canvas) Draw(pos image.Point, m image.Image) error

Draw use other image mask to canvas

func (*Canvas) DrawText

func (c *Canvas) DrawText(pos image.Point, context *Context, strs []string) error

DrawText draw text to canvas

func (*Canvas) Image

func (c *Canvas) Image() draw.Image

Image return draw.Image

func (*Canvas) New

func (c *Canvas) New() *Canvas

New return a new Canvas

func (*Canvas) WriteTo

func (c *Canvas) WriteTo(file string) (fullName string, err error)

WriteTo write image to file, the file arg without expanded-name

type Context

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

Context text setting

func NewContext

func NewContext(fontfile string, size, dpi, spacing float64, color *image.Uniform) (*Context, error)

NewContext new a text setting

func (*Context) DrawString

func (c *Context) DrawString(s string, p fixed.Point26_6) (fixed.Point26_6, error)

DrawString draw string

func (*Context) PointToFixed

func (c *Context) PointToFixed(x float64) fixed.Int26_6

PointToFixed converts the given number of points (as in "a 12 point font") into a 26.6 fixed point number of pixels.

func (*Context) SetDst

func (c *Context) SetDst(clip image.Rectangle, dst draw.Image)

SetDst set draw dst

func (*Context) Size

func (c *Context) Size() float64

Size font size

Jump to

Keyboard shortcuts

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