public void SetPixel(int x, int y, Color color) { #if DEBUG if ((x < 0) || (x >= this.width)) { throw new ArgumentOutOfRangeException("x", "Value cannot be less than zero or greater than the bitmap width."); } if ((y < 0) || (y >= this.height)) { throw new ArgumentOutOfRangeException("y", "Value cannot be less than zero or greater than the bitmap height."); } #endif Color32* data = this[x, y]; data->Argb = color.ToArgb(); }
public void ApplyFilter(FastBitmap image) { for (var i = 0; i < image.Height; ++i) { for (var j = 0; j < image.Width; ++j) { var pixel = image.GetPixel(j, i); if (pixel.R + pixel.G + pixel.B > 300) { image.SetPixel(j, i, System.Drawing.Color.FromArgb(200, 255, 255)); } else { image.SetPixel(j, i, System.Drawing.Color.FromArgb(255, 0, 0, 30)); } } } }