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 ¶
- func Addition(a, b image.Image) image.Image
- func BlendPixel(cb, cs color.Color, f Blender) color.Color
- func BlendPixels(a, b image.Image, f Blender) image.Image
- func Burn(a, b image.Image) image.Image
- func Color(a, b image.Image) image.Image
- func Darken(a, b image.Image) image.Image
- func Darker(a, b image.Image) image.Image
- func Difference(a, b image.Image) image.Image
- func Dissolve(a, b image.Image) image.Image
- func Dodge(a, b image.Image) image.Image
- func Exclusion(a, b image.Image) image.Image
- func Fade(img image.Image, amount float64) image.Image
- func HardLight(a, b image.Image) image.Image
- func HardMix(a, b image.Image) image.Image
- func Hue(a, b image.Image) image.Image
- func Lighten(a, b image.Image) image.Image
- func Lighter(a, b image.Image) image.Image
- func LinearBurn(a, b image.Image) image.Image
- func LinearDodge(a, b image.Image) image.Image
- func LinearLight(a, b image.Image) image.Image
- func Luminosity(a, b image.Image) image.Image
- func Multiply(a, b image.Image) image.Image
- func Normal(a, b image.Image) image.Image
- func Overlay(a, b image.Image) image.Image
- func PinLight(a, b image.Image) image.Image
- func Saturation(a, b image.Image) image.Image
- func Screen(a, b image.Image) image.Image
- func SoftLight(a, b image.Image) image.Image
- func Subtraction(a, b image.Image) image.Image
- func VividLight(a, b image.Image) image.Image
- type Blender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlendPixel ¶
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 ¶
BlendPixels takes the base and blend images and applies the given Blender to each of their pixel pairs.
func Color ¶
Color uses the hue and saturation of the blend colour, with the luminosity of the base colour.
func Difference ¶
Difference finds the absolute difference between the base and blend colours.
func Dissolve ¶
Dissolve randomly selects pixels from the blend image, depending on their opacity. Blend pixels with higher opacities are more likely to be displayed.
func Fade ¶
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 ¶
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 ¶
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 ¶
Hue uses the hue of the blend colour, with the saturation and luminosity of the base colour.
func LinearBurn ¶
LinearBurn adds the values of each colour channel together, then subtracts white to produce a darker image.
func LinearDodge ¶
LinearDodge adds the values for each colour channel together.
func LinearLight ¶
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 ¶
Luminosity uses the luminosity of the blend colour, with the hue and saturation of the base colour.
func Saturation ¶
Saturation uses the saturation of the blend colour, with the hue and luminosity of the base colour.
func Screen ¶
Screen multiplies the complements of the base and blend colour channel values, then complements the result.
func SoftLight ¶
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 ¶
Subtraction subtracts the blend colour from the base colour.