Solved

How to load an bitmap image with raw data?

Posted on 1997-07-06
2
1,115 Views
Last Modified: 2010-04-06
I'm looking for tips as to how to load a bitmap in C++ Builder (hopefully its the same as Delhi ;-).

The built in methods seem to be for loading from file, clipboard or another bitmap!

What's a good way of loading a pixel, a line or even the whole bitmap with raw data - apart from saving to a BMP first!

Thanks
Chris Hart
chris.hart@iee.org
0
Comment
Question by:chrishart
2 Comments
 
LVL 1

Accepted Solution

by:
ygolan earned 100 total points
ID: 1338332
Chris,

To access the specific pixels, use the Bitmap.Canvas.Pixels[X, Y]  property. To access a line of pixels you can use Bitmap.ScanLine property - it will give you a pointer to the pixels of a specific line in the bitmap.

To load the bitmap with raw data, create a memory stream (TMemoryStream), write the raw data to the stream and use Bitmap.LoadFromStream.
0
 

Author Comment

by:chrishart
ID: 1338333
Excellent, very quick and to the point.

I'm just embarrased I couldn't get this stuff out of the docs :-(

Thanks you ygolan!

Chris
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question