filter

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blur

type Blur struct {
	// The widget to apply the blur to.
	render.Widget `starlark:"child,required"`

	// The radius of the Gaussian blur.
	Radius float64 `starlark:"radius,required"`
}

Blur applies a Gaussian blur to the child widget.

Example:

filter.Blur(
    child = render.Image(src="...", width=64, height=64),
    radius = 2.0,
)

func (Blur) Paint

func (b Blur) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

func (Blur) PaintBounds

func (b Blur) PaintBounds(bounds image.Rectangle, frameIdx int) image.Rectangle

type Brightness

type Brightness struct {
	// The widget to adjust brightness for.
	render.Widget `starlark:"child,required"`

	// The amount to change brightness by. -1.0 is black, 1.0 is white, 0.0 is no change.
	Change float64 `starlark:"change,required"`
}

Brightness adjusts the brightness of the child widget.

Example:

filter.Brightness(
    child = render.Image(src="...", width=64, height=64),
    change = -0.5,
)

func (Brightness) Paint

func (b Brightness) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Contrast

type Contrast struct {
	// The widget to adjust contrast for.
	render.Widget `starlark:"child,required"`

	// The factor to adjust contrast by. -1.0 is gray, 1.0 is no change, > 1.0 increases contrast.
	Factor float64 `starlark:"factor,required"`
}

Contrast adjusts the contrast of the child widget.

Example:

filter.Contrast(
    child = render.Image(src="...", width=64, height=64),
    factor = 2.0,
)

func (Contrast) Paint

func (c Contrast) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type EdgeDetection

type EdgeDetection struct {
	// The widget to detect edges on.
	render.Widget `starlark:"child,required"`

	// The radius of the edge detection kernel.
	Radius float64 `starlark:"radius,required"`
}

EdgeDetection applies an edge detection filter to the child widget.

Example:

filter.EdgeDetection(
    child = render.Image(src="...", width=64, height=64),
    radius = 2.0,
)

func (EdgeDetection) Paint

func (e EdgeDetection) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Emboss

type Emboss struct {
	// The widget to emboss.
	render.Widget `starlark:"child,required"`
}

Emboss applies an emboss filter to the child widget.

Example:

filter.Emboss(
    child = render.Image(src="...", width=64, height=64),
)

func (Emboss) Paint

func (e Emboss) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type FlipHorizontal

type FlipHorizontal struct {
	// The widget to flip.
	render.Widget `starlark:"child,required"`
}

FlipHorizontal flips the child widget horizontally.

Example:

filter.FlipHorizontal(
    child = render.Image(src="...", width=64, height=64),
)

func (FlipHorizontal) Paint

func (f FlipHorizontal) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type FlipVertical

type FlipVertical struct {
	// The widget to flip.
	render.Widget `starlark:"child,required"`
}

FlipVertical flips the child widget vertically.

Example:

filter.FlipVertical(
    child = render.Image(src="...", width=64, height=64),
)

func (FlipVertical) Paint

func (f FlipVertical) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Gamma

type Gamma struct {
	// The widget to apply gamma correction to.
	render.Widget `starlark:"child,required"`

	// The gamma value. 1.0 is no change, < 1.0 darkens, > 1.0 lightens.
	Gamma float64 `starlark:"gamma,required"`
}

Gamma applies gamma correction to the child widget.

Example:

filter.Gamma(
    child = render.Image(src="...", width=64, height=64),
    gamma = 0.5,
)

func (Gamma) Paint

func (g Gamma) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Grayscale

type Grayscale struct {
	// The widget to convert to grayscale.
	render.Widget `starlark:"child,required"`
}

Grayscale converts the child widget to grayscale.

Example:

filter.Grayscale(
    child = render.Image(src="...", width=64, height=64),
)

func (Grayscale) Paint

func (g Grayscale) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Hue

type Hue struct {
	// The widget to adjust hue for.
	render.Widget `starlark:"child,required"`

	// The amount to change hue by in degrees.
	Change float64 `starlark:"change,required"`
}

Hue adjusts the hue of the child widget.

Example:

filter.Hue(
    child = render.Image(src="...", width=64, height=64),
    change = 180.0,
)

func (Hue) Paint

func (h Hue) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Invert

type Invert struct {
	// The widget to invert.
	render.Widget `starlark:"child,required"`
}

Invert inverts the colors of the child widget.

Example:

filter.Invert(
    child = render.Image(src="...", width=64, height=64),
)

func (Invert) Paint

func (i Invert) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Rotate

type Rotate struct {
	// The widget to rotate.
	render.Widget `starlark:"child,required"`

	// The angle to rotate by in degrees.
	Angle float64 `starlark:"angle,required"`
}

Rotate rotates the child widget by the specified angle.

Example:

filter.Rotate(
    child = render.Image(src="...", width=64, height=64),
    angle = 10.0,
)

func (Rotate) Paint

func (r Rotate) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

func (Rotate) PaintBounds

func (r Rotate) PaintBounds(bounds image.Rectangle, frameIdx int) image.Rectangle

type Saturation

type Saturation struct {
	// The widget to adjust saturation for.
	render.Widget `starlark:"child,required"`

	// The factor to adjust saturation by. 0.0 is grayscale, 1.0 is no change, > 1.0 increases saturation.
	Factor float64 `starlark:"factor,required"`
}

Saturation adjusts the saturation of the child widget.

Example:

filter.Saturation(
    child = render.Image(src="...", width=64, height=64),
    factor = 1,
)

func (Saturation) Paint

func (s Saturation) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Sepia

type Sepia struct {
	// The widget to apply sepia to.
	render.Widget `starlark:"child,required"`
}

Sepia applies a sepia filter to the child widget.

Example:

filter.Sepia(
    child = render.Image(src="...", width=64, height=64),
)

func (Sepia) Paint

func (s Sepia) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Sharpen

type Sharpen struct {
	// The widget to sharpen.
	render.Widget `starlark:"child,required"`
}

Sharpen sharpens the child widget.

Example:

filter.Sharpen(
    child = render.Image(src="...", width=64, height=64),
)

func (Sharpen) Paint

func (s Sharpen) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

type Shear

type Shear struct {
	// The widget to shear.
	render.Widget `starlark:"child,required"`

	// The angle to shear horizontally in degrees.
	XAngle float64 `starlark:"x_angle"`
	// The angle to shear vertically in degrees.
	YAngle float64 `starlark:"y_angle"`
}

Shear shears the child widget horizontally and/or vertically.

Example:

filter.Shear(
    child = render.Image(src="...", width=64, height=64),
    x_angle = 10.0,
)

func (Shear) Paint

func (s Shear) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

func (Shear) PaintBounds

func (s Shear) PaintBounds(bounds image.Rectangle, frameIdx int) image.Rectangle

type Threshold

type Threshold struct {
	// The widget to apply threshold to.
	render.Widget `starlark:"child,required"`

	// The threshold level, from 0 to 255.
	Level float64 `starlark:"level,required"`
}

Threshold applies a threshold filter to the child widget, making it black and white.

Example:

filter.Threshold(
    child = render.Image(src="...", width=64, height=64),
    level = 128.0,
)

func (Threshold) Paint

func (t Threshold) Paint(dc *gg.Context, bounds image.Rectangle, frameIdx int)

Jump to

Keyboard shortcuts

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