graph

package
v0.0.0-...-6f71fe9 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package graph is a suite of utilities for performing various operation's on an Image

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter func(x, y int, col color.Color) (color.Color, error)

Filter is a basic mapping function that is supplied with a Pixel and returns the new colour for that Pixel.

func Of

func Of(filters ...Filter) Filter

Of returns a Filter based on the supplied filters

func (Filter) Do

func (f Filter) Do(src image.Image, dst Image, b image.Rectangle) error

Do apply the filter against the source image, writing the result to the destination over the area defined by the supplied rectangle.

func (Filter) DoNew

func (f Filter) DoNew(src image.Image) (Image, error)

DoNew applies the filter against an image, returning a new mutable image with the result.

func (Filter) DoOver

func (f Filter) DoOver(src Image) error

DoOver applies the filter over the supplied mutable image, overwriting its previous state.

func (Filter) Then

func (f Filter) Then(b Filter) Filter

Then returns a Filter that will run this one then the subsequent one in sequence

type Image

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

Image is an image.Image with a Set method to change a single pixel.

func Crop

func Crop(src image.Image, bounds image.Rectangle) Image

Crop will crop an image to fit the required bounds

func DuplicateImage

func DuplicateImage(img image.Image) Image

DuplicateImage creates a new copy of an image which is also mutable

func Expand

func Expand(src image.Image, top, left, bottom, right int) Image

Expand will add the specified number of pixels to the edges of an Image

func Immutable

func Immutable(img image.Image) Image

Immutable returns an immutable image

func NewRGBA

func NewRGBA(img image.Image) Image

NewRGBA creates a new mutable image with the same dimensions of another image

func NewRGBAImage

func NewRGBAImage(bounds image.Rectangle) Image

type Mapper

type Mapper func(col color.Color) (color.Color, error)

Mapper is a function that can transform a color.Color to another

func (Mapper) Filter

func (m Mapper) Filter() Filter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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