Newbie Bitmap Woes

Started by
27 comments, last by andutros 12 years, 9 months ago

[quote name='andutros' timestamp='1310054878' post='4832317']
In the ball bitmap, the ball itself is red while the surrounding area is black. In the mask, the ball is black and the surrounding area is white. My understanding is the mask needs to be black where you want the image to appear. Am I correct?


Yeah that sounds right. It was just a shot in the dark because you hadn't described the mask yet and it would be an easy thing to mix up. Sorry if I just ended up causing confusion.
[/quote]

Erm, isn't it the other way around? I've always used white in masks to show where I want the image, and black for 'transparent'
Advertisement

[quote name='andutros' timestamp='1310054878' post='4832317']
In the ball bitmap, the ball itself is red while the surrounding area is black. In the mask, the ball is black and the surrounding area is white. My understanding is the mask needs to be black where you want the image to appear. Am I correct?


Yeah that sounds right. It was just a shot in the dark because you hadn't described the mask yet and it would be an easy thing to mix up. Sorry if I just ended up causing confusion.
[/quote]

No worries. I did give it a try, but nothing changed. I'm still trying to find some documentation on that error code. What's strange is I created the background as a 24-bit bmp using MSPaint, just like I did for the ball and its mask. This line:

hbmpWorld = (HBITMAP)LoadImage(hInst, "simbkg.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

is the line used to load the background, and it works fine. I tried using LoadImage() for the ball and its mask, but I still get that bizarre error.
Try re-creating the bitmaps and saving them as different files; I too had no luck finding out what that error code is supposed to indicate, so at this point we're down to trial and error I'm afraid...

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]


Try re-creating the bitmaps and saving them as different files; I too had no luck finding out what that error code is supposed to indicate, so at this point we're down to trial and error I'm afraid...


Still no good. I'm going to try displaying a random bitmap from my computer. If I still get an error, it's gotta be something in my code.
OK, I tried another bitmap and the same thing is happening, minus that strange error. Does it matter how the bitmap is loaded depending on if it's a top-down or bottom-up?
Loadimage takes care of top-down or bottom-up. That only matters if you load it yourself.


About your questions regarding the size:

Lines are padded to sizes divisible by 4 bytes, You need to calculate a memory line length by using bitsperpixel. Calc how many bytes a line has with padding and multiply by height.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

I've tried using LoadImage() and CreateDIBitmap(). Both successfully return handles. However, selecting them into the device context still fails. I'm about ready to pull my hair out on this thing, lol.
You're not by any chance trying to select the same bitmap into more than one active DC, are you?


I guess maybe if you can post your complete code we can try running it ourselves and see if anything jumps out; failing that, not sure what to tell you, sorry :-S

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Well, I dunno if this helps, but I changed the background and the ball and it's mask to resources. I compiled it and confirmed that I was getting the same results. So I copied the executable to my girlfriend's computer and ran it on there. Unfortunately the window was completely black. Not even the background appeared. I've been working on this program on two different computers (girlfriend's wasn't one of them.) So it seems the images only appear on machines the program was compiled on.

This topic is closed to new replies.

Advertisement