Last active
April 3, 2017 21:41
-
-
Save praschl/cd7b0d26c400af1d2d6027b0d8485367 to your computer and use it in GitHub Desktop.
Creates a bitmap, draws a grid on it, and copies it to clipboard... easier than installing whatever plugins into Paint.Net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const int IWidth = 320; | |
| const int IHeight = 320; | |
| const int RWidth = 16; | |
| const int RHeight = 16; | |
| Bitmap b = new Bitmap(IWidth, IHeight); | |
| Graphics g = Graphics.FromImage(b); | |
| g.Clear(Color.Transparent); | |
| Brush[] brushes = { Brushes.Purple, Brushes.Green }; | |
| int brushIndex = 0; | |
| for (int x = 0; x < IWidth; x += RWidth) | |
| { | |
| for (int y = 0; y < IHeight; y += RHeight) | |
| { | |
| Brush brush = brushes[brushIndex]; | |
| brushIndex = (brushIndex + 1) % 2; | |
| g.FillRectangle(brush,x,y,32,32); | |
| } | |
| brushIndex = (brushIndex + 1) % 2; | |
| } | |
| Clipboard.SetImage(b); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment