The QPixmap createMaskFromColor method in cpp is used to create a new mask bitmap for a certain color in a given QPixmap object. The resulting bitmap will have black pixels for all the pixels in the image that match the specified color, and white pixels for all the other pixels.
This example will create a QPixmap object from the image file "example.png", create a new mask bitmap where all the pixels that are red (RGB 255,0,0) in the original image are black, and the rest of the pixels are white. The resulting mask will be applied to the original pixmap object, meaning that all red pixels in the original image will now be transparent.
In this example, we still create a new mask bitmap from the "example.png" image, but we specify an additional parameter "Qt::MaskOutColor". This parameter means that all the pixels that are fully opaque white (RGB 255,255,255) will be made transparent in the resulting mask, and all the other pixels will be fully opaque black.
The QPixmap createMaskFromColor method is part of the Qt framework, specifically the QImage class. Any application that uses Qt will have access to this method.
C++ (Cpp) QPixmap::createMaskFromColor - 16 examples found. These are the top rated real world C++ (Cpp) examples of QPixmap::createMaskFromColor extracted from open source projects. You can rate examples to help us improve the quality of examples.