pixel

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package pixels provides methods for altering images at a per-pixel level.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplacePixels

func ReplacePixels(im image.Image, cb PixelFunc) (image.Image, error)

ReplacePixels replaces all the pixels in 'im' according to rules defined by 'cb'.

Types

type PixelFunc

type PixelFunc func(int, int, color.Color) (color.Color, error)

PixelFunc defines a function that will return a new colour for a given pixel colour at an x, y coordinate.

func MakeMultiPixelFunc

func MakeMultiPixelFunc(funcs ...PixelFunc) (PixelFunc, error)

MakeMultiPixelFunc will return a new `PixelFunc` instance that will invoke apply the functions defined in 'funcs'.

func MakeReplacePixelFunc

func MakeReplacePixelFunc(matches ...ReplacePixelKey) (PixelFunc, error)

MakeReplacePixelFunc returns a new `PixelFunc` instance that will match and replace colours defined by 'matches'.

func MakeTransparentPixelFunc

func MakeTransparentPixelFunc(matches ...color.Color) (PixelFunc, error)

MakeTransparentPixelFunc returns a new `PixelFunc` instance that will replace pixels matching colours defined by 'matches' with transparent values.

type ReplacePixelKey

type ReplacePixelKey struct {
	// Zero or more `color.Color` instances whose pixel values will be replaced.
	Candidates []color.Color
	// Replacement is a `color.Color` instance that will be used to replace specific pixels.
	Replacement color.Color
}

ReplacePixelKey is a struct that defines candidate pixel colours to replace with another colour

Jump to

Keyboard shortcuts

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