|
-
Dec 8th, 2003, 09:37 PM
#1
Thread Starter
Not NoteMe
Getting colour data from a bitmap
Simple question. How do i do it? 
I've searched the MSDN and here on vbforums, but so far have only found how to load a bmp:
Code:
HBITMAP hBmp = (HBITMAP)LoadImage(NULL, "Terrain.bmp", IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);
and how to put it into a device context (which i don't think i want to do.
What i'm trying to do here is create a terrain generator using a bitmap as the hightmap. I've currently got the engine working, all i need now is a way do get a heightmap in. So i decided on a grey-scale bmp as that seemed the easiest way (creating terrain).
As always thanks for any help you may provide.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Dec 9th, 2003, 06:42 AM
#2
You can get the BITMAP structure of the HBITMAP and read the color data. It's probably the easiest way, unless you're handling a DIB section, in which case you need to use a different way to get the data.
You can search for image libraries too, there are enough available for free, they allow loading of other images (GIF, JPG, PNG, PCX, ...) too.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 9th, 2003, 02:03 PM
#3
Thread Starter
Not NoteMe
Ok, i may be being really dumb here but i added this code:
Code:
Bitmap bmp;
bmp.FromFile("Terrain.bmp");
with the appropriate includes:
Code:
#include <gdiplus.h>
#include <Gdiplusheaders.h>
But i get errors about Bitmap being an indeclared identifyer. What am i doing wrong??
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Dec 11th, 2003, 08:10 PM
#4
Frenzied Member
You probably need
using namespace Gdiplus;
-
Dec 11th, 2003, 08:26 PM
#5
Fanatic Member
Here, you can find the file format for bmp's
http://www.wotsit.org/search.asp
-
Dec 12th, 2003, 02:09 PM
#6
Thread Starter
Not NoteMe
Thanks for the replys. It works now.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
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
|