Merge pull request #1156 from manongjohn/fix_smart_raster_lockalpha_tone

Fix Smart Raster Brush Lock Alpha Tone
This commit is contained in:
manongjohn 2023-04-19 13:09:27 -04:00 committed by GitHub
commit cebc72e6bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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) {