0

So, I'm developing a small program in C# that involves rendering a structure. I started by using Graphics() but because of certain limitations and for the sake of learning, I created my own 3D engine class (or sort of).

That class stores and manipulates the pixels in a matrix of:

public class pixel {
        public Color cor = new Color();
        public int z = Int32.MinValue;
    }

where z is used for visibility check.

Now that I've checked the results (by creating a bitmap file from the matrix), I want to draw and manipulate that matrix directly into a element in my WPF. So i want to know if there's a simple way to do this.

I'm very fresh on all this, so if there is something that i might be missing please tell me, sometimes i don't know what i should really search for.

  • These answers may help you : http://stackoverflow.com/questions/15274699/create-a-bitmapimage-from-a-byte-array and http://stackoverflow.com/questions/1118496/using-image-control-in-wpf-to-display-system-drawing-bitmap – PaulF Dec 19 '16 at 15:06
  • It's unclear what manipulation exactly means here. For drawing, create a BitmapSource and assign it to the Source property of an Image control. Set `BitmapScalingMode.NearestNeighbor`. – Clemens Dec 19 '16 at 15:07

1 Answers1

0

After trying some different approaches, i ended up storing the data in the matrix in a different way.

My current solution is to draw directly on a Bitmap (that can be easily passed to a PictureBox control) and at the same time store additional info in a matrix the same size as the Bitmap.