mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Fix Clamp usages
This commit is contained in:
parent
9209cb36c9
commit
cf797e801c
1 changed files with 6 additions and 6 deletions
|
@ -60,14 +60,14 @@ public static Image Apply(this ConvolutionMatrix kernel, Image img)
|
|||
int fyr = fy - originY;
|
||||
int offsetY = y + fyr;
|
||||
|
||||
offsetY.Clamp(0, source.Height - 1);
|
||||
offsetY = offsetY.Clamp(0, source.Height - 1);
|
||||
|
||||
for (int fx = 0; fx < kernel.Width; fx++)
|
||||
{
|
||||
int fxr = fx - originX;
|
||||
int offsetX = x + fxr;
|
||||
|
||||
offsetX.Clamp(0, source.Width - 1);
|
||||
offsetX = offsetX.Clamp(0, source.Width - 1);
|
||||
|
||||
ColorBgra currentColor = source.GetPixel(offsetX, offsetY);
|
||||
|
||||
|
@ -82,18 +82,18 @@ public static Image Apply(this ConvolutionMatrix kernel, Image img)
|
|||
}
|
||||
|
||||
r += kernel.Offset;
|
||||
r.Clamp(0, 255);
|
||||
r = r.Clamp(0, 255);
|
||||
|
||||
g += kernel.Offset;
|
||||
g.Clamp(0, 255);
|
||||
g = g.Clamp(0, 255);
|
||||
|
||||
b += kernel.Offset;
|
||||
b.Clamp(0, 255);
|
||||
b = b.Clamp(0, 255);
|
||||
|
||||
if (kernel.ConsiderAlpha)
|
||||
{
|
||||
a += kernel.Offset;
|
||||
a.Clamp(0, 255);
|
||||
a = a.Clamp(0, 255);
|
||||
}
|
||||
|
||||
dest.SetPixel(
|
||||
|
|
Loading…
Reference in a new issue