}
}
-static void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
- int length,
- uint color,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--)
- *dest++ |= color;
-}
-
-static void QT_FASTCALL rasterop_SourceOrDestination(uint *dest,
- const uint *src,
- int length,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--)
- *dest++ |= *src++;
-}
-
-static void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest,
- int length,
- uint color,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- color |= 0xff000000;
- while (length--)
- *dest++ &= color;
-}
-
-static void QT_FASTCALL rasterop_SourceAndDestination(uint *dest,
- const uint *src,
- int length,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--) {
- *dest = (*src & *dest) | 0xff000000;
- ++dest; ++src;
- }
-}
-
-static void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest,
- int length,
- uint color,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- color &= 0x00ffffff;
- while (length--)
- *dest++ ^= color;
-}
-
-static void QT_FASTCALL rasterop_SourceXorDestination(uint *dest,
- const uint *src,
- int length,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--) {
- *dest = (*src ^ *dest) | 0xff000000;
- ++dest; ++src;
- }
-}
-
-static void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest,
- int length,
- uint color,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- color = ~color;
- while (length--) {
- *dest = (color & ~(*dest)) | 0xff000000;
- ++dest;
- }
-}
-
-static void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest,
- const uint *src,
- int length,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--) {
- *dest = (~(*src) & ~(*dest)) | 0xff000000;
- ++dest; ++src;
- }
-}
-
-static void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest,
- int length,
- uint color,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- color = ~color | 0xff000000;
- while (length--) {
- *dest = color | ~(*dest);
- ++dest;
- }
-}
-
-static void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest,
- const uint *src,
- int length,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--) {
- *dest = ~(*src) | ~(*dest) | 0xff000000;
- ++dest; ++src;
- }
-}
-
-static void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest,
- int length,
- uint color,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- color = ~color & 0x00ffffff;
- while (length--) {
- *dest = color ^ (*dest);
- ++dest;
- }
-}
-
-static void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest,
- const uint *src,
- int length,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--) {
- *dest = ((~(*src)) ^ (*dest)) | 0xff000000;
- ++dest; ++src;
- }
-}
-
-static void QT_FASTCALL rasterop_solid_NotSource(uint *dest, const int length,
- uint color, const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- qt_memfill(dest, ~color | 0xff000000, length);
-}
-
-static void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src,
- int length, const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--)
- *dest++ = ~(*src++) | 0xff000000;
-}
-
-static void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest,
- int length,
- uint color,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- color = ~color | 0xff000000;
- while (length--) {
- *dest = color & *dest;
- ++dest;
- }
-}
-
-static void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest,
- const uint *src,
- int length,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--) {
- *dest = (~(*src) & *dest) | 0xff000000;
- ++dest; ++src;
- }
-}
-
-static void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--) {
- *dest = (color & ~(*dest)) | 0xff000000;
- ++dest;
- }
-}
-
-static void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest,
- const uint *src,
- int length,
- const uint const_alpha)
-{
- Q_UNUSED(const_alpha);
- while (length--) {
- *dest = (*src & ~(*dest)) | 0xff000000;
- ++dest; ++src;
- }
-}
-
static const CompositionFunctionSolid functionForModeSolid[] = {
comp_func_solid_SourceOver,
comp_func_solid_DestinationOver,
comp_func_solid_HardLight,
comp_func_solid_SoftLight,
comp_func_solid_Difference,
- comp_func_solid_Exclusion,
- rasterop_solid_SourceOrDestination,
- rasterop_solid_SourceAndDestination,
- rasterop_solid_SourceXorDestination,
- rasterop_solid_NotSourceAndNotDestination,
- rasterop_solid_NotSourceOrNotDestination,
- rasterop_solid_NotSourceXorDestination,
- rasterop_solid_NotSource,
- rasterop_solid_NotSourceAndDestination,
- rasterop_solid_SourceAndNotDestination
+ comp_func_solid_Exclusion
};
static const CompositionFunction functionForMode[] = {
comp_func_HardLight,
comp_func_SoftLight,
comp_func_Difference,
- comp_func_Exclusion,
- rasterop_SourceOrDestination,
- rasterop_SourceAndDestination,
- rasterop_SourceXorDestination,
- rasterop_NotSourceAndNotDestination,
- rasterop_NotSourceOrNotDestination,
- rasterop_NotSourceXorDestination,
- rasterop_NotSource,
- rasterop_NotSourceAndDestination,
- rasterop_SourceAndNotDestination
+ comp_func_Exclusion
};
static inline TextureBlendType getBlendType(const QSpanData *data)
\value PixmapTransform The engine can transform pixmaps, including
rotation and shearing.
\value PorterDuff The engine supports Porter-Duff operations
- \value RasterOpModes The engine supports bitwise raster operations.
\value AllFeatures All of the above features. This enum value is usually
used as a bit mask.
*/
ConstantOpacity = 0x00000040, // Can render at constant opacity
PerspectiveTransform = 0x00000080, // Can do perspective transformations
BlendModes = 0x00000100, // Can do extended Porter&Duff composition
- RasterOpModes = 0x00000200, // Can do logical raster operations
- PaintOutsidePaintEvent = 0x00000400, // Engine is capable of painting outside paint events
+ PaintOutsidePaintEvent = 0x00000200, // Engine is capable of painting outside paint events
AllFeatures = 0xffffffff // For convenience
};
{
QPaintEngine::PaintEngineFeatures features =
QPaintEngine::AlphaBlend
- | QPaintEngine::PainterPaths
- | QPaintEngine::RasterOpModes;
+ | QPaintEngine::PainterPaths;
if (qt_x11Data->use_xrender) {
features |= QPaintEngine::Antialiasing;
d->composition_mode = PictOpXor;
break;
#endif
- case QPainter::RasterOp_SourceOrDestination:
- function = GXor;
- break;
- case QPainter::RasterOp_SourceAndDestination:
- function = GXand;
- break;
- case QPainter::RasterOp_SourceXorDestination:
- function = GXxor;
- break;
- case QPainter::RasterOp_NotSourceAndNotDestination:
- function = GXnor;
- break;
- case QPainter::RasterOp_NotSourceOrNotDestination:
- function = GXnand;
- break;
- case QPainter::RasterOp_NotSourceXorDestination:
- function = GXequiv;
- break;
- case QPainter::RasterOp_NotSource:
- function = GXcopyInverted;
- break;
- case QPainter::RasterOp_SourceAndNotDestination:
- function = GXandReverse;
- break;
- case QPainter::RasterOp_NotSourceAndDestination:
- function = GXandInverted;
- break;
default:
break;
}
the source, are merged with the pixel in another image, the
destination.
- Please note that the bitwise raster operation modes, denoted with
- a RasterOp prefix, are only natively supported in the X11 and
- raster paint engines. This means that the only way to utilize
- these modes on the Mac is via a QImage. The RasterOp denoted blend
- modes are \e not supported for pens and brushes with alpha
- components. Also, turning on the QPainter::Antialiasing render
- hint will effectively disable the RasterOp modes.
-
-
\image qpainter-compositionmode1.png
\image qpainter-compositionmode2.png
with white inverts the destination color, whereas painting with
black leaves the destination color unchanged.
- \value RasterOp_SourceOrDestination Does a bitwise OR operation on
- the source and destination pixels (src OR dst).
-
- \value RasterOp_SourceAndDestination Does a bitwise AND operation
- on the source and destination pixels (src AND dst).
-
- \value RasterOp_SourceXorDestination Does a bitwise XOR operation
- on the source and destination pixels (src XOR dst).
-
- \value RasterOp_NotSourceAndNotDestination Does a bitwise NOR
- operation on the source and destination pixels ((NOT src) AND (NOT
- dst)).
-
- \value RasterOp_NotSourceOrNotDestination Does a bitwise NAND
- operation on the source and destination pixels ((NOT src) OR (NOT
- dst)).
-
- \value RasterOp_NotSourceXorDestination Does a bitwise operation
- where the source pixels are inverted and then XOR'ed with the
- destination ((NOT src) XOR dst).
-
- \value RasterOp_NotSource Does a bitwise operation where the
- source pixels are inverted (NOT src).
-
- \value RasterOp_NotSourceAndDestination Does a bitwise operation
- where the source is inverted and then AND'ed with the destination
- ((NOT src) AND dst).
-
- \value RasterOp_SourceAndNotDestination Does a bitwise operation
- where the source is AND'ed with the inverted destination pixels
- (src AND (NOT dst)).
-
\sa compositionMode(), setCompositionMode(), {QPainter#Composition
Modes}{Composition Modes}, {Image Composition Example}
*/
Sets the composition mode to the given \a mode.
\warning Only a QPainter operating on a QImage fully supports all
- composition modes. The RasterOp modes are supported for X11 as
- described in compositionMode().
+ composition modes.
\sa compositionMode()
*/
return;
}
- if (mode >= QPainter::RasterOp_SourceOrDestination) {
- if (Q_UNLIKELY(!d->engine->hasFeature(QPaintEngine::RasterOpModes))) {
- qWarning("QPainter::setCompositionMode: "
- "Raster operation modes not supported on device");
- return;
- }
- } else if (mode >= QPainter::CompositionMode_Plus) {
+ if (mode >= QPainter::CompositionMode_Plus) {
if (Q_UNLIKELY(!d->engine->hasFeature(QPaintEngine::BlendModes))) {
qWarning("QPainter::setCompositionMode: "
"Blend modes not supported on device");
CompositionMode_HardLight,
CompositionMode_SoftLight,
CompositionMode_Difference,
- CompositionMode_Exclusion,
-
- // ROPs
- RasterOp_SourceOrDestination,
- RasterOp_SourceAndDestination,
- RasterOp_SourceXorDestination,
- RasterOp_NotSourceAndNotDestination,
- RasterOp_NotSourceOrNotDestination,
- RasterOp_NotSourceXorDestination,
- RasterOp_NotSource,
- RasterOp_NotSourceAndDestination,
- RasterOp_SourceAndNotDestination
+ CompositionMode_Exclusion
};
void setCompositionMode(CompositionMode mode);
CompositionMode compositionMode() const;