From 646fd4f121c605ff003883ec02224ed11098d98c Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Mar 01 2023 07:23:01 +0000 Subject: consider alpha channel of the filter color --- diff --git a/toonz/sources/toonz/xshcolumnviewer.cpp b/toonz/sources/toonz/xshcolumnviewer.cpp index ca2cc4b..d9e38f3 100644 --- a/toonz/sources/toonz/xshcolumnviewer.cpp +++ b/toonz/sources/toonz/xshcolumnviewer.cpp @@ -116,7 +116,21 @@ bool containsRasterLevel(TColumnSelection *selection) { const QIcon getColorChipIcon(TPixel32 color) { QColor qCol((int)color.r, (int)color.g, (int)color.b, (int)color.m); QPixmap pixmap(12, 12); - pixmap.fill(qCol); + if (color.m == TPixel32::maxChannelValue) { + pixmap.fill(qCol); + return QIcon(pixmap); + } + static QPixmap checkPm; + if (checkPm.isNull()) { + checkPm = QPixmap(12, 12); + checkPm.fill(Qt::white); + QPainter cp(&checkPm); + cp.fillRect(0, 0, 6, 6, Qt::black); + cp.fillRect(6, 6, 6, 6, Qt::black); + } + pixmap = checkPm; + QPainter p(&pixmap); + p.fillRect(0, 0, 12, 12, qCol); return QIcon(pixmap); } diff --git a/toonz/sources/toonzlib/scenefx.cpp b/toonz/sources/toonzlib/scenefx.cpp index 1bf5468..691b5a1 100644 --- a/toonz/sources/toonzlib/scenefx.cpp +++ b/toonz/sources/toonzlib/scenefx.cpp @@ -977,7 +977,9 @@ PlacedFx FxBuilder::makePF(TLevelColumnFx *lcfx) { TPixel32 colorScale = m_scene->getProperties()->getColorFilterColor( column->getColorFilterId()); if (colorScale != TPixel::Black) { - colorScale.m = column->getOpacity(); + colorScale.m = (typename TPixel32::Channel)((int)colorScale.m * + (int)column->getOpacity() / + TPixel32::maxChannelValue); pf.m_fx = TFxUtil::makeColumnColorFilter(pf.m_fx, colorScale); } } diff --git a/toonz/sources/toonzlib/stagevisitor.cpp b/toonz/sources/toonzlib/stagevisitor.cpp index 304ba53..5e1c90c 100644 --- a/toonz/sources/toonzlib/stagevisitor.cpp +++ b/toonz/sources/toonzlib/stagevisitor.cpp @@ -549,7 +549,9 @@ void RasterPainter::flushRasterImages() { } else { if (m_nodes[i].m_filterColor != TPixel32::Black) { colorscale = m_nodes[i].m_filterColor; - colorscale.m = m_nodes[i].m_alpha; + colorscale.m = (typename TPixel32::Channel)((int)colorscale.m * + (int)m_nodes[i].m_alpha / + TPixel32::maxChannelValue); } inksOnly = tc & ToonzCheck::eInksOnly; } @@ -843,9 +845,9 @@ void RasterPainter::onVectorImage(TVectorImage *vi, TPalette *vPalette = vi->getPalette(); TPixel32 bgColor = TPixel32::White; - int tc = (m_checkFlags && player.m_isCurrentColumn) - ? ToonzCheck::instance()->getChecks() - : 0; + int tc = (m_checkFlags && player.m_isCurrentColumn) + ? ToonzCheck::instance()->getChecks() + : 0; bool inksOnly = tc & ToonzCheck::eInksOnly; int oldFrame = vPalette->getFrame(); @@ -1017,7 +1019,7 @@ void RasterPainter::onRasterImage(TRasterImage *ri, ? 0.9 : (1.0 - OnionSkinMask::getOnionSkinFade( player.m_onionSkinDistance)); - alpha = tcrop(tround(onionSkiFade * 255.0), 0, 255); + alpha = tcrop(tround(onionSkiFade * 255.0), 0, 255); if (player.m_isShiftAndTraceEnabled && !Preferences::instance()->areOnionColorsUsedForShiftAndTraceGhosts()) onionMode = Node::eOnionSkinNone; @@ -1080,7 +1082,7 @@ void RasterPainter::onToonzImage(TToonzImage *ti, const Stage::Player &player) { ? 0.9 : (1.0 - OnionSkinMask::getOnionSkinFade( player.m_onionSkinDistance)); - alpha = tcrop(tround(onionSkiFade * 255.0), 0, 255); + alpha = tcrop(tround(onionSkiFade * 255.0), 0, 255); if (player.m_isShiftAndTraceEnabled && !Preferences::instance()->areOnionColorsUsedForShiftAndTraceGhosts()) @@ -1369,9 +1371,9 @@ void onMeshImage(TMeshImage *mi, const Stage::Player &player, assert(mi); static const double soMinColor[4] = {0.0, 0.0, 0.0, - 0.6}; // Translucent black + 0.6}; // Translucent black static const double soMaxColor[4] = {1.0, 1.0, 1.0, - 0.6}; // Translucent white + 0.6}; // Translucent white static const double rigMinColor[4] = {0.0, 1.0, 0.0, 0.6}; // Translucent green static const double rigMaxColor[4] = {1.0, 0.0, 0.0, 0.6}; // Translucent red