Struct qt_gui::q_painter::CompositionMode
source · pub struct CompositionMode(/* private fields */);
Expand description
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.
C++ enum: QPainter::CompositionMode
.
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.
Several composition modes require an alpha channel in the source or target images to have an effect. For optimal performance the image format Format_ARGB32_Premultiplied is preferred.
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.
Implementations§
source§impl CompositionMode
impl CompositionMode
sourcepub const CompositionModeSourceOver: CompositionMode = _
pub const CompositionModeSourceOver: CompositionMode = _
This is the default mode. The alpha of the source is used to blend the pixel on top of the destination. (C++ enum variant: CompositionMode_SourceOver = 0
)
sourcepub const CompositionModeDestinationOver: CompositionMode = _
pub const CompositionModeDestinationOver: CompositionMode = _
The alpha of the destination is used to blend it on top of the source pixels. This mode is the inverse of CompositionMode_SourceOver. (C++ enum variant: CompositionMode_DestinationOver = 1
)
sourcepub const CompositionModeClear: CompositionMode = _
pub const CompositionModeClear: CompositionMode = _
The pixels in the destination are cleared (set to fully transparent) independent of the source. (C++ enum variant: CompositionMode_Clear = 2
)
sourcepub const CompositionModeSource: CompositionMode = _
pub const CompositionModeSource: CompositionMode = _
The output is the source pixel. (This means a basic copy operation and is identical to SourceOver when the source pixel is opaque). (C++ enum variant: CompositionMode_Source = 3
)
sourcepub const CompositionModeDestination: CompositionMode = _
pub const CompositionModeDestination: CompositionMode = _
The output is the destination pixel. This means that the blending has no effect. This mode is the inverse of CompositionMode_Source. (C++ enum variant: CompositionMode_Destination = 4
)
sourcepub const CompositionModeSourceIn: CompositionMode = _
pub const CompositionModeSourceIn: CompositionMode = _
The output is the source, where the alpha is reduced by that of the destination. (C++ enum variant: CompositionMode_SourceIn = 5
)
sourcepub const CompositionModeDestinationIn: CompositionMode = _
pub const CompositionModeDestinationIn: CompositionMode = _
The output is the destination, where the alpha is reduced by that of the source. This mode is the inverse of CompositionMode_SourceIn. (C++ enum variant: CompositionMode_DestinationIn = 6
)
sourcepub const CompositionModeSourceOut: CompositionMode = _
pub const CompositionModeSourceOut: CompositionMode = _
The output is the source, where the alpha is reduced by the inverse of destination. (C++ enum variant: CompositionMode_SourceOut = 7
)
sourcepub const CompositionModeDestinationOut: CompositionMode = _
pub const CompositionModeDestinationOut: CompositionMode = _
The output is the destination, where the alpha is reduced by the inverse of the source. This mode is the inverse of CompositionMode_SourceOut. (C++ enum variant: CompositionMode_DestinationOut = 8
)
sourcepub const CompositionModeSourceAtop: CompositionMode = _
pub const CompositionModeSourceAtop: CompositionMode = _
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. (C++ enum variant: CompositionMode_SourceAtop = 9
)
sourcepub const CompositionModeDestinationAtop: CompositionMode = _
pub const CompositionModeDestinationAtop: CompositionMode = _
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. (C++ enum variant: CompositionMode_DestinationAtop = 10
)
sourcepub const CompositionModeXor: CompositionMode = _
pub const CompositionModeXor: CompositionMode = _
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. (C++ enum variant: CompositionMode_Xor = 11
)
sourcepub const CompositionModePlus: CompositionMode = _
pub const CompositionModePlus: CompositionMode = _
Both the alpha and color of the source and destination pixels are added together. (C++ enum variant: CompositionMode_Plus = 12
)
sourcepub const CompositionModeMultiply: CompositionMode = _
pub const CompositionModeMultiply: CompositionMode = _
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. (C++ enum variant: CompositionMode_Multiply = 13
)
sourcepub const CompositionModeScreen: CompositionMode = _
pub const CompositionModeScreen: CompositionMode = _
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. (C++ enum variant: CompositionMode_Screen = 14
)
sourcepub const CompositionModeOverlay: CompositionMode = _
pub const CompositionModeOverlay: CompositionMode = _
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. (C++ enum variant: CompositionMode_Overlay = 15
)
sourcepub const CompositionModeDarken: CompositionMode = _
pub const CompositionModeDarken: CompositionMode = _
The darker of the source and destination colors is selected. (C++ enum variant: CompositionMode_Darken = 16
)
sourcepub const CompositionModeLighten: CompositionMode = _
pub const CompositionModeLighten: CompositionMode = _
The lighter of the source and destination colors is selected. (C++ enum variant: CompositionMode_Lighten = 17
)
sourcepub const CompositionModeColorDodge: CompositionMode = _
pub const CompositionModeColorDodge: CompositionMode = _
The destination color is brightened to reflect the source color. A black source color leaves the destination color unchanged. (C++ enum variant: CompositionMode_ColorDodge = 18
)
sourcepub const CompositionModeColorBurn: CompositionMode = _
pub const CompositionModeColorBurn: CompositionMode = _
The destination color is darkened to reflect the source color. A white source color leaves the destination color unchanged. (C++ enum variant: CompositionMode_ColorBurn = 19
)
sourcepub const CompositionModeHardLight: CompositionMode = _
pub const CompositionModeHardLight: CompositionMode = _
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. (C++ enum variant: CompositionMode_HardLight = 20
)
sourcepub const CompositionModeSoftLight: CompositionMode = _
pub const CompositionModeSoftLight: CompositionMode = _
Darkens or lightens the colors depending on the source color. Similar to CompositionMode_HardLight. (C++ enum variant: CompositionMode_SoftLight = 21
)
sourcepub const CompositionModeDifference: CompositionMode = _
pub const CompositionModeDifference: CompositionMode = _
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. (C++ enum variant: CompositionMode_Difference = 22
)
sourcepub const CompositionModeExclusion: CompositionMode = _
pub const CompositionModeExclusion: CompositionMode = _
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. (C++ enum variant: CompositionMode_Exclusion = 23
)
sourcepub const RasterOpSourceOrDestination: CompositionMode = _
pub const RasterOpSourceOrDestination: CompositionMode = _
Does a bitwise OR operation on the source and destination pixels (src OR dst). (C++ enum variant: RasterOp_SourceOrDestination = 24
)
sourcepub const RasterOpSourceAndDestination: CompositionMode = _
pub const RasterOpSourceAndDestination: CompositionMode = _
Does a bitwise AND operation on the source and destination pixels (src AND dst). (C++ enum variant: RasterOp_SourceAndDestination = 25
)
sourcepub const RasterOpSourceXorDestination: CompositionMode = _
pub const RasterOpSourceXorDestination: CompositionMode = _
Does a bitwise XOR operation on the source and destination pixels (src XOR dst). (C++ enum variant: RasterOp_SourceXorDestination = 26
)
sourcepub const RasterOpNotSourceAndNotDestination: CompositionMode = _
pub const RasterOpNotSourceAndNotDestination: CompositionMode = _
Does a bitwise NOR operation on the source and destination pixels ((NOT src) AND (NOT dst)). (C++ enum variant: RasterOp_NotSourceAndNotDestination = 27
)
sourcepub const RasterOpNotSourceOrNotDestination: CompositionMode = _
pub const RasterOpNotSourceOrNotDestination: CompositionMode = _
Does a bitwise NAND operation on the source and destination pixels ((NOT src) OR (NOT dst)). (C++ enum variant: RasterOp_NotSourceOrNotDestination = 28
)
sourcepub const RasterOpNotSourceXorDestination: CompositionMode = _
pub const RasterOpNotSourceXorDestination: CompositionMode = _
Does a bitwise operation where the source pixels are inverted and then XOR’ed with the destination ((NOT src) XOR dst). (C++ enum variant: RasterOp_NotSourceXorDestination = 29
)
sourcepub const RasterOpNotSource: CompositionMode = _
pub const RasterOpNotSource: CompositionMode = _
Does a bitwise operation where the source pixels are inverted (NOT src). (C++ enum variant: RasterOp_NotSource = 30
)
sourcepub const RasterOpNotSourceAndDestination: CompositionMode = _
pub const RasterOpNotSourceAndDestination: CompositionMode = _
Does a bitwise operation where the source is inverted and then AND’ed with the destination ((NOT src) AND dst). (C++ enum variant: RasterOp_NotSourceAndDestination = 31
)
sourcepub const RasterOpSourceAndNotDestination: CompositionMode = _
pub const RasterOpSourceAndNotDestination: CompositionMode = _
Does a bitwise operation where the source is AND’ed with the inverted destination pixels (src AND (NOT dst)). (C++ enum variant: RasterOp_SourceAndNotDestination = 32
)
sourcepub const RasterOpNotSourceOrDestination: CompositionMode = _
pub const RasterOpNotSourceOrDestination: CompositionMode = _
Does a bitwise operation where the source is inverted and then OR’ed with the destination ((NOT src) OR dst). (C++ enum variant: RasterOp_NotSourceOrDestination = 33
)
sourcepub const RasterOpSourceOrNotDestination: CompositionMode = _
pub const RasterOpSourceOrNotDestination: CompositionMode = _
Does a bitwise operation where the source is OR’ed with the inverted destination pixels (src OR (NOT dst)). (C++ enum variant: RasterOp_SourceOrNotDestination = 34
)
sourcepub const RasterOpClearDestination: CompositionMode = _
pub const RasterOpClearDestination: CompositionMode = _
The pixels in the destination are cleared (set to 0) independent of the source. (C++ enum variant: RasterOp_ClearDestination = 35
)
sourcepub const RasterOpSetDestination: CompositionMode = _
pub const RasterOpSetDestination: CompositionMode = _
The pixels in the destination are set (set to 1) independent of the source. (C++ enum variant: RasterOp_SetDestination = 36
)
sourcepub const RasterOpNotDestination: CompositionMode = _
pub const RasterOpNotDestination: CompositionMode = _
Does a bitwise operation where the destination pixels are inverted (NOT dst). (C++ enum variant: RasterOp_NotDestination = 37
)
Trait Implementations§
source§impl Clone for CompositionMode
impl Clone for CompositionMode
source§fn clone(&self) -> CompositionMode
fn clone(&self) -> CompositionMode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for CompositionMode
impl Debug for CompositionMode
source§impl From<CompositionMode> for c_int
impl From<CompositionMode> for c_int
source§fn from(value: CompositionMode) -> Self
fn from(value: CompositionMode) -> Self
source§impl From<i32> for CompositionMode
impl From<i32> for CompositionMode
source§impl PartialEq for CompositionMode
impl PartialEq for CompositionMode
source§fn eq(&self, other: &CompositionMode) -> bool
fn eq(&self, other: &CompositionMode) -> bool
self
and other
values to be equal, and is used
by ==
.