digikam
#include <dcolorcomposer.h>
Inherited by Digikam::DColorComposerPorterDuffClear, Digikam::DColorComposerPorterDuffDstAtop, Digikam::DColorComposerPorterDuffDstIn, Digikam::DColorComposerPorterDuffDstOut, Digikam::DColorComposerPorterDuffDstOver, Digikam::DColorComposerPorterDuffNone, Digikam::DColorComposerPorterDuffSrc, Digikam::DColorComposerPorterDuffSrcAtop, Digikam::DColorComposerPorterDuffSrcIn, Digikam::DColorComposerPorterDuffSrcOut, Digikam::DColorComposerPorterDuffSrcOver, and Digikam::DColorComposerPorterDuffXor.
Public Types | |
enum | CompositingOperation { PorterDuffNone, PorterDuffClear, PorterDuffSrc, PorterDuffSrcOver, PorterDuffDstOver, PorterDuffSrcIn, PorterDuffDstIn, PorterDuffSrcOut, PorterDuffDstOut, PorterDuffSrcAtop, PorterDuffDstAtop, PorterDuffXor } |
enum | MultiplicationFlags { NoMultiplication = 0x00, PremultiplySrc = 0x01, PremultiplyDst = 0x02, DemultiplyDst = 0x04, MultiplicationFlagsDImg = PremultiplySrc | PremultiplyDst | DemultiplyDst, MultiplicationFlagsPremultipliedColorOnDImg = PremultiplyDst | DemultiplyDst } |
Public Member Functions | |
virtual | ~DColorComposer () |
virtual void | compose (DColor &dest, DColor src)=0 |
virtual void | compose (DColor &dest, DColor src, MultiplicationFlags multiplicationFlags) |
Static Public Member Functions | |
static DColorComposer * | getComposer (CompositingOperation rule) |
Detailed Description
Definition at line 35 of file dcolorcomposer.h.
Member Enumeration Documentation
The available rules to combine src and destination color.
For the Porter-Duff rules, the formula is component = (source * fs + destination * fd) where fs, fd according to the following table with sa = source alpha, da = destination alpha:
None fs: sa fd: 1.0-sa Clear fs: 0.0 fd: 0.0 Src fs: 1.0 fd: 0.0 Src Over fs: 1.0 fd: 1.0-sa Dst Over fs: 1.0-da fd: 1.0 Src In fs: da fd: 0.0 Dst In fs: 0.0 fd: sa Src Out fs: 1.0-da fd: 0.0 Dst Out fs: 0.0 fd: 1.0-sa
Src Atop fs: da fd: 1.0-sa Dst Atop fs: 1.0-da fd: sa Xor fs: 1.0-da fd: 1.0-sa
None is the default, classical blending mode, a "Src over" simplification: Blend non-premultiplied RGBA data "src over" a fully opaque background. Src is the painter's algorithm. All other operations require premultiplied colors. The documentation of java.awt.AlphaComposite (Java 1.5) provides a good introduction and documentation on Porter Duff.
Definition at line 69 of file dcolorcomposer.h.
Enumerator | |
---|---|
NoMultiplication | |
PremultiplySrc | |
PremultiplyDst | |
DemultiplyDst | |
MultiplicationFlagsDImg | |
MultiplicationFlagsPremultipliedColorOnDImg |
Definition at line 85 of file dcolorcomposer.h.
Constructor & Destructor Documentation
|
inlinevirtual |
Definition at line 128 of file dcolorcomposer.h.
Member Function Documentation
Carry out the actual composition process.
Src and Dest are composed and the result is written to dest. No pre-/demultiplication is done by this method, use the other overloaded methods, which call this method, if you need pre- or demultiplication (you need it if any of the colors are read from or written to a DImg).
If you just pass the object to a DImg method, you do not need to call this. Call this function if you want to compose two colors. Implement this function if you create a custom DColorComposer.
The bit depth of source and destination color must be identical.
|
virtual |
Compose the two colors by calling compose(dest, src).
Pre- and demultiplication operations are done as specified. For PorterDuff operations except PorterDuffNone, you need
- PremultiplySrc if src is not premultiplied (read from a DImg)
- PremultiplyDst if dst is not premultiplied (read from a DImg)
- DemultiplyDst if dst will be written to non-premultiplied data (a DImg)
Definition at line 473 of file dcolorcomposer.cpp.
|
static |
Retrieve a DColorComposer object for one of the predefined rules.
The object needs to be deleted by the caller.
Definition at line 493 of file dcolorcomposer.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Dec 9 2019 02:25:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.