Skip to content

Commit

Permalink
consider alpha channel of the filter color
Browse files Browse the repository at this point in the history
  • Loading branch information
shun-iwasawa committed Mar 1, 2023
1 parent a266be7 commit 646fd4f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
16 changes: 15 additions & 1 deletion toonz/sources/toonz/xshcolumnviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 3 additions & 1 deletion toonz/sources/toonzlib/scenefx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
18 changes: 10 additions & 8 deletions toonz/sources/toonzlib/stagevisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 646fd4f

Please sign in to comment.