Jump to content

Nitor

Newbies
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Nitor

  1. Ok. Blend white (with alpha) layer with colored layer and you will get new layer with new color. I want to get original colored layer with this formula: backgroundColour = (finalColour - (255 * foregroundAlpha)) / (1 - foregroundAlpha) (formula was tested by me). It get's ForegroundAlpha from Amount1 variable. After getting original colored layer it replaces finalColour to backgroundColour.
  2. 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.
×
×
  • Create New...