Documentation ¶
Overview ¶
Package crossfade implements blending mode functions between images, and some utility functions for image processing.
The fundamental part of the library is the type BlendFunc, the function is applied to each pixel where the top layer (src) overlaps the bottom layer (dst) of both given 'image' interfaces.
This library provides many of the widely used blending functions to be used either as 'mode' parameter to the Blend() primary function, or to be used individually providing two 'color' interfaces. You can implement your own blending modes and pass them into the Blend() function.
This is the list of the currently implemented blending modes:
Add, Color, Color Burn, Color Dodge, Darken, Darker Color, Difference, Divide, Exclusion, Hard Light, Hard Mix, Hue, Lighten, Lighter Color, Linear Burn, Linear Dodge, Linear Light, Luminosity, Multiply, Overlay, Phoenix, Pin Light, Reflex, Saturation, Screen, Soft Light, Substract, Vivid Light.
Index ¶
- Variables
- func BlendImage(dst draw.Image, src image.Image, mode BlendFunc)
- func BlendNewImage(dst, src image.Image, mode BlendFunc) image.Image
- func DemosceneMix(img1, img2 image.Image, ratio, contrast float64) image.Image
- func Files(inFilename1, inFilename2, outFilename string, ratio float64) error
- type BlendFunc
Constants ¶
This section is empty.
Variables ¶
var ( SMul = 1.0 DMul = 1.0 )
Used by MIX and OVERLAY MIX to multiply with the source and destination color values
Functions ¶
func BlendImage ¶
Blends src image (top layer) into dst image (bottom layer) using the BlendFunc provided by mode. BlendFunc is applied to each pixel where the src image overlaps the dst image and the result is stored in the original dst image, src image is unmutable.
func BlendNewImage ¶
Blends src image (top layer) into dst image (bottom layer) using the BlendFunc provided by mode. BlendFunc is applied to each pixel where the src image overlaps the dst image and returns the resulting image without modifying src, or dst as they are both unmutable.
func DemosceneMix ¶
Experimental mix of two images, with a given ratio and contrast. Try ratio: 0.5 and contrast: 4.0.
Types ¶
type BlendFunc ¶
A blend function or blend mode receives a destination color and a source color, then returns a transformation of them. Blend() function receives a BlendFunc and applies it to every pixel in the overlaping areas of two given images.
var ( Add BlendFunc Color BlendFunc ColorBurn BlendFunc ColorDodge BlendFunc Darken BlendFunc DarkerColor BlendFunc Difference BlendFunc Divide BlendFunc Exclusion BlendFunc HardLight BlendFunc HardMix BlendFunc Hue BlendFunc Lighten BlendFunc LighterColor BlendFunc LinearBurn BlendFunc LinearDodge BlendFunc LinearLight BlendFunc Luminosity BlendFunc Multiply BlendFunc Overlay BlendFunc Mix BlendFunc OverlayMix BlendFunc Phoenix BlendFunc PinLight BlendFunc Reflex BlendFunc Saturation BlendFunc Screen BlendFunc SoftLight BlendFunc Substract BlendFunc VividLight BlendFunc )