I’m trying to draw a bmp image file from a 2 dimensional Boolean array. The objective is the following i need to draw a small square for each value and the color depends on the boolean if true it paints in a given color and if false it paints white.
the idea is to create a maze based on the matrix
Most solutions i find over the web are with 1 dimensional byte array using MemoryStream but i doesn’t paint a full square with a size of my choosing.
My main problem is how to draw on a bmp or an image using c#
thanks in advance for any advice
Here’s a solution that uses a 2 dimension array and saves the resulting bitmap. You’ll have to either read in the maze from a text file or hand enter it as I have done. You can adjust the size of the tiles with the
squareWidth,squareHeightvariables. Using a one-dimensional array would also work, but may not be as intuitive if you’re just learning about these things.