blend: github.com/phrozen/blend Index | Files

package blend

import "github.com/phrozen/blend"

Package blend implements blending mode functions bewteen 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.

Check github for more details: http://github.com/phrozen/blend

Index

Package Files

blend.go color.go image.go render.go utils.go

func BlendImage Uses

func BlendImage(dst draw.Image, src image.Image, mode BlendFunc)

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 Uses

func BlendNewImage(dst, src image.Image, mode BlendFunc) image.Image

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.

type BlendFunc Uses

type BlendFunc func(dst, src color.Color) color.Color

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
    Phoenix      BlendFunc
    PinLight     BlendFunc
    Reflex       BlendFunc
    Saturation   BlendFunc
    Screen       BlendFunc
    SoftLight    BlendFunc
    Substract    BlendFunc
    VividLight   BlendFunc
)

type Renderer Uses

type Renderer interface {
    draw.Image
    Render(x, y int)
}

Work in progress.

type ThreadedRenderer Uses

type ThreadedRenderer interface {
    draw.Image
    ThreadedRender(x, y chan int, done chan bool)
}

Work in progress.

Package blend imports 4 packages (graph). Updated 2016-07-16. Refresh now. Tools for package owners.