blend

package
v0.0.0-...-6905684 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package blend implements various blending mode functions between two images. These are modelled on those in Adobe Photoshop. Each function takes as the first argument the "base image" and the second the "blend image", they then return an image blending these in specific ways.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Addition

func Addition(a, b image.Image) image.Image

Addition adds the blend colour to the base colour. (aka. Linear Dodge)

func BlendPixel

func BlendPixel(cb, cs color.Color, f Blender) color.Color

BlendPixel implements the actual blending of colours, to form the resultant colour. It combines the backdrop color (cb), the source color (cs) along with the result formed by calling f on these two values.

func BlendPixels

func BlendPixels(a, b image.Image, f Blender) image.Image

BlendPixels takes the base and blend images and applies the given Blender to each of their pixel pairs.

func Burn

func Burn(a, b image.Image) image.Image

Burn darkens the base colour to reflect the blend colour.

func Color

func Color(a, b image.Image) image.Image

Color uses the hue and saturation of the blend colour, with the luminosity of the base colour.

func Darken

func Darken(a, b image.Image) image.Image

Darken selects the darkest value for each pixels' colour channels.

func Darker

func Darker(a, b image.Image) image.Image

Darker chooses the darkest colour by comparing the sum of the colour channels.

func Difference

func Difference(a, b image.Image) image.Image

Difference finds the absolute difference between the base and blend colours.

func Dissolve

func Dissolve(a, b image.Image) image.Image

Dissolve randomly selects pixels from the blend image, depending on their opacity. Blend pixels with higher opacities are more likely to be displayed.

func Dodge

func Dodge(a, b image.Image) image.Image

Dodge brightens the base colour to reflect the blend colour.

func Exclusion

func Exclusion(a, b image.Image) image.Image

Exclusion creates an effect similar to, but lower in contrast than, difference.

func Fade

func Fade(img image.Image, amount float64) image.Image

Fade changes the opacity of the Image given by the amount given. The resulting opacity is the product of the image's opacity and the amount, so a value of 1 has no effect whilst a value of 0 makes the image fully transparent.

func HardLight

func HardLight(a, b image.Image) image.Image

HardLight multiplies or screens the colours, depending on the blend colour. The effect is similar to shining a harsh spotlight on the image.

func HardMix

func HardMix(a, b image.Image) image.Image

HardMix adds the red, green and blue channel values of the blend colour to the RGB values of the base colour. It sets any values greater than 255 to 255, and anything less to 0. This therefore makes all pixels either red, green, blue, white or black.

func Hue

func Hue(a, b image.Image) image.Image

Hue uses the hue of the blend colour, with the saturation and luminosity of the base colour.

func Lighten

func Lighten(a, b image.Image) image.Image

Lightne selects the lighter of each pixels' colour channels.

func Lighter

func Lighter(a, b image.Image) image.Image

Lighter chooses the lightest colour by comparing the sum of the colour channels.

func LinearBurn

func LinearBurn(a, b image.Image) image.Image

LinearBurn adds the values of each colour channel together, then subtracts white to produce a darker image.

func LinearDodge

func LinearDodge(a, b image.Image) image.Image

LinearDodge adds the values for each colour channel together.

func LinearLight

func LinearLight(a, b image.Image) image.Image

LinearLight lightens or darkens the image by changing the brightness. If the blend colour is lighter, the image is lightened; if the blend colour is darker, the image is darkened. It uses linear burn and linear dodge to darken or lighten.

func Luminosity

func Luminosity(a, b image.Image) image.Image

Luminosity uses the luminosity of the blend colour, with the hue and saturation of the base colour.

func Multiply

func Multiply(a, b image.Image) image.Image

Multiply multiplies the base and blend image colour channels.

func Normal

func Normal(a, b image.Image) image.Image

Normal selects the blend Image.

func Overlay

func Overlay(a, b image.Image) image.Image

Overlay multiplies or screens the colours, depending on the base colour.

func PinLight

func PinLight(a, b image.Image) image.Image

PinLight replaces the colours, depending on the blend colour.

func Saturation

func Saturation(a, b image.Image) image.Image

Saturation uses the saturation of the blend colour, with the hue and luminosity of the base colour.

func Screen

func Screen(a, b image.Image) image.Image

Screen multiplies the complements of the base and blend colour channel values, then complements the result.

func SoftLight

func SoftLight(a, b image.Image) image.Image

SoftLight darkens or lightens the colours, depending on the blend colour. The effect is similar to shining a soft spotlight on the image.

func Subtraction

func Subtraction(a, b image.Image) image.Image

Subtraction subtracts the blend colour from the base colour.

func VividLight

func VividLight(a, b image.Image) image.Image

VividLight combines Dodge and Burn. Dodge applies to lighter colours, and Burn to darker.

Types

type Blender

type Blender (func(c, d color.Color) color.Color)

Blender takes two colours (base and blend, respectively) and returns another colour.

Jump to

Keyboard shortcuts

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