|
-
April 11th, 2004, 03:26 PM
#1
Load bitmap from file into array.
Hi,
I am currently writting a simple Win32 program which needs to read bitmap files into an array of integers. Each integer value will contain the RGB value as opposed to individual red, green and blue values. Would somebody be able to show me how to do this please with just the use of Win32 API calls, etc.
Here is basically how I want the image to be loaded.
int* MyPicture;
MyPicture = new int[ImageWidth * ImageHeight];
Any help would be greatly appreciated!
Best Regards,
Lea Hayes
-
April 17th, 2004, 05:16 PM
#2
maybe a solution
Ok, I am sorry, that I have no readymade solution for this now at hand.
for that reason I just might give you some hints. here we go:
as I remember there is a api-function called LoadBitmap. look it up at msdn for details. it allows you to load the bitmap-file to memory and you'll have a HBITMAP then. get a compatible HDC.
then build a nested for-loop and call GetPixel on each pixel. it gives you a COLORREF-structure for the RGB-values of the pixels.
I think it you've done that, this might give you an idea what to do next.
regards
highhead
-
April 17th, 2004, 07:03 PM
#3
Hi,
Thanks for your help, this is a good solution to my problem.
Best Regards,
Lea Hayes
-
April 19th, 2004, 01:35 AM
#4
u can also use GetBitmapBits()
Trust urself!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|