Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var image = new Bitmap(100, 100, PixelFormat.Format24bppRgb);
using (var graphics = new Graphics(image))
{
graphics.DrawRectangle(Colors.Red, 15, 15, 50, 50);
}
using (var locked = image.Lock()) unsafe
{
int *value = (int*)locked.Data;
var changePos = new Point(7, 7);
value += changePos.X + (changePos.Y * locked.ScanWidth / 4);
*value = Color.FromArgb(200, 0, 150).ToArgb();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment