zimage

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

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

Go to latest
Published: Nov 10, 2026 License: MPL-2.0 Imports: 24 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GlobalURLPrefix     string
	MainScreenScaleFunc = func() float64 {
		return 1
	}
)

Functions

func CloneGoImage

func CloneGoImage(src image.Image) draw.Image

func DrawCircle

func DrawCircle(img SetableImage, circle zgeo.Circle, col zgeo.Color)

func FromGo

func FromGo(img image.Image, got func(image *Image))

func FromPath

func FromPath(path string, useCache bool, got func(*Image))

func FromPathAddScreenScaleSuffix

func FromPathAddScreenScaleSuffix(spath string, useCache bool, got func(*Image))

func GetImages

func GetImages(images []*ImageGetter, useCache bool, got func(all bool))

GetImages goes thu the ImageGetter's scaling/tinting images, returning when all are done. Release() is NOT called on input or output images

func GoAlterPixels

func GoAlterPixels(img SetableImage, set func(x, y int, c zgeo.Color) zgeo.Color)

GoAlterPixels calls set for the pixel at set's x, y, and sets it if the color returned is Valid

func GoForPixels

func GoForPixels(img image.Image, got func(x, y int, color zgeo.Color))

func GoImageBlurred

func GoImageBlurred(img image.Image, sigma float64) *image.NRGBA

func GoImageCropped

func GoImageCropped(img image.Image, crop zgeo.Rect, copy bool) (image.Image, error)

func GoImageFlippedHorizontal

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

func GoImageFlippedVertical

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

func GoImageFromFile

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

func GoImageFromURL

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

func GoImageJPEGData

func GoImageJPEGData(goImage image.Image, qualityPercent int) ([]byte, error)

func GoImagePNGData

func GoImagePNGData(goImage image.Image) ([]byte, error)

func GoImageShrunkCroppedToFillSize

func GoImageShrunkCroppedToFillSize(img image.Image, size zgeo.Size, proportional bool) (image.Image, error)

func GoImageShrunkInto

func GoImageShrunkInto(goImage image.Image, size zgeo.Size, proportional bool) (image.Image, error)

GGoImageShrunkInto scales down the image to fit inside size. It must be a subset of standard libarary image types, as it uses rez package to downsample, which works on underlying image types.

func GoImageToGoRGBA

func GoImageToGoRGBA(i image.Image) image.Image

func GoImageToJPEGFile

func GoImageToJPEGFile(img image.Image, filepath string, qualityPercent int) error

func GoImageToNRGBA

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

func GoImageToPNGFile

func GoImageToPNGFile(img image.Image, filepath string) error

func GoImageZSize

func GoImageZSize(img image.Image) zgeo.Size

func GoImagesAreIdentical

func GoImagesAreIdentical(img1, img2 image.Image) bool

func GoImagesDiffAreaRatio

func GoImagesDiffAreaRatio(a, b image.Image, pixelDiffPercent float64, doAlpha bool) float64

func GoTransformed

func GoTransformed(img image.Image, set func(x, y int, c zgeo.Color) zgeo.Color) *image.NRGBA

GoTransformed creates a new image where if set returns a valid color, it uses that, otherwise old.

func ImageFromFile

func ImageFromFile(filepath string, got func(i *Image, format string, err error))

func IsImageExtensionInName

func IsImageExtensionInName(surl string) bool

func MakeImagePathWithAddedScale

func MakeImagePathWithAddedScale(spath string, scale int) string

func NewGoWithNoise

func NewGoWithNoise(img image.Image, noiseCoverage float32, noiseMix float32) *image.NRGBA

Types

type Image

type Image struct {
	Scale   int
	Path    string
	Loading bool
	// contains filtered or unexported fields
}

func ImageNewNRGBA

func ImageNewNRGBA(size zgeo.Size) *Image

func (*Image) CapInsets

func (i *Image) CapInsets() zgeo.Rect

func (*Image) Colored

func (i *Image) Colored(color zgeo.Color, size zgeo.Size) *Image

func (*Image) FixedOrientation

func (i *Image) FixedOrientation() *Image

func (*Image) ForPixels

func (i *Image) ForPixels(got func(x, y int, color zgeo.Color))

func (*Image) GetLeftRightFlipped

func (i *Image) GetLeftRightFlipped() *Image

func (*Image) GetRotationAdjusted

func (i *Image) GetRotationAdjusted(flip bool) *Image

func (*Image) HasAlpha

func (i *Image) HasAlpha() bool

func (*Image) MixedWithColor

func (i *Image) MixedWithColor(color zgeo.Color, amount float32, got func(i *Image))

func (*Image) Normalized

func (i *Image) Normalized() *Image

func (*Image) RGBAImage

func (i *Image) RGBAImage(got func(img *Image))

func (*Image) Release

func (i *Image) Release()

func (*Image) Rotated

func (i *Image) Rotated(deg float64, around *zgeo.Pos) *Image

func (*Image) SaveToPNG

func (i *Image) SaveToPNG(filepath string) error

func (*Image) SetCapInsets

func (i *Image) SetCapInsets(capInsets zgeo.Rect) *Image

func (*Image) SetCapInsetsCorner

func (i *Image) SetCapInsetsCorner(c zgeo.Size) *Image

func (*Image) ShrunkInto

func (i *Image) ShrunkInto(size zgeo.Size, proportional bool, got func(*Image))

func (*Image) Size

func (i *Image) Size() zgeo.Size

func (*Image) TintedWithColor

func (i *Image) TintedWithColor(color zgeo.Color, amount float32, got func(i *Image))

func (*Image) ToGo

func (i *Image) ToGo() image.Image

type ImageGetter

type ImageGetter struct {
	Path       string
	Image      *Image
	Tint       zgeo.Color
	TintAmount float32
	MaxSize    zgeo.Size

	Alignment zgeo.Alignment
	Margin    zgeo.Size
	Opacity   float32
}

func ImageGetterNew

func ImageGetterNew() *ImageGetter

type Loader

type Loader interface {
	IsLoading() bool
}

type Owner

type Owner interface {
	GetImage() *Image
	SetImage(image *Image, path string, got func(*Image))
}

type SetableImage

type SetableImage interface {
	image.Image
	Set(x, y int, c color.Color)
}

func GoImagesChangeDifference

func GoImagesChangeDifference(img1, img2 image.Image, change func(imgSet SetableImage, amount float32, c1, c2 color.Color, x, y int)) (diffImage SetableImage, changedAmount float32)

type SolidImage

type SolidImage struct {
	Size zgeo.Size
	// contains filtered or unexported fields
}

func MakeSolidImage

func MakeSolidImage(size zgeo.Size, col zgeo.Color) SolidImage

func (SolidImage) At

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

func (SolidImage) Bounds

func (c SolidImage) Bounds() image.Rectangle

func (SolidImage) ColorModel

func (c SolidImage) ColorModel() color.Model

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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