protected override unsafe void ProcessFilter(BitmapData imageData) { int width = imageData.Width; int height = imageData.Height; int perPixelLength = base.GetPerPixelFormatLength( imageData.PixelFormat); int offset = imageData.Stride - (width * perPixelLength); Color rgb; HSLColor hsl = new HSLColor(); byte* csan0 = (byte*)imageData.Scan0.ToPointer(); for (int i = 0; i < height; i++) { int widthOffset = 0; while (widthOffset < width) { rgb = Color.FromArgb(csan0[2], csan0[1], csan0[0]); hsl.Color = rgb; hsl.Hue += _hue; hsl.Saturation += _saturation; hsl.Lightness += _lightness; rgb = hsl.Color; csan0[2] = rgb.R; csan0[1] = rgb.G; csan0[0] = rgb.B; widthOffset++; csan0 += perPixelLength; } csan0 += offset; } }
protected override int ProcessColor(int Color) { Color rgb; HSLColor hsl = new HSLColor(); hsl.Color = GraphicsUtil.getColor(Color); hsl.Hue += _hue; hsl.Saturation += _saturation; hsl.Lightness += _lightness; rgb = hsl.Color; Color = (0xFF<<24)|(rgb.R<<16)|(rgb.G<<8)|(rgb.B<<0); return Color; }