473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to create Bitmap using pixel data

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
Nov 22 '05 #1
1 6564
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

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Question with BinaryReader | last post by:
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...
8
by: James Dean | last post by:
I have 1 bit per pixel information and i have the width and height of this data.Each bit corresponds to a 24 bit colour value. I want to convert this to 24bit per pixel bitmap. Do i need to...
0
by: James Dean | last post by:
I have trouble displaying a bitmap. I have 1bpp information. I also have a command telling me what color i need to set the bytes to when the colour is switched on. The trouble is i do all this but...
1
by: Dennis Myrén | last post by:
Hi. I use System.Drawing.Bitmap to copy bitmap pixel data. I use LockBits to retrieve a BitmapData which in turn provides me with the Scan0 property which i then use to loop the pixel data using...
5
by: Lance | last post by:
I need to create a Drawing.Bitmap from an array of integer values. My current technique creates a bitmap that eventually becomes corrupt (i.e., the bitmap's pixels change to a different color...
3
by: Iwanow | last post by:
Hello! My goal is to develop a program that opens a bitmap, copies its pixels to an ArrayList in order to perform some complex calculations (edge detection, Hough transform etc.), and save...
2
by: Marco Biagioni | last post by:
After i've tried to update a vb 6.0 project to vb.net, using visual studio utility,i can't read correctly data bytes from a .bmp file to insert them in a matrix to operate on. Using vb 6.0 the...
2
by: Marco Biagioni | last post by:
After i've tried to update a vb 6.0 project to vb.net, using visual studio utility,i can't read correctly data bytes from a .bmp file to insert them in a matrix to operate on. Using vb 6.0 the...
7
by: RB0135 | last post by:
Hi All, I have some Windows BMP, 1BPP, monochrome files that I need to get the raw data from to load a graphics buffer on a Roll Printer (which I know can be done). Lets forget about the Roll...
3
by: radu | last post by:
i need a bit of help with few lines of code. 1. i have integer array a = numbers from 0 to 256 2. i have to create a 256 colours bitmap of 500x500 pixels, asign colours as matrix a. ex. bitmap at...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.