Skip to content

Commit

Permalink
Merge pull request #117 from codeprof/patch-2
Browse files Browse the repository at this point in the history
corrected PixelateEffect to work correctly with premultiplied al…
  • Loading branch information
cameronwhite committed Apr 3, 2016
2 parents 907276a + 8f4f467 commit 2861d3e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Pinta.Effects/Effects/PixelateEffect.cs
Expand Up @@ -55,14 +55,14 @@ public class PixelateEffect : BaseEffect
int bottom = cell.GetBottom ();
int top = cell.Top;

ColorBgra colorTopLeft = src.GetColorBgraUnchecked (left, top);
ColorBgra colorTopRight = src.GetColorBgraUnchecked (right, top);
ColorBgra colorBottomLeft = src.GetColorBgraUnchecked (left, bottom);
ColorBgra colorBottomRight = src.GetColorBgraUnchecked (right, bottom);
ColorBgra colorTopLeft = src.GetColorBgraUnchecked (left, top).ToStraightAlpha();
ColorBgra colorTopRight = src.GetColorBgraUnchecked (right, top).ToStraightAlpha();
ColorBgra colorBottomLeft = src.GetColorBgraUnchecked (left, bottom).ToStraightAlpha();
ColorBgra colorBottomRight = src.GetColorBgraUnchecked (right, bottom).ToStraightAlpha();

ColorBgra c = ColorBgra.BlendColors4W16IP (colorTopLeft, 16384, colorTopRight, 16384, colorBottomLeft, 16384, colorBottomRight, 16384);

return c;
return c.ToPremultipliedAlpha();
}

private Gdk.Rectangle GetCellBox (int x, int y, int cellSize) {
Expand Down

0 comments on commit 2861d3e

Please sign in to comment.