From f5d74f68b7099b937c193fe5daa94ce2fdf4e0fc Mon Sep 17 00:00:00 2001 From: MrStevns Date: Thu, 2 Oct 2025 18:01:54 +0200 Subject: [PATCH] Fix opacity being applied on the wrong painter which makes the opacity effect look wrong when rendered on the canvas. --- core_lib/src/canvaspainter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core_lib/src/canvaspainter.cpp b/core_lib/src/canvaspainter.cpp index 2920d5bce8..6e4271295b 100644 --- a/core_lib/src/canvaspainter.cpp +++ b/core_lib/src/canvaspainter.cpp @@ -260,7 +260,7 @@ void CanvasPainter::paintOnionSkinFrame(QPainter& painter, QPainter& onionSkinPa // Don't transform the image here as we used the viewTransform in the image output painter.setWorldMatrixEnabled(false); // Remember to adjust overall opacity based on opacity value from image - painter.setOpacity(frameOpacity - (1.0-painter.opacity())); + onionSkinPainter.setOpacity(frameOpacity - (1.0-painter.opacity())); if (colorize) { QColor colorBrush = Qt::transparent; //no color for the current frame @@ -295,9 +295,9 @@ void CanvasPainter::paintCurrentBitmapFrame(QPainter& painter, const QRect& blit QPainter currentBitmapPainter; initializePainter(currentBitmapPainter, mCurrentLayerPixmap, blitRect); - painter.setOpacity(paintedImage->getOpacity() - (1.0-painter.opacity())); painter.setWorldMatrixEnabled(false); + currentBitmapPainter.setOpacity(paintedImage->getOpacity() - (1.0-painter.opacity())); currentBitmapPainter.drawImage(paintedImage->topLeft(), *paintedImage->image()); if (isCurrentLayer && isDrawing) @@ -337,6 +337,8 @@ void CanvasPainter::paintCurrentVectorFrame(QPainter& painter, const QRect& blit } // Paint existing vector image to the painter + // Remember to adjust opacity based on additional opacity value from the keyframe + currentVectorPainter.setOpacity(vectorImage->getOpacity() - (1.0-painter.opacity())); vectorImage->paintImage(currentVectorPainter, *mObject, mOptions.bOutlines, mOptions.bThinLines, mOptions.bAntiAlias); if (isCurrentLayer && isDrawing) { @@ -352,8 +354,6 @@ void CanvasPainter::paintCurrentVectorFrame(QPainter& painter, const QRect& blit painter.setWorldMatrixEnabled(false); painter.setTransform(QTransform()); - // Remember to adjust opacity based on additional opacity value from the keyframe - painter.setOpacity(vectorImage->getOpacity() - (1.0-painter.opacity())); painter.drawPixmap(mPointZero, mCurrentLayerPixmap); }