com.trolltech.qt.gui
Class QPainter.CompositionMode

java.lang.Object
  extended by java.lang.Enum
      extended by com.trolltech.qt.gui.QPainter.CompositionMode
All Implemented Interfaces:
QtEnumerator, java.io.Serializable, java.lang.Comparable
Enclosing class:
QPainter

public static final class QPainter.CompositionMode
extends java.lang.Enum
implements QtEnumerator

Defines the modes supported for digital image compositing. Composition modes are used to specify how the pixels in one image, 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 not supported for pens and brushes with alpha components. Also, turning on the QPainter::Antialiasing render hint will effectively disable the RasterOp modes.




The most common type is SourceOver (often referred to as just alpha blending) where the source pixel is blended on top of the destination pixel in such a way that the alpha component of the source defines the translucency of the pixel.

When the paint device is a QImage, the image format must be set to Format_ARGB32Premultiplied or Format_ARGB32 for the composition modes to have any effect. For performance the premultiplied version is the preferred format.

When a composition mode is set it applies to all painting operator, pens, brushes, gradients and pixmap/image drawing.

See also:
compositionMode(), setCompositionMode(), Composition Modes, and Image Composition Example.

See Also:
Serialized Form

Field Summary
static QPainter.CompositionMode CompositionMode_Clear
          The pixels in the destination are cleared (set to fully transparent) independent of the source.
static QPainter.CompositionMode CompositionMode_ColorBurn
          The destination color is darkened to reflect the source color.
static QPainter.CompositionMode CompositionMode_ColorDodge
          The destination color is brightened to reflect the source color.
static QPainter.CompositionMode CompositionMode_Darken
          The darker of the source and destination colors is selected.
static QPainter.CompositionMode CompositionMode_Destination
           
static QPainter.CompositionMode CompositionMode_DestinationAtop
          The destination pixel is blended on top of the source, with the alpha of the destination pixel is reduced by the alpha of the destination pixel.
static QPainter.CompositionMode CompositionMode_DestinationIn
          The output is the destination, where the alpha is reduced by that of the source.
static QPainter.CompositionMode CompositionMode_DestinationOut
          The output is the destination, where the alpha is reduced by the inverse of the source.
static QPainter.CompositionMode CompositionMode_DestinationOver
          The alpha of the destination is used to blend it on top of the source pixels.
static QPainter.CompositionMode CompositionMode_Difference
          Subtracts the darker of the colors from the lighter.
static QPainter.CompositionMode CompositionMode_Exclusion
          Similar to CompositionMode_Difference , but with a lower contrast.
static QPainter.CompositionMode CompositionMode_HardLight
          Multiplies or screens the colors depending on the source color.
static QPainter.CompositionMode CompositionMode_Lighten
          The lighter of the source and destination colors is selected.
static QPainter.CompositionMode CompositionMode_Multiply
          The output is the source color multiplied by the destination.
static QPainter.CompositionMode CompositionMode_Overlay
          Multiplies or screens the colors depending on the destination color.
static QPainter.CompositionMode CompositionMode_Plus
          Both the alpha and color of the source and destination pixels are added together.
static QPainter.CompositionMode CompositionMode_Screen
          The source and destination colors are inverted and then multiplied.
static QPainter.CompositionMode CompositionMode_SoftLight
          Darkens or lightens the colors depending on the source color.
static QPainter.CompositionMode CompositionMode_Source
           
static QPainter.CompositionMode CompositionMode_SourceAtop
          The source pixel is blended on top of the destination, with the alpha of the source pixel reduced by the alpha of the destination pixel.
static QPainter.CompositionMode CompositionMode_SourceIn
          The output is the source, where the alpha is reduced by that of the destination.
static QPainter.CompositionMode CompositionMode_SourceOut
          The output is the source, where the alpha is reduced by the inverse of destination.
static QPainter.CompositionMode CompositionMode_SourceOver
          This is the default mode.
static QPainter.CompositionMode CompositionMode_Xor
          The source, whose alpha is reduced with the inverse of the destination alpha, is merged with the destination, whose alpha is reduced by the inverse of the source alpha.
static QPainter.CompositionMode RasterOp_NotSource
           
