Copyright | (C) 2015 Dimitri Sabadie |
---|---|
License | BSD3 |
Maintainer | Dimitri Sabadie <dimitri.sabadie@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
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
.
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.
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 |