Solved

How to load an bitmap image with raw data?

Posted on 1997-07-06
2
1,025 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now