core

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp[T cmp.Ordered](value, mn, mx T) T

func IntersectNRGBA

func IntersectNRGBA(dst *image.NRGBA, r image.Rectangle, src *image.NRGBA, sp image.Point, out *image.NRGBA, op image.Point) image.Rectangle

func IntersectRGBA

func IntersectRGBA(dst *image.RGBA, r image.Rectangle, src *image.RGBA, sp image.Point, out *image.RGBA, op image.Point) image.Rectangle

func IsColorModelSupported

func IsColorModelSupported(model color.Model) bool

func Iterate

func Iterate[T image.Image](pixIter PixelIterator, pixCalc PixCalculator[T], fn func(dst, src, out []uint8)) T

Types

type Config

type Config interface {
	PixelIterator() PixelIterator
	DefaultOutputMode() DefaultOutputMode
	DefaultColorModel() color.Model
}

type DefaultOutputMode

type DefaultOutputMode int
const (
	DefaultOutputToDst DefaultOutputMode = iota
	DefaultOutputToNewImage
)

func (DefaultOutputMode) ToOutputMode

func (m DefaultOutputMode) ToOutputMode() OutputMode

type Output

type Output interface {
	OutputMode() OutputMode
	ColorModel() color.Model
	ProvidedImage() (image.Image, image.Point)
}

func ToDst

func ToDst() Output

func ToImage

func ToImage(img image.Image, pt image.Point) Output

func ToNewImage

func ToNewImage() Output

func ToNewNRGBAImage

func ToNewNRGBAImage() Output

func ToNewRGBAImage

func ToNewRGBAImage() Output

type OutputMode

type OutputMode int
const (
	OutputToDst OutputMode = iota
	OutputToNewImage
	OutputToProvidedImage
)

type ParallelPixelIterator

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

ParallelPixelIterator iterates over a PixRowCalculator in parallel with the specified concurrency.

func NewParallelPixelIterator

func NewParallelPixelIterator(concurrency int) ParallelPixelIterator

NewParallelPixelIterator creates a new ParallelPixelIterator. Concurrency specifies the number of goroutines to use for parallel processing. Each iteration will create its own set of goroutines, so concurrently processing multiple images will result in multiple sets of goroutines.

func (ParallelPixelIterator) Iterate

func (ppi ParallelPixelIterator) Iterate(pixCalc PixRowCalculator, fn func(dst, src, out []uint8))

type PixCalculator

type PixCalculator[T image.Image] interface {
	PixRowCalculator
	Result() T
}

func NewPixCalculatorNRGBA

func NewPixCalculatorNRGBA(dst *image.NRGBA, r image.Rectangle, src *image.NRGBA, srcPt image.Point, out *image.NRGBA, outPt image.Point) PixCalculator[*image.NRGBA]

func NewPixCalculatorRGBA

func NewPixCalculatorRGBA(dst *image.RGBA, r image.Rectangle, src *image.RGBA, srcPt image.Point, out *image.RGBA, outPt image.Point) PixCalculator[*image.RGBA]

type PixRowCalculator

type PixRowCalculator interface {
	Rect() image.Rectangle
	Calculate(row int) (dst, src, out []uint8)
}

type PixelIterator

type PixelIterator interface {
	Iterate(pixCalc PixRowCalculator, fn func(dst, src, out []uint8))
}

func NewPixelIterator

func NewPixelIterator(concurrency int) PixelIterator

type SerialPixelIterator

type SerialPixelIterator struct{}

SerialPixelIterator iterates over a PixRowCalculator in serial with no concurrency.

func NewSerialPixelIterator

func NewSerialPixelIterator() SerialPixelIterator

NewSerialPixelIterator creates a new SerialPixelIterator.

func (SerialPixelIterator) Iterate

func (i SerialPixelIterator) Iterate(pixCalc PixRowCalculator, fn func(dst, src, out []uint8))

Jump to

Keyboard shortcuts

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