// Code fixed to account for retired 'Utility' library; :wink:
#region UICode
int Amount1=0; //[-255,255]Cyan - Red
int Amount2=0; //[-255,255]Magenta - Green
int Amount3=0; //[-255,255]Yellow - Blue
#endregion
void Render(Surface dst, Surface src, Rectangle rect)
{
ColorBgra CurrentPixel;
int R, G, B;
for(int y = rect.Top; y < rect.Bottom; y++)
{
for (int x = rect.Left; x < rect.Right; x++)
{
CurrentPixel = src[x,y];
R = (int)CurrentPixel.R;
G = (int)CurrentPixel.G;
B = (int)CurrentPixel.B;
// Cyan - Red adjustment
R = R + Amount1;
G = G - (Amount1 / 2);
B = B - (Amount1 / 2);
// Magenta - Green adjustment
G = G + Amount2;
R = R - (Amount2 / 2);
B = B - (Amount2 / 2);
// Yellow - Blue adjustment
B = B + Amount3;
R = R - (Amount3 / 2);
G = G - (Amount3 / 2);
// Reassemble the color from R, G, and B
CurrentPixel = ColorBgra.FromBgra(Int32Util.ClampToByte(,Int32Util.ClampToByte(G),Int32Util.ClampToByte(R),CurrentPixel.A);
dst[x,y] = CurrentPixel;
}
}
}
How to Write an Effect Plugin (Part 2 of 4 - Intermediate)
in Plugin Developer's Central
Posted
// Code fixed to account for retired 'Utility' library; :wink: