color

package
v0.0.0-...-50cf7ee Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blue

func Blue(col color.Color) (color.Color, error)

Blue maps to just the blue component in 8 bits

func Blue16

func Blue16(col color.Color) (color.Color, error)

Blue16 maps to just the blue component in 16 bits

func Brighten

func Brighten(amount uint32) graph.Mapper

Brighten is a Mapper that will increase the R, G and B components by a fixed amount.

func Darken

func Darken(amount uint32) graph.Mapper

Darken is a Mapper that will decrease the R, G and B components by a fixed amount.

func Green

func Green(col color.Color) (color.Color, error)

Green maps to just the blue component in 8 bits

func Green16

func Green16(col color.Color) (color.Color, error)

Green16 maps to just the blue component in 16 bits

func InvertColor

func InvertColor(col color.Color) color.Color

InvertColor is a Mapper to invert an image

func Level

func Level(r1, g1, b1 uint32, f func(a, b uint32) uint32) graph.Mapper

Level will apply a function against the R, G and B components of a pixel, replacing it with the result. This is the implementation behind MinLevel and MaxLevel which use the util.MinU32 and util.MaxU32 functions. The first parameter passed to this function are the parameters of this function. The second parameter is from the pixel.

func Map

func Map(f graph.Mapper) graph.Filter

Map applies a simple mapping function against the pixel Map.

func MaxLevel

func MaxLevel(r1, g1, b1 uint32) graph.Mapper

MaxLevel is a Mapper that will ensure the image contains the maximum of each component. This can be used to set the lower limit in an image, clipping entries that are too dark.

func MinLevel

func MinLevel(r1, g1, b1 uint32) graph.Mapper

MinLevel is a Mapper that will ensure the image contains the minimum of each component. This can be used to set the upper limit in an image, clipping entries that are too bright.

func Mono

func Mono(col color.Color) (color.Color, error)

Mono is a Mapper which converts an image into greyscale.

It does this by just keeping the Green channel, as the human eye is more receptive to this channel.

It's also how most colour scanners do greyscale by scanning in colour & taking just the green component.

func Mono16

func Mono16(col color.Color) (color.Color, error)

Mono16 is a Mapper which converts an image into greyscale. The default implementationm is to use It does this by just keeping the Green channel, as the human eye is more receptive to this channel.

It's also how most colour scanners do greyscale by scanning in colour & taking just the green component.

func Red

func Red(col color.Color) (color.Color, error)

Red maps to just the red component in 8 bits

func Red16

func Red16(col color.Color) (color.Color, error)

Red16 maps to just the red component in 16 bits

Types

type DeltaRGB

type DeltaRGB struct {
	R, G, B int
}

DeltaRGB contains the differences to apply to an RGBA colour in an AdjustImageFilter

func (DeltaRGB) Apply

func (d DeltaRGB) Apply(c color.Color) (color.Color, error)

type Histogram

type Histogram struct {
	Red   []uint32
	Green []uint32
	Blue  []uint32
}

Histogram represents the total number of pixels in an image based on RGB values

func NewHistogram

func NewHistogram() *Histogram

func (*Histogram) Add

func (h *Histogram) Add(c color.Color) *Histogram

Add adds a color.Color to the Histogram

func (*Histogram) AnalyzeFilter

func (h *Histogram) AnalyzeFilter(_, _ int, c color.Color) (color.Color, error)

AnalyzeFilter analyzes an image placing the results in the histogram

func (*Histogram) AnalyzeImage

func (h *Histogram) AnalyzeImage(src image.Image) *Histogram

AnalyzeImage analyzes an image placing the results in the histogram

func (*Histogram) DeltaRGB

func (h *Histogram) DeltaRGB() DeltaRGB

func (*Histogram) ResetValue

func (h *Histogram) ResetValue(x int) *Histogram

ResetValue sets the histogram values at x to 0. Used after Analyze to remove high known values which affects the results. Eg an image of mostly black needs black removed.

func (*Histogram) ResetValuesAbove

func (h *Histogram) ResetValuesAbove(v int) *Histogram

ResetValuesAbove sets the histogram values above v to 0. Used after Analyze to remove high known values which affects the results. Eg an image of mostly white needs white

func (*Histogram) ResetValuesBelow

func (h *Histogram) ResetValuesBelow(v int) *Histogram

ResetValuesBelow sets the histogram values below v to 0. Used after Analyze to remove high known values which affects the results. Eg an image of mostly black needs black removed.

Jump to

Keyboard shortcuts

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