Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to load an bitmap image with raw data?

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

829 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