def _make_image_selected(image: QImage) -> QImage: alpha_mask = image.createAlphaMask() alpha_mask.invertPixels() selected_image = QImage(image) apply_selection_overlay(selected_image, alpha_mask) return selected_image
def setImage(self, image: QtGui.QImage): self.viewer.setImage(image) self.setGeometry(self.x(), self.y(), image.width(), image.height()) mask = QtGui.QPixmap.fromImage(image.createAlphaMask()) self.setMask(mask)