Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Seaman

Accesing individual Bitmap values

This topic is 6935 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How can I access individual values from A bitmap, I mean if I have a 256 greyscale bitmap say 40*40 how could I fill an array[40][40] with the values. I want to use a bitmap for heightmap data. I''m having trouble explaining I think, but I think u can vaguely get what I''m trying to do. Any help would be greatly appreciated. Thanks Seaman =/

Share this post


Link to post
Share on other sites
Advertisement
All you have to do is know the format structure of a bitmap. First you have to read in the file header and then the info header. Since it''s greyscale it should a palette after that. Then you get to the actual values. I''m not at home so I don''t have the documentation, but here is a little hash of what you would do.

BITMAPFILEHEADER bfh;
BITMAPINFOHEADER bih;
// Not sure what palette is, look in help files
// I usually use 16bit or greater

// Open file for read
// Read in bfh
// Read in bih
// Read in palette
// Read in values

If you need any more help on this, you can take a look at the help files or www.wotsit.org

Or feel free to write me or post and I''ll try to get back to you with some code.

Share this post


Link to post
Share on other sites
Yay! I submited two file formats to WOTSIT.org in 7/30/99 and they added them to their site . Do a search for "m8" and "wal". m8 files are images files for Heretic II, they''re really easy to read because there is no compression. wal files are used in Quake2, easier to read.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!