[][src]Struct qt_gui::q_painter::CompositionMode

#[repr(transparent)]
pub struct 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.

C++ enum: QPainter::CompositionMode.

C++ documentation:

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.

Methods

impl CompositionMode[src]

pub fn to_int(&self) -> c_int[src]

impl CompositionMode[src]

pub const CompositionModeSourceOver: CompositionMode[src]

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)

pub const CompositionModeDestinationOver: CompositionMode[src]

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)

pub const CompositionModeClear: CompositionMode[src]

The pixels in the destination are cleared (set to fully transparent) independent of the source. (C++ enum variant: CompositionMode_Clear = 2)

pub const CompositionModeSource: CompositionMode[src]

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)

pub const CompositionModeDestination: CompositionMode[src]

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)

pub const CompositionModeSourceIn: CompositionMode[src]

The output is the source, where the alpha is reduced by that of the destination. (C++ enum variant: CompositionMode_SourceIn = 5)

pub const CompositionModeDestinationIn: CompositionMode[src]

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)

pub const CompositionModeSourceOut: CompositionMode[src]

The output is the source, where the alpha is reduced by the inverse of destination. (C++ enum variant: CompositionMode_SourceOut = 7)

pub const CompositionModeDestinationOut: CompositionMode[src]

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)

pub const CompositionModeSourceAtop: CompositionMode[src]

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)

pub const CompositionModeDestinationAtop: CompositionMode[src]

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)

pub const CompositionModeXor: CompositionMode[src]

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)

pub const CompositionModePlus: CompositionMode[src]

Both the alpha and color of the source and destination pixels are added together. (C++ enum variant: CompositionMode_Plus = 12)

pub const CompositionModeMultiply: CompositionMode[src]

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)

pub const CompositionModeScreen: CompositionMode[src]

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)

pub const CompositionModeOverlay: CompositionMode[src]

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)

pub const CompositionModeDarken: CompositionMode[src]

The darker of the source and destination colors is selected. (C++ enum variant: CompositionMode_Darken = 16)

pub const CompositionModeLighten: CompositionMode[src]

The lighter of the source and destination colors is selected. (C++ enum variant: CompositionMode_Lighten = 17)

pub const CompositionModeColorDodge: CompositionMode[src]

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)

pub const CompositionModeColorBurn: CompositionMode[src]

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)

pub const CompositionModeHardLight: CompositionMode[src]

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)

pub const CompositionModeSoftLight: CompositionMode[src]

Darkens or lightens the colors depending on the source color. Similar to CompositionMode_HardLight. (C++ enum variant: CompositionMode_SoftLight = 21)

pub const CompositionModeDifference: CompositionMode[src]

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)

pub const CompositionModeExclusion: CompositionMode[src]

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)

pub const RasterOpSourceOrDestination: CompositionMode[src]

Does a bitwise OR operation on the source and destination pixels (src OR dst). (C++ enum variant: RasterOp_SourceOrDestination = 24)

pub const RasterOpSourceAndDestination: CompositionMode[src]

Does a bitwise AND operation on the source and destination pixels (src AND dst). (C++ enum variant: RasterOp_SourceAndDestination = 25)

pub const RasterOpSourceXorDestination: CompositionMode[src]

Does a bitwise XOR operation on the source and destination pixels (src XOR dst). (C++ enum variant: RasterOp_SourceXorDestination = 26)

pub const RasterOpNotSourceAndNotDestination: CompositionMode[src]

Does a bitwise NOR operation on the source and destination pixels ((NOT src) AND (NOT dst)). (C++ enum variant: RasterOp_NotSourceAndNotDestination = 27)

pub const RasterOpNotSourceOrNotDestination: CompositionMode[src]

Does a bitwise NAND operation on the source and destination pixels ((NOT src) OR (NOT dst)). (C++ enum variant: RasterOp_NotSourceOrNotDestination = 28)

pub const RasterOpNotSourceXorDestination: CompositionMode[src]

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)

pub const RasterOpNotSource: CompositionMode[src]

Does a bitwise operation where the source pixels are inverted (NOT src). (C++ enum variant: RasterOp_NotSource = 30)

pub const RasterOpNotSourceAndDestination: CompositionMode[src]

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)

pub const RasterOpSourceAndNotDestination: CompositionMode[src]

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)

pub const RasterOpNotSourceOrDestination: CompositionMode[src]

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)

pub const RasterOpSourceOrNotDestination: CompositionMode[src]

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)

pub const RasterOpClearDestination: CompositionMode[src]

The pixels in the destination are cleared (set to 0) independent of the source. (C++ enum variant: RasterOp_ClearDestination = 35)

pub const RasterOpSetDestination: CompositionMode[src]

The pixels in the destination are set (set to 1) independent of the source. (C++ enum variant: RasterOp_SetDestination = 36)

pub const RasterOpNotDestination: CompositionMode[src]

Does a bitwise operation where the destination pixels are inverted (NOT dst). (C++ enum variant: RasterOp_NotDestination = 37)

Trait Implementations

impl Eq for CompositionMode[src]

impl Clone for CompositionMode[src]

impl PartialEq<CompositionMode> for CompositionMode[src]

impl From<i32> for CompositionMode[src]

impl From<CompositionMode> for c_int[src]

impl Copy for CompositionMode[src]

impl Debug for CompositionMode[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]