ximage

package
v0.0.0-...-7c1eb0e Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResizeByWidth

func ResizeByWidth(srcFile string, dstFile string, width int, autoRotate bool, opt *ImageOption) (string, error)

func RgbaToNRGBA

func RgbaToNRGBA(rgba image.Image) *image.NRGBA

func Rotate180

func Rotate180(img image.Image) *image.NRGBA

func Rotate270

func Rotate270(img image.Image) *image.NRGBA

func Rotate90

func Rotate90(img image.Image) *image.NRGBA

func SaveToBuffer

func SaveToBuffer(imgType string, img image.Image) ([]byte, error)

func SaveToFile

func SaveToFile(filename string, imgType string, img image.Image) error

Types

type Circle

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

func (*Circle) At

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

func (*Circle) Bounds

func (c *Circle) Bounds() image.Rectangle

func (*Circle) ColorModel

func (c *Circle) ColorModel() color.Model

type DrawImageOption

type DrawImageOption struct {
	Opacity float64
	Center  bool
}

type DrawTextOption

type DrawTextOption struct {
	FontColor color.Color
	FontSize  float64
}

type ImageEx

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

func NewImage

func NewImage(width, height int) *ImageEx

func NewImageFromImage

func NewImageFromImage(fromImage image.Image) *ImageEx

func (*ImageEx) DrawBackground

func (me *ImageEx) DrawBackground(r, g, b int)

func (*ImageEx) DrawCircle

func (me *ImageEx) DrawCircle(src image.Image, srcX, srcY, r int, dstX, dstY int)

func (*ImageEx) DrawHLine

func (me *ImageEx) DrawHLine(color color.Color, x, fromY, toY int)

func (*ImageEx) DrawImage

func (me *ImageEx) DrawImage(x, y int, img image.Image, option *DrawImageOption) *image.NRGBA

func (*ImageEx) DrawImageByFile

func (me *ImageEx) DrawImageByFile(x, y int, imageFile string, option *DrawImageOption) error

func (*ImageEx) DrawLine

func (me *ImageEx) DrawLine(x0, y0, x1, y1 int, brush PutPixel)

func (*ImageEx) DrawText

func (me *ImageEx) DrawText(x int, y int, text string, fontColor color.Color, option *DrawTextOption) error

func (*ImageEx) DrawVLine

func (me *ImageEx) DrawVLine(color color.Color, fromX, toX, y int)

func (*ImageEx) GetImage

func (me *ImageEx) GetImage() image.Image

func (*ImageEx) GetImageRGB

func (me *ImageEx) GetImageRGB() *image.NRGBA

func (*ImageEx) LoadFromBuffer

func (me *ImageEx) LoadFromBuffer(buf []byte) (image.Image, error)

func (*ImageEx) LoadFromFile

func (me *ImageEx) LoadFromFile(filename string) (image.Image, error)

func (*ImageEx) Resize

func (me *ImageEx) Resize(width, height int)

func (*ImageEx) ResizePercent

func (me *ImageEx) ResizePercent(per int)

func (*ImageEx) SaveToBuffer

func (me *ImageEx) SaveToBuffer(w io.Writer, imgType string) error

func (*ImageEx) SaveToFile

func (me *ImageEx) SaveToFile(filename string, imgType string) error

func (*ImageEx) SaveToFileJPG

func (me *ImageEx) SaveToFileJPG(filename string, quality int) error

func (*ImageEx) SetFont

func (me *ImageEx) SetFont(font *truetype.Font)

func (*ImageEx) SetFontFile

func (me *ImageEx) SetFontFile(filename string) error

func (*ImageEx) SubImage

func (me *ImageEx) SubImage(x, y, w, h int) image.Image

func (*ImageEx) SubImageByPos

func (me *ImageEx) SubImageByPos(x0, y0, x1, y1 int) image.Image

type ImageOption

type ImageOption struct {
	JPGQuality   int
	PNGQuality   int
	CompressSize int64  // 最大图片文件的大小
	WaterMark    string // 水印
	WaterX       int
	WaterY       int
	WaterOpacity float64
}

type PutPixel

type PutPixel func(x, y int)

type RotateType

type RotateType int

func ReadOrientation

func ReadOrientation(filename string) RotateType

Jump to

Keyboard shortcuts

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