reading bitmaps & manipulating them

hi

How can bitmaps be read and then be interpreted (for example trying to know/check the size of the image and the colour a pixel happens to be )?

Any good succnciit tutorials?

Anyways I need to learn this in oder to make a tool for an artists to use (im working on gba) since bitmaps aren't supported and neither are any official gba tools (Im working on the virtual boy emulator).
Well, C++ uses bitmaps for everything including displaying to the screen so it is great to learn about. Instead of getting into a lengthy discussion on Bitmaps, here are some books I liked on the subject since most C++ books focus on games or general C++, these books were more geared towards graphics which is what you need.

Introduction to Windows and Graphics Programming with Visual C++.net by Roger Mayne
Programming Windows 5th edition by Charles Petzold

If you want to take a look at these books and decide if you want to buy them, you can download them using bitlord (www.bitlord.com). One is in CHM format and the other in pdf format. Hopefully they help you out as they are both geared toward Win32 API programming.
My deadline is in less than 4 weeks, I kind of wanted quick stuff, but are the books quick as I'm running out of time nowadays with various assignments deadlines.
Easybmp is cross-platform and simple to use.

http://easybmp.sourceforge.net/
Moschops +1
Well then, you want to learn about these functions here. you can google them and if you don't understand them, re-post what you don't understand and I can hlep clarify them.

LoadBitmap - Loads a bitmap from a resource or DLL
BitBlt - Transfering bitmap and images bit by bit

HBITMAP - this is a class
Bitmap - This is a class

HDC - handle to device Content, you must use these to print to the screen, printer, or any other device.

BeginPaint / EndPaint - Not as vital as the others but important to understand if you are putting this code in WM_PAINT

See, you were too generic about where bitmaps were being read from, resource, file, etc... so I can only image.

The first step is getting the bitmap into the HBITMAP class. Once you do, you can use GetObject to put the HBITMAP into the Bitmap class where it will give you all the information you need on it like size, color, etc... Once you have the HBITMAP set up, it takes only 2 lines of code actually and once of them is the declaration of Bitmap, the other is GetObject where you pass HBITMAP and &Bitmap.

Since you only have 4 weeks, here is a copy of code I used in one of my programs

1
2
3
	HDC hDCBitmap = CreateCompatibleDC(hDC);
	HBITMAP hbmCard = CreateCompatibleBitmap(hDCBitmap, width, height);
	HANDLE hOld = SelectObject(hDCBitmap, hbmCard);


the code won't hepl you to better understand this stuff, but it gives you what you need for now. Just so you know, CreateCompatibleBitmap creates an empty bitmap which was what I needed here because I was next going to use StretchBlt to copy and image to the bitmap. StretchBlt is like BitBlt except that it resizes a bitmap for you based on the numbers you give it.
Topic archived. No new replies allowed.