There's moreā€¦

For example, we can overlay multiple images on top of each other and use Qt's Image Composition feature to merge them together and calculate the resulting pixels onscreen, based on the composition mode we used. This is often used in image editing software such as Photoshop and GIMP to composite image layers.
There are more than 30 types of composition mode available in Qt. Some of the most commonly used modes are as follows:

  • Clear: The pixels in the destination are set to fully transparent, independent of the source.
  • Source: The output is the source pixel. This mode is the inverse of CompositionMode_Destination.
  • Destination: The output is the destination pixel. This means that the blending has no effect. This mode is the inverse of CompositionMode_Source.
  • Source Over: This is often referred to as alpha blending. The alpha of the source is used to blend the pixel on top of the destination. This is the default mode used by QPainter.
  • Destination Over: The output is the blend between the alpha of the destination on top of the source pixels. The opposite of this mode is CompositionMode_SourceOver.
  • Source In: The output is the source, where the alpha is reduced by that of the destination.
  • Destination In: The output is the destination, where the alpha is reduced by that of the source. This mode is the inverse of CompositionMode_SourceIn.
  • Source Out: The output is the source, where the alpha is reduced by the inverse of the destination.
  • Destination Out: The output is the destination, where the alpha is reduced by the inverse of the source. This mode is the inverse of CompositionMode_SourceOut.
  • Source Atop: 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.
  • Destination Atop: The destination pixel is blended on top of the source, with the alpha of the source pixel reduced by the alpha of the destination pixel. This mode is the inverse of CompositionMode_SourceAtop.
  • Xor: This is short for Exclusive OR, which is an advanced blending mode that is primarily used for image analysis. Using this is much more complicated with this composition mode. First, the alpha of the source is reduced by the inverse of the destination alpha. Then, the alpha of the destination is reduced by the inverse of the source alpha. Finally, both the source and destination are then merged to produce the output.

For more, you can visit this link: pyside.github.io.

The following image shows the outcome of overlaying two images with different composition modes:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset