Skip to content

Instantly share code, notes, and snippets.

@phrohdoh
Created June 17, 2014 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phrohdoh/156ff55fbf99ee6b5c1c to your computer and use it in GitHub Desktop.
Save phrohdoh/156ff55fbf99ee6b5c1c to your computer and use it in GitHub Desktop.
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