|
|
@ -91,9 +91,18 @@ namespace SixLabors.ImageSharp.Processing |
|
|
{ |
|
|
{ |
|
|
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length); |
|
|
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length); |
|
|
|
|
|
|
|
|
MemoryAllocator memoryAllocator = this.Target.MemoryAllocator; |
|
|
MemoryAllocator memoryAllocator = this.Target.MemoryAllocator; |
|
|
|
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
|
|
for (int i = 0; i < scanline.Length; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
Guard.MustBeBetweenOrEqualTo(scanline[i], 0, 1, nameof(scanline)); |
|
|
|
|
|
} |
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
float opacity = this.Options.BlendPercentage.Clamp(0, 1); |
|
|
|
|
|
|
|
|
if (this.Options.BlendPercentage == 1f) |
|
|
if (opacity == 1f) |
|
|
{ |
|
|
{ |
|
|
this.Blender.Blend(memoryAllocator, destinationRow, destinationRow, this.Colors.GetSpan(), scanline); |
|
|
this.Blender.Blend(memoryAllocator, destinationRow, destinationRow, this.Colors.GetSpan(), scanline); |
|
|
} |
|
|
} |
|
|
@ -105,7 +114,7 @@ namespace SixLabors.ImageSharp.Processing |
|
|
|
|
|
|
|
|
for (int i = 0; i < scanline.Length; i++) |
|
|
for (int i = 0; i < scanline.Length; i++) |
|
|
{ |
|
|
{ |
|
|
amountSpan[i] = scanline[i] * this.Options.BlendPercentage; |
|
|
amountSpan[i] = scanline[i] * opacity; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
this.Blender.Blend(memoryAllocator, destinationRow, destinationRow, this.Colors.GetSpan(), amountSpan); |
|
|
this.Blender.Blend(memoryAllocator, destinationRow, destinationRow, this.Colors.GetSpan(), amountSpan); |
|
|
|