How to create Bitmap using pixel data

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is someone can give me example?

I want to create Bitmap with pixel data saved in a binary file, the data
file only have red data block and green data block. I have implemented it
with VC6.0, now I want to rewrote it with C#.

My question is

1. using of Bitmap (Int32, Int32, Int32, PixelFormat, IntPtr)
2. how to implement memory copy efficiently in C#

Thanks
 
Hi!
I want to create Bitmap with pixel data saved in a binary file, the data
file only have red data block and green data block. I have implemented it
with VC6.0, now I want to rewrote it with C#.

I have done something like this with GDI and Managed C++ (I don't using
'real' memory blocks with C#) - I can't post the code, because I don't own
it. I can give few hints:

1. Create and fill BITMAPINFO structure
2. Create HBITMAP with CreateDIBitmap
3. Finally: System::Drawing::Image::FromHbitmap(m_hBitmap);

You've said you have done such thing with VC6.0, so I suppose you familiar
with DrawingContext and stuff... (look into MSDN and 'Windows GDI'). BTW:
search www.codeproject.com - I think I saw there few examples of GDI/GDI+
bitmap handling with C#.

Best regards,
Piotrek
 
Back
Top