Building and rendering a bitmap from a double array

Posted by Ami on Stack Overflow See other posts from Stack Overflow or by Ami
Published on 2010-05-28T03:00:47Z Indexed on 2010/05/28 3:11 UTC
Read the original article Hit count: 237

Filed under:
|

I'm new to c# and I'm sure I'm missing something simple here.

I'm trying to build a bitmap from integer values (0-255) in a double array and then render it in a PictureBox. I think my Bitmap is getting generated but it isn't displaying in my PictureBox.

Bitmap bmp = new Bitmap(image_width, image_height);

Color pxl_color = new Color();

for (int i = 0; i < image_width; i++)
{
    for (int j = 0; j < image_height; j++)
    {
        pxl_color = Color.FromArgb(array_bitmap[i][j]);
        bmp.SetPixel(i, j, pxl_color);
    }
}

PictureBox1.Image = bmp;

Thanks in advance.

© Stack Overflow or respective owner

Related posts about c#

Related posts about beginner