|
@@ -660,7 +660,9 @@ var penColor: TBGRAPixel;
|
|
yb, xb: Integer;
|
|
yb, xb: Integer;
|
|
pmask: PByte;
|
|
pmask: PByte;
|
|
compareColor: TExpandedPixel;
|
|
compareColor: TExpandedPixel;
|
|
|
|
+ toleranceW: word;
|
|
diff, diffDiv: integer;
|
|
diff, diffDiv: integer;
|
|
|
|
+ maskBrush: TUniversalBrush;
|
|
begin
|
|
begin
|
|
if not Manager.Image.CurrentLayerVisible then
|
|
if not Manager.Image.CurrentLayerVisible then
|
|
begin
|
|
begin
|
|
@@ -677,11 +679,13 @@ begin
|
|
if ffProgressive in Manager.FloodFillOptions then
|
|
if ffProgressive in Manager.FloodFillOptions then
|
|
begin
|
|
begin
|
|
mask := TGrayscaleMask.Create(targetRect.Width, targetRect.Height, 0);
|
|
mask := TGrayscaleMask.Create(targetRect.Width, targetRect.Height, 0);
|
|
|
|
+ compareColor := GammaExpansion(source.GetPixel(pt.X-ofs.X, pt.Y-ofs.Y));
|
|
|
|
+ toleranceW := Manager.Tolerance + (Manager.Tolerance shl 8);
|
|
|
|
+ mask.SolidBrush(maskBrush, ByteMaskWhite);
|
|
Manager.Image.CurrentLayerReadOnly.ParallelFloodFill(pt.X-ofs.X, pt.Y-ofs.Y,
|
|
Manager.Image.CurrentLayerReadOnly.ParallelFloodFill(pt.X-ofs.X, pt.Y-ofs.Y,
|
|
- mask, ByteMaskWhite, fmDrawWithTransparency, Manager.Tolerance,
|
|
|
|
|
|
+ mask, maskBrush, false, toleranceW,
|
|
ofs.X - targetRect.Left, ofs.Y - targetRect.Top);
|
|
ofs.X - targetRect.Left, ofs.Y - targetRect.Top);
|
|
- compareColor := GammaExpansion(source.GetPixel(pt.X-ofs.X, pt.Y-ofs.Y));
|
|
|
|
- diffDiv := Manager.Tolerance + (Manager.Tolerance shl 8) + 1;
|
|
|
|
|
|
+ diffDiv := toleranceW + 1;
|
|
for yb := 0 to mask.Height-1 do
|
|
for yb := 0 to mask.Height-1 do
|
|
begin
|
|
begin
|
|
psource := PBGRAPixel(source.GetPixelAddress(targetRect.Left - ofs.x, yb + targetRect.Top - ofs.y));
|
|
psource := PBGRAPixel(source.GetPixelAddress(targetRect.Left - ofs.x, yb + targetRect.Top - ofs.y));
|
|
@@ -690,8 +694,11 @@ begin
|
|
begin
|
|
begin
|
|
if pmask^ <> 0 then
|
|
if pmask^ <> 0 then
|
|
begin
|
|
begin
|
|
- diff := ExpandedDiff(psource^.ToExpanded, compareColor);
|
|
|
|
- pmask^ := (pmask^ * (diffDiv - diff) + (diffDiv shr 1)) div diffDiv;
|
|
|
|
|
|
+ diff := diffDiv - ExpandedDiff(psource^.ToExpanded, compareColor);
|
|
|
|
+ if diff >= 0 then
|
|
|
|
+ pmask^ := (pmask^ * diff + (diffDiv shr 1)) div diffDiv
|
|
|
|
+ else
|
|
|
|
+ pmask^ := 0;
|
|
end;
|
|
end;
|
|
inc(pmask);
|
|
inc(pmask);
|
|
inc(psource);
|
|
inc(psource);
|