blend

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 6 Imported by: 28

Documentation

Overview

Package blend provides common image blending modes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(bg image.Image, fg image.Image) *image.RGBA

Add combines the foreground and background images by adding their values and returns the resulting image.

func Blend added in v0.12.0

Blend two images together by applying the provided function for each pixel. If images differ in size, the minimum width and height will be picked from each one when creating the resulting image.

func ColorBurn

func ColorBurn(bg image.Image, fg image.Image) *image.RGBA

ColorBurn combines the foreground and background images by dividing the inverted background by the foreground image and then inverting the result which is then returned.

func ColorDodge

func ColorDodge(bg image.Image, fg image.Image) *image.RGBA

ColorDodge combines the foreground and background images by dividing background by the inverted foreground image and returns the result.

func Darken

func Darken(bg image.Image, fg image.Image) *image.RGBA

Darken combines the foreground and background images by picking the darkest value per channel for each pixel. The result is then returned.

func Difference

func Difference(bg image.Image, fg image.Image) *image.RGBA

Difference calculates the absolute difference between the foreground and background images and returns the resulting image.

func Divide

func Divide(bg image.Image, fg image.Image) *image.RGBA

Divide combines the foreground and background images by diving the values from the background by the foreground and returns the resulting image.

func Exclusion

func Exclusion(bg image.Image, fg image.Image) *image.RGBA

Exclusion combines the foreground and background images applying the Exclusion blend mode and returns the resulting image.

func Lighten

func Lighten(bg image.Image, fg image.Image) *image.RGBA

Lighten combines the foreground and background images by picking the brightest value per channel for each pixel. The result is then returned.

func LinearBurn

func LinearBurn(bg image.Image, fg image.Image) *image.RGBA

LinearBurn combines the foreground and background images by adding them and then subtracting 255 (1.0 in normalized scale). The resulting image is then returned.

func LinearLight

func LinearLight(bg image.Image, fg image.Image) *image.RGBA

LinearLight combines the foreground and background images by a mix of a Linear Dodge and Linear Burn operation. The resulting image is then returned.

func Multiply

func Multiply(bg image.Image, fg image.Image) *image.RGBA

Multiply combines the foreground and background images by multiplying their normalized values and returns the resulting image.

func Normal

func Normal(bg image.Image, fg image.Image) *image.RGBA

Normal combines the foreground and background images by placing the foreground over the background using alpha compositing. The resulting image is then returned.

func Opacity

func Opacity(bg image.Image, fg image.Image, percent float64) *image.RGBA

Opacity returns an image which blends the two input images by the percentage provided. Percent must be of range 0 <= percent <= 1.0

func Overlay

func Overlay(bg image.Image, fg image.Image) *image.RGBA

Overlay combines the foreground and background images by using Multiply when channel values < 0.5 or using Screen otherwise and returns the resulting image.

func Screen

func Screen(bg image.Image, fg image.Image) *image.RGBA

Screen combines the foreground and background images by inverting, multiplying and inverting the output. The result is a brighter image which is then returned.

func SoftLight

func SoftLight(bg image.Image, fg image.Image) *image.RGBA

SoftLight combines the foreground and background images by using Pegtop's Soft Light formula and returns the resulting image.

func Subtract

func Subtract(bg image.Image, fg image.Image) *image.RGBA

Subtract combines the foreground and background images by Subtracting the background from the foreground. The result is then returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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