Fix Smart Raster Lock Alpha Tone

This commit is contained in:
manongjohn 2023-04-14 07:30:59 -04:00
parent 8861f5e46d
commit 60d7a0af63
3 changed files with 13 additions and 5 deletions

View file

@ -52,9 +52,13 @@ void putOnRasterCM(const TRasterCM32P &out, const TRaster32P &in, int styleId,
continue;
}
bool sameStyleId = styleId == outPix->getInk();
// line with lock alpha : use original pixel's tone
// line with the same style : multiply tones
// line with different style : pick darker tone
int tone = sameStyleId ? outPix->getTone() * (255 - inPix->m) / 255
int tone = lockAlpha
? outPix->getTone()
: sameStyleId
? outPix->getTone() * (255 - inPix->m) / 255
: std::min(255 - inPix->m, outPix->getTone());
int ink = !sameStyleId && outPix->getTone() < 255 - inPix->m
? outPix->getInk()

View file

@ -34,9 +34,12 @@ void putOnRasterCM(const TRasterCM32P &out, const TRaster32P &in, int styleId,
continue;
}
bool sameStyleId = styleId == outPix->getInk();
// line with lock alpha : use original pixel's tone
// line with the same style : multiply tones
// line with different style : pick darker tone
int tone = sameStyleId ? outPix->getTone() * (255 - inPix->m) / 255
int tone = lockAlpha ? outPix->getTone()
: sameStyleId
? outPix->getTone() * (255 - inPix->m) / 255
: std::min(255 - inPix->m, outPix->getTone());
int ink = !sameStyleId && outPix->getTone() < 255 - inPix->m
? outPix->getInk()

View file

@ -234,7 +234,8 @@ void RasterStrokeGenerator::placeOver(const TRasterCM32P &out,
}
}
if (inTone <= outTone) {
*outPix = TPixelCM32(inPix->getInk(), outPix->getPaint(), inTone);
*outPix = TPixelCM32(inPix->getInk(), outPix->getPaint(),
m_modifierLockAlpha ? outTone : inTone);
}
}
if (m_task == ERASE) {