这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions core_lib/src/graphics/bitmap/bitmapbucket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,43 +149,40 @@ void BitmapBucket::paint(const QPointF updatedPoint, std::function<void(BucketSt
fillColor = tempColor.rgba();
}

BitmapImage replaceImage = BitmapImage(targetImage->bounds(), Qt::transparent);
BitmapImage* replaceImage = nullptr;

int expandValue = mProperties.bucketFillExpandEnabled ? mProperties.bucketFillExpand : 0;
bool didFloodFill = BitmapImage::floodFill(&replaceImage,
&referenceImage,
cameraRect,
point,
fillColor,
tolerance);
tolerance,
expandValue);

if (!didFloodFill) {
delete replaceImage;
return;
}
Q_ASSERT(replaceImage != nullptr);

state(BucketState::WillFillTarget, targetLayerIndex, currentFrameIndex);

if (mProperties.bucketFillExpandEnabled)
{
BitmapImage::expandFill(&replaceImage,
fillColor,
mProperties.bucketFillExpand);
}

if (mProperties.fillMode == 0)
{
targetImage->paste(&replaceImage);
targetImage->paste(replaceImage);
}
else if (mProperties.fillMode == 2)
{
targetImage->paste(&replaceImage, QPainter::CompositionMode_DestinationOver);
targetImage->paste(replaceImage, QPainter::CompositionMode_DestinationOver);
}
else
{
// fill mode replace
targetImage->paste(&replaceImage, QPainter::CompositionMode_DestinationOut);
targetImage->paste(replaceImage, QPainter::CompositionMode_DestinationOut);
// Reduce the opacity of the fill to match the new color
BitmapImage properColor(replaceImage.bounds(), QColor::fromRgba(origColor));
properColor.paste(&replaceImage, QPainter::CompositionMode_DestinationIn);
BitmapImage properColor(replaceImage->bounds(), QColor::fromRgba(origColor));
properColor.paste(replaceImage, QPainter::CompositionMode_DestinationIn);
// Write reduced-opacity fill image on top of target image
targetImage->paste(&properColor);
}
Expand All @@ -194,6 +191,7 @@ void BitmapBucket::paint(const QPointF updatedPoint, std::function<void(BucketSt
mFirstPaint = false;

targetImage->modification();
delete replaceImage;

state(BucketState::DidFillTarget, targetLayerIndex, currentFrameIndex);
}
Expand Down
Loading