Jump to content
  • Advertisement

Archived

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

Kojo

I'm confused...

This topic is 5337 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

I just realized that I have absolutely no idea what a bitmap is or how I''d go about creating one... anyone care to enlighten me?

Share this post


Link to post
Share on other sites
Advertisement
Hi Kojo,

As for the definition of a bitmap, Google says this.

As for how to create a bitmap, the obvious would be to use some sort of paint program (like Microsoft Paint if you happen to be a Windows user). If you are interested in programmatically creating a bitmap, then using SDL you can create an SDL_Surface and use the function SDL_SaveBMP( SDL_Surface* surface, const char* filename) .

There are also ways to do this using graphics libraries other than SDL.

Dylan

Share this post


Link to post
Share on other sites
A bitmap is a plain-as-all-hell representation of an image. Think of your picture as a 2d array of pixels; now represent each pixel by a set of four bytes (0.. 255 value for each of red, green and blue intensity, and relative transparency/opacity); now serialize the whole thing (write out all the pixels in order) and put some header information at the beginning.

This is tedious work - and getting the header parsing correct is error-prone - so usually you have a library of some sort to help you out.

It''s not needed though; you can always just look up the necessary file format. The most commonnly seen raw "bitmap" image format is .BMP * ; you should have no problem looking it up on Wotsit''s Format. One particularly strange thing with BMP is that the rows of the image are stored from the bottom up, rather than top down as you might expect. ISTR they made it that way because of something to do with reducing flicker when drawing BMPs on very old, slow computers (because it would take a few monitor refreshes before it was done, and the monitor is painting top down on each refresh... or something).

* Technically, BMP is not *just* a raw bitmap format; it also allows for the use of RLE (Run Length Encoding) compression. My experience has been that such files are rare out "in the field", but they''re worth learning about, if only as an introduction to compression.

Share this post


Link to post
Share on other sites
a bitmap is an array consist of data. i''m sure u know what a pic is. let''s say a computer stores a pic. how does it do that? by separating the pic into pixels(a pixel is a dot on the screen roughly speaking). then we use a set of digits to indicate the color of the pixel. if every pixel can be stored in this way, so can be the entire pic. thus, a computer can store(operate) a pic. and that pic can be called bitmap. one reason of this name is because it''s consist of bits. also, the bitmap format is not a compressed format like jpg or gif, etc. u get me?

Share this post


Link to post
Share on other sites
Also because bitmaps are not compressed they are one of the best for game dev. because compressed images distort images by combining like colors making translucency and transparency hard to do! That is why if you convert an image to JPG it can have allot less quality.



[edited by - blackdark on April 11, 1986 2:07:20 AM]

[edited by - blackdark on April 11, 2004 2:08:57 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by BlackDark
Also because bitmaps are not compressed they are one of the best for game dev. because compressed images distort images by combining like colors making translucency and transparency hard to do! That is why if you convert an image to JPG it can have allot less quality.



[edited by - blackdark on April 11, 1986 2:07:20 AM]

[edited by - blackdark on April 11, 2004 2:08:57 AM]


Uhm... why did you edit your edit tag to say you edited it in 1986, blackdark?


- CD



// Brought to you by Code_Dark
| [( Politics Forum Beta-Test )]

Share this post


Link to post
Share on other sites
Thank you all for your nice replies. I now feel that I understand what a bitmap is.... But how would I go about making one with a height of [an amount I would specify] pixels and witdth of [another amount specified by me]? How would I do this in Paint?

[edited by - Kojo on April 11, 2004 11:42:08 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Kojo
Thank you all for your nice replies. I now feel that I understand what a bitmap is.... But how would I go about making one with a height of [an amount I would specify] pixels and witdth of [another amount specified by me]? How would I do this in Paint?


In Paint:

  1. Launch Paint.

  2. Choose ''Attributes...'' from the ''Image'' menu.

  3. Type the width and height you want into the boxes.

  4. Hit OK.


Tada!

As for getting it into your program to be displayed on the screen, well, that''s partly all about your file format and partly all about your graphics API. You can draw the image in Paint - creating the data - and save it out to a file, move that file around, compress it, decompress it, yadda yadda yadda bing bong... till eventually, you want it to output the same data you put in originally. And how you do *that* is a whole other question.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!