Merge pull request #1156 from manongjohn/fix_smart_raster_lockalpha_tone
Fix Smart Raster Brush Lock Alpha Tone
This commit is contained in:
commit
cebc72e6bd
3 changed files with 13 additions and 5 deletions
|
@ -52,10 +52,14 @@ void putOnRasterCM(const TRasterCM32P &out, const TRaster32P &in, int styleId,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool sameStyleId = styleId == outPix->getInk();
|
bool sameStyleId = styleId == outPix->getInk();
|
||||||
|
// line with lock alpha : use original pixel's tone
|
||||||
// line with the same style : multiply tones
|
// line with the same style : multiply tones
|
||||||
// line with different style : pick darker tone
|
// line with different style : pick darker tone
|
||||||
int tone = sameStyleId ? outPix->getTone() * (255 - inPix->m) / 255
|
int tone = lockAlpha
|
||||||
: std::min(255 - inPix->m, outPix->getTone());
|
? outPix->getTone()
|
||||||
|
: sameStyleId
|
||||||
|
? outPix->getTone() * (255 - inPix->m) / 255
|
||||||
|
: std::min(255 - inPix->m, outPix->getTone());
|
||||||
int ink = !sameStyleId && outPix->getTone() < 255 - inPix->m
|
int ink = !sameStyleId && outPix->getTone() < 255 - inPix->m
|
||||||
? outPix->getInk()
|
? outPix->getInk()
|
||||||
: styleId;
|
: styleId;
|
||||||
|
|
|
@ -34,10 +34,13 @@ void putOnRasterCM(const TRasterCM32P &out, const TRaster32P &in, int styleId,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool sameStyleId = styleId == outPix->getInk();
|
bool sameStyleId = styleId == outPix->getInk();
|
||||||
|
// line with lock alpha : use original pixel's tone
|
||||||
// line with the same style : multiply tones
|
// line with the same style : multiply tones
|
||||||
// line with different style : pick darker tone
|
// line with different style : pick darker tone
|
||||||
int tone = sameStyleId ? outPix->getTone() * (255 - inPix->m) / 255
|
int tone = lockAlpha ? outPix->getTone()
|
||||||
: std::min(255 - inPix->m, outPix->getTone());
|
: sameStyleId
|
||||||
|
? outPix->getTone() * (255 - inPix->m) / 255
|
||||||
|
: std::min(255 - inPix->m, outPix->getTone());
|
||||||
int ink = !sameStyleId && outPix->getTone() < 255 - inPix->m
|
int ink = !sameStyleId && outPix->getTone() < 255 - inPix->m
|
||||||
? outPix->getInk()
|
? outPix->getInk()
|
||||||
: styleId;
|
: styleId;
|
||||||
|
|
|
@ -234,7 +234,8 @@ void RasterStrokeGenerator::placeOver(const TRasterCM32P &out,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inTone <= outTone) {
|
if (inTone <= outTone) {
|
||||||
*outPix = TPixelCM32(inPix->getInk(), outPix->getPaint(), inTone);
|
*outPix = TPixelCM32(inPix->getInk(), outPix->getPaint(),
|
||||||
|
m_modifierLockAlpha ? outTone : inTone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_task == ERASE) {
|
if (m_task == ERASE) {
|
||||||
|
|
Loading…
Reference in a new issue