Hello everyone. I'm trying to develop my first plugin. It compiles successfuly, but don’t work. Source code:
#region UICode
IntSliderControl Amount1 = 50; // [0,100] Alpha
#endregion
private byte Clamp2Byte(int iValue)
{
if (iValue < 0) return 0;
if (iValue > 255) return 255;
return (byte)iValue;
}
void Render(Surface dst, Surface src, Rectangle rect)
{
ColorBgra CurrentPixel;
for (int y = rect.Top; y < rect.Bottom; y++)
{
if (IsCancelRequested) return;
for (int x = rect.Left; x < rect.Right; x++)
{
CurrentPixel = src[x, y];
double R = (int)CurrentPixel.R;
double G = (int)CurrentPixel.G;
double B = (int)CurrentPixel.B;
double alpha = Amount1 / 100;
R = (R - (255 * alpha)) / (1 - alpha);
G = (G - (255 * alpha)) / (1 - alpha);
B = (B - (255 * alpha)) / (1 - alpha);
CurrentPixel = ColorBgra.FromBgra(Clamp2Byte((int), Clamp2Byte((int)G), Clamp2Byte((int)R), CurrentPixel.A);
dst[x, y] = CurrentPixel;
}
}
}
Help me pls.