public Color GetPixel(int x, int y) { if (Locked) { PixelRGB *p = GetOffset(x, y); return(Color.FromArgb(255, p->R, p->G, p->B)); } else { return(_bitmap.GetPixel(x, y)); } }
public void SetPixel(int x, int y, Color color) { if (Locked) { PixelRGB *position = GetOffset(x, y); position->R = color.R; position->G = color.G; position->B = color.B; } else { _bitmap.SetPixel(x, y, color); } }
public void Invert() { if (!Locked) { throw new InvalidOperationException("Bitmap is not Locked"); } for (int y = 0; y < _bitmapData.Width; y++) { for (int x = 0; x < _bitmapData.Height; x++) { PixelRGB *pos = GetOffset(x, y); pos->R = (byte)(255 - pos->R); pos->G = (byte)(255 - pos->G); pos->B = (byte)(255 - pos->B); pos++; } } }