![]() |
Mapper
0.9.0
API documentation
|
ImageTransparencyFixup repairs a particular issue with composing transparent pixels. More...
#include <image_transparency_fixup.h>
Public Member Functions | |
ImageTransparencyFixup (QImage *image) | |
Create a fixup functor for the given image. More... | |
void | operator() () const |
Checks all pixels of the image for the known wrong result of composing fully transparent pixels, and replaces them with a fully transparent pixel. More... | |
Protected Attributes | |
QRgb * | dest |
QRgb * | dest_end |
ImageTransparencyFixup repairs a particular issue with composing transparent pixels.
QPainter::CompositionMode_Multiply and QPainter::CompositionMode_Darken on a QImage of Format_ARGB32_Premultiplied calculate the resulting alpha channel in a very efficient but not accurate way. A particular case is the composition of two fully transparent pixels which should in theory give a fully transparent pixel. Qt yields an alpha value of 1 (in 0..255) instead. The error accumulates with further compositions.
This class may be used as a functor on a particular image, providing a comfortable way to fix the described case after each composition.
Synopsis:
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); ImageTransparencyFixup fixup(&image); QPainter p(&image); p.setCompositionMode(QPainter::CompositionMode_Multiply); p.drawImage(another_image); p.end(); fixup();
|
inline |
Create a fixup functor for the given image.
The image must be of QImage::Format_ARGB32_Premultiplied. It may be null.
|
inline |
Checks all pixels of the image for the known wrong result of composing fully transparent pixels, and replaces them with a fully transparent pixel.
|
protected |
|
protected |