static QPainter.CompositionMode RasterOp_NotSourceAndDestination
          Does a bitwise operation where the source is inverted and then AND'ed with the destination ((NOT src) AND dst).
static QPainter.CompositionMode RasterOp_NotSourceAndNotDestination
          Does a bitwise NOR operation on the source and destination pixels ((NOT src) AND (NOT dst)).
static QPainter.CompositionMode RasterOp_NotSourceOrNotDestination
          Does a bitwise NAND operation on the source and destination pixels ((NOT src) OR (NOT dst)).
static QPainter.CompositionMode RasterOp_NotSourceXorDestination
          Does a bitwise operation where the source pixels are inverted and then XOR'ed with the destination ((NOT src) XOR dst).
static QPainter.CompositionMode RasterOp_SourceAndDestination
          Does a bitwise AND operation on the source and destination pixels (src AND dst).
static QPainter.CompositionMode RasterOp_SourceAndNotDestination
          Does a bitwise operation where the source is AND'ed with the inverted destination pixels (src AND (NOT dst)).
static QPainter.CompositionMode RasterOp_SourceOrDestination
          Does a bitwise OR operation on the source and destination pixels (src OR dst).
static QPainter.CompositionMode RasterOp_SourceXorDestination
          Does a bitwise XOR operation on the source and destination pixels (src XOR dst).
 
Method Summary
static QPainter.CompositionMode resolve(int value)
          Returns the QPainter$CompositionMode constant with the specified int.
 int value()
          This function should return an integer value for the enum values of the enumeration that implements this interface.
static QPainter.CompositionMode valueOf(java.lang.String name)
           
static QPainter.CompositionMode[] values()
           
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CompositionMode_SourceOver

public static final QPainter.CompositionMode CompositionMode_SourceOver
This is the default mode. The alpha of the source is used to blend the pixel on top of the destination.


CompositionMode_DestinationOver

public static final QPainter.CompositionMode CompositionMode_DestinationOver
The alpha of the destination is used to blend it on top of the source pixels. This mode is the inverse of CompositionMode_SourceOver .


CompositionMode_Clear

public static final QPainter.CompositionMode CompositionMode_Clear
The pixels in the destination are cleared (set to fully transparent) independent of the source.


CompositionMode_Source

public static final QPainter.CompositionMode CompositionMode_Source

CompositionMode_Destination

public static final QPainter.CompositionMode CompositionMode_Destination

CompositionMode_SourceIn

public static final QPainter.CompositionMode CompositionMode_SourceIn
The output is the source, where the alpha is reduced by that of the destination.


CompositionMode_DestinationIn

public static final QPainter.CompositionMode CompositionMode_DestinationIn
The output is the destination, where the alpha is reduced by that of the source. This mode is the inverse of CompositionMode_SourceIn .


CompositionMode_SourceOut

public static final QPainter.CompositionMode CompositionMode_SourceOut
The output is the source, where the alpha is reduced by the inverse of destination.


CompositionMode_DestinationOut

public static final QPainter.CompositionMode CompositionMode_DestinationOut
The output is the destination, where the alpha is reduced by the inverse of the source. This mode is the inverse of CompositionMode_SourceOut .


CompositionMode_SourceAtop

public static final QPainter.CompositionMode CompositionMode_SourceAtop
The source pixel is blended on top of the destination, with the alpha of the source pixel reduced by the alpha of the destination pixel.


CompositionMode_DestinationAtop

public static final QPainter.CompositionMode CompositionMode_DestinationAtop
The destination pixel is blended on top of the source, with the alpha of the destination pixel is reduced by the alpha of the destination pixel. This mode is the inverse of CompositionMode_SourceAtop .


CompositionMode_Xor

public static final QPainter.CompositionMode CompositionMode_Xor
The source, whose alpha is reduced with the inverse of the destination alpha, is merged with the destination, whose alpha is reduced by the inverse of the source alpha. CompositionMode_Xor is not the same as the bitwise Xor.


CompositionMode_Plus

public static final QPainter.CompositionMode CompositionMode_Plus
Both the alpha and color of the source and destination pixels are added together.


CompositionMode_Multiply

public static final QPainter.CompositionMode CompositionMode_Multiply
The output is the source color multiplied by the destination. Multiplying a color with white leaves the color unchanged, while multiplying a color with black produces black.


