Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fix(Finger Tool): Wrong Paint algorithm

Abel You4c22616fef8f
diff --git a/toonz/sources/toonzlib/rasterstrokegenerator.cpp b/toonz/sources/toonzlib/rasterstrokegenerator.cpp
index c129e533b..a6370d4e8 100644
--- a/toonz/sources/toonzlib/rasterstrokegenerator.cpp
+++ b/toonz/sources/toonzlib/rasterstrokegenerator.cpp
@@ -284,8 +284,8 @@ void RasterStrokeGenerator::placeOver(const TRasterCM32P &out,
/*-- Boundary Conditions --*/
if (outPix == rOut->pixels(y) || outPix == outEnd - 1) continue;
- int inkId = inPix->getInk();
- if (inkId == 0) continue;
+ int inStyle = inPix->getInk();
+ if (inStyle == 0) continue;
TPixelCM32 *neighbourPixels[4];
neighbourPixels[0] = outPix - 1; /* left */
@@ -303,9 +303,9 @@ void RasterStrokeGenerator::placeOver(const TRasterCM32P &out,
/*-- Count up the items that have darker lines (lower Tone) than the
* current pixel, or same paint as current pixel. --*/
if (neighbourPixels[p]->getTone() < tone ||
- (m_colorType == PAINT && neighbourPixels[p]->getPaint() != 0)) {
+ (m_colorType == PAINT && neighbourPixels[p]->getPaint() == inStyle)) {
count++;
- if (neighbourPixels[p]->getTone() < minTone)
+ if (m_colorType == INK && neighbourPixels[p]->getTone() < minTone)
minTone = neighbourPixels[p]->getTone();
}
}
@@ -315,13 +315,13 @@ void RasterStrokeGenerator::placeOver(const TRasterCM32P &out,
if (count <= 2) continue;
if (m_colorType == INK)
- *outPix = TPixelCM32(inkId, outPix->getPaint(), minTone);
+ *outPix = TPixelCM32(inStyle, outPix->getPaint(), minTone);
else if (m_colorType == PAINT)
- *outPix = TPixelCM32(inkId, inPix->getInk(), minTone);
+ *outPix = TPixelCM32(outPix->getInk(), inStyle, outPix->getTone());
}
/*--- When Invert is ON: Operation to trim protrusion ---*/
else {
- if (outPix->isPurePaint() || outPix->getInk() != inkId) continue;
+ if (outPix->isPurePaint() || outPix->getInk() != inStyle) continue;
/*-- For 4 neighborhood pixels --*/
int maxTone = tone;
@@ -330,7 +330,7 @@ void RasterStrokeGenerator::placeOver(const TRasterCM32P &out,
* Count up items whose Ink# is not Current or whose line is thinner
* than your Pixel (Tone is higher).
* --*/
- if (neighbourPixels[p]->getInk() != inkId) {
+ if (neighbourPixels[p]->getInk() != inStyle) {
count++;
maxTone = 255;
} else if (neighbourPixels[p]->getTone() > tone) {
@@ -343,7 +343,7 @@ void RasterStrokeGenerator::placeOver(const TRasterCM32P &out,
/*--- If 3 or more surrounding pixels are thinner, replace with the
* maximum Tone ---*/
if (count <= 2) continue;
- *outPix = TPixelCM32((maxTone == 255) ? 0 : inkId,
+ *outPix = TPixelCM32((maxTone == 255) ? 0 : inStyle,
outPix->getPaint(), maxTone);
}
}