(self)
Creates a new image by separating out the cyan, magenta, or yellow
            component, depending on the mask color specified in the constructor.
            The amount of the component found in each pixel of the image is used
            to determine how much of a user-selected ink is used for each pixel
            in the new image for the label widget.
Creates a new image by separating out the cyan, magenta, or yellow
            component, depending on the mask color specified in the constructor.
            The amount of the component found in each pixel of the image is used
            to determine how much of a user-selected ink is used for each pixel
            in the new image for the label widget.
Creates a new image by separating out the cyan magenta or yellow component depending on the mask color specified in the constructor . The amount of the component found in each pixel of the image is used to determine how much of a user - selected ink is used for each pixel in the new image for the label widget .
def createImage(self):
        """ Creates a new image by separating out the cyan, magenta, or yellow
            component, depending on the mask color specified in the constructor.
            The amount of the component found in each pixel of the image is used
            to determine how much of a user-selected ink is used for each pixel
            in the new image for the label widget.
        """
        self.newImage = newImage = self.originalImage.copy()

        # Create CMY components for the ink being used.
        cyanInk = float(255 - QColor(self.paintColor).red()) / 255.0
        magentaInk = float(255 - QColor(self.paintColor).green()) / 255.0
        yellowInk = float(255 - QColor(self.paintColor).blue()) / 255.0

        convert = self.convertMap[self.maskColor]

        for y in range(newImage.height()):
            for x in range(newImage.width()):
                p = self.originalImage.pixel(x, y)

                # Separate the source pixel into its cyan component.
                if self.inverted:
                    amount = convert(p)
                else:
                    amount = 255 - convert(p)

                newColor = QColor(
                    255 - min(int(amount * cyanInk), 255),
                    255 - min(int(amount * magentaInk), 255),
                    255 - min(int(amount * yellowInk), 255))

                newImage.setPixel(x, y, newColor.rgb())

        self.imageLabel.setPixmap(QPixmap.fromImage(newImage))
def createImage ( self ) : self . newImage = newImage = self . originalImage . copy ( ) # Create CMY components for the ink being used. cyanInk = float ( 255 - QColor ( self . paintColor ) . red ( ) ) / 255.0 magentaInk = float ( 255 - QColor ( self . paintColor ) . green ( ) ) / 255.0 yellowInk = float ( 255 - QColor ( self . paintColor ) . blue ( ) ) / 255.0 convert = self . convertMap [ self . maskColor ] for y in range ( newImage . height ( ) ) : for x in range ( newImage . width ( ) ) : p = self . originalImage . pixel ( x , y ) # Separate the source pixel into its cyan component. if self . inverted : amount = convert ( p ) else : amount = 255 - convert ( p ) newColor = QColor ( 255 - min ( int ( amount * cyanInk ) , 255 ) , 255 - min ( int ( amount * magentaInk ) , 255 ) , 255 - min ( int ( amount * yellowInk ) , 255 ) ) newImage . setPixel ( x , y , newColor . rgb ( ) ) self . imageLabel . setPixmap ( QPixmap . fromImage ( newImage ) )