luminance-0.6.0.5: Type-safe, type-level and stateless graphics framework

Copyright(C) 2015 Dimitri Sabadie
LicenseBSD3
MaintainerDimitri Sabadie <dimitri.sabadie@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Graphics.Luminance.Blending

Contents

Description

That module exports blending-related types and functions.

Given two pixels src and dst – source and destination, we associate each pixel a blending factor – respectively, srcK and dstK. src is the pixel being computed, and dst is the pixel that is already stored in the framebuffer.

The pixels can be blended in several ways. See the documentation of BlendingMode for further details.

The factors are encoded with BlendingFactor.

Synopsis

Blending modes

data BlendingMode Source

All different blending modes.

Additive represents the following blending equation:

blended = src * srcK + dst * dstK

Subtract represents the following blending equation:

blended = src * srcK - dst * dstK

Because subtracting is not commutating, ReverseSubtract represents the following additional blending equation:

blended = dst * dstK - src * srcK

Min represents the following blending equation:

blended = min src dst

Max represents the following blending equation:

blended = max src dst

Blending factors

data BlendingFactor Source

Blending factors.

Constructors

One

1 * color = factor

Zero

0 * color = 0

SrcColor

src * color

NegativeSrcColor

(1 - src) * color

DestColor

dst * color

NegativeDestColor

(1 - dst) * color

SrcAlpha

srcA * color

NegativeSrcAlpha

(1 - src) * color

DstAlpha

dstA * color

NegativeDstAlpha

(1 - dstA) * color

SrcAlphaSaturate