CompositionMode_Screen

public static final QPainter.CompositionMode CompositionMode_Screen
The source and destination colors are inverted and then multiplied. Screening a color with white produces white, whereas screening a color with black leaves the color unchanged.


CompositionMode_Overlay

public static final QPainter.CompositionMode CompositionMode_Overlay
Multiplies or screens the colors depending on the destination color. The destination color is mixed with the source color to reflect the lightness or darkness of the destination.


CompositionMode_Darken

public static final QPainter.CompositionMode CompositionMode_Darken
The darker of the source and destination colors is selected.


CompositionMode_Lighten

public static final QPainter.CompositionMode CompositionMode_Lighten
The lighter of the source and destination colors is selected.


CompositionMode_ColorDodge

public static final QPainter.CompositionMode CompositionMode_ColorDodge
The destination color is brightened to reflect the source color. A black source color leaves the destination color unchanged.


CompositionMode_ColorBurn

public static final QPainter.CompositionMode CompositionMode_ColorBurn
The destination color is darkened to reflect the source color. A white source color leaves the destination color unchanged.


CompositionMode_HardLight

public static final QPainter.CompositionMode CompositionMode_HardLight
Multiplies or screens the colors depending on the source color. A light source color will lighten the destination color, whereas a dark source color will darken the destination color.


CompositionMode_SoftLight

public static final QPainter.CompositionMode CompositionMode_SoftLight
Darkens or lightens the colors depending on the source color. Similar to CompositionMode_HardLight .


CompositionMode_Difference

public static final QPainter.CompositionMode CompositionMode_Difference
Subtracts the darker of the colors from the lighter. Painting with white inverts the destination color, whereas painting with black leaves the destination color unchanged.


CompositionMode_Exclusion

public static final QPainter.CompositionMode CompositionMode_Exclusion
Similar to CompositionMode_Difference , but with a lower contrast. Painting with white inverts the destination color, whereas painting with black leaves the destination color unchanged.


RasterOp_SourceOrDestination

public static final QPainter.CompositionMode RasterOp_SourceOrDestination
Does a bitwise OR operation on the source and destination pixels (src OR dst).


RasterOp_SourceAndDestination

public static final QPainter.CompositionMode RasterOp_SourceAndDestination
Does a bitwise AND operation on the source and destination pixels (src AND dst).


RasterOp_SourceXorDestination

public static final QPainter.CompositionMode RasterOp_SourceXorDestination
Does a bitwise XOR operation on the source and destination pixels (src XOR dst).


RasterOp_NotSourceAndNotDestination

public static final QPainter.CompositionMode RasterOp_NotSourceAndNotDestination
Does a bitwise NOR operation on the source and destination pixels ((NOT src) AND (NOT dst)).


RasterOp_NotSourceOrNotDestination

public static final QPainter.CompositionMode RasterOp_NotSourceOrNotDestination
Does a bitwise NAND operation on the source and destination pixels ((NOT src) OR (NOT dst)).


RasterOp_NotSourceXorDestination

public static final QPainter.CompositionMode RasterOp_NotSourceXorDestination
Does a bitwise operation where the source pixels are inverted and then XOR'ed with the destination ((NOT src) XOR dst).


RasterOp_NotSource

public static final QPainter.CompositionMode RasterOp_NotSource

RasterOp_NotSourceAndDestination

public static final QPainter.CompositionMode RasterOp_NotSourceAndDestination
Does a bitwise operation where the source is inverted and then AND'ed with the destination ((NOT src) AND dst).


RasterOp_SourceAndNotDestination

public static final QPainter.CompositionMode RasterOp_SourceAndNotDestination
Does a bitwise operation where the source is AND'ed with the inverted destination pixels (src AND (NOT dst)).

Method Detail

values

public static QPainter.CompositionMode[] values()

valueOf

public static QPainter.CompositionMode valueOf(java.lang.String name)

value

public int value()
This function should return an integer value for the enum values of the enumeration that implements this interface.

Specified by:
value in interface QtEnumerator

resolve

public static QPainter.CompositionMode resolve(int value)
Returns the QPainter$CompositionMode constant with the specified int.