private void gradientFloatTrackbarControlb_ValueChanged(FloatTrackbarControl _Sender, float _fFormerValue) { float3 Lab = AdobeColors.RGB2Lab_D65((float3)m_RGB); Lab.z = _Sender.Value; RGB = AdobeColors.HSB2RGB(Lab); }
/// <summary> /// Draws the content of the control filling in all color values with the provided Luminance value. /// </summary> protected unsafe void Draw_Style_Luminance() { BitmapData lockedBitmap = m_Output.LockBits(new Rectangle(0, 0, Width, Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); float3 Lab = AdobeColors.RGB2Lab_D65(m_RGB); float3 RGB; int W = Width - 4; int H = Height - 4; for (int Y = 0; Y < H; Y++) { byte *scanlinePtr = (byte *)lockedBitmap.Scan0.ToPointer() + (2 + Y) * lockedBitmap.Stride + (2 * 4); // Add a margin of 2 Lab.z = -(256.0f * Y / H - 128.0f); for (int X = 0; X < W; X++) { Lab.y = 256.0f * X / W - 128.0f; RGB = AdobeColors.Lab2RGB_D65(Lab); *scanlinePtr++ = (byte)Math.Max(0, Math.Min(255, 255 * RGB.z)); *scanlinePtr++ = (byte)Math.Max(0, Math.Min(255, 255 * RGB.y)); *scanlinePtr++ = (byte)Math.Max(0, Math.Min(255, 255 * RGB.x)); *scanlinePtr++ = 0xFF; } } m_Output.UnlockBits(lockedBitmap); }