DrawImage draws black boxes. Help!

Archives Forums/Win32 Discussion/DrawImage draws black boxes. Help!

pilgrim(Posted 2005) [#1]
Just started getting my hands dirty with BlitzMAX - so far I like it - good work Mark!

On to my problem - I have some .BMP's I'm using as a player image. When they are drawn, all I get is a black box. Here is the code...

Global playerImages:TImage[32]
...
SetMaskImage(255,0,255)
...
playerImages[i] = LoadImage(file$, MASKEDIMAGE)
...
DrawImage playerImages[actor.curFrame],actor.x,actor.y

This code worked in BlitzPlus.
I've tried every permutation of SetBlend as well to no avail. Thanks in advance for any help.


flying willy(Posted 2005) [#2]
I son't see how using a slice worked in Blitzplus?
i would be zero.

Perhaps you mean LoadAnimImage.


pilgrim(Posted 2005) [#3]
mephitis,

The code I posted above works in BlitzPLUS, Blitz3D

I'm simply loading a series of images and storing their handles in an array - playerImages.

Gil


pilgrim(Posted 2005) [#4]
mephitis,

After looking over your response again I think I understand your confusion.

DrawImage playerImages[actor.curFrame]...

curFrame is a member variable of type GameActor of which actor is an instance of.

in BlitzPLUS it would have been...

actor\curFrame

Hope that clears up the confusion.

Still don't know why DrawImage is drawing black boxes...


xlsior(Posted 2005) [#5]
Are you by any chance using the SETCOLOR statement anywhere?

Be aware that setcolor doesn't just affect pixel operations like it did in the older blitz versions -- it affects *all* graphical operations afterwards.

so if you have a setcolor 0,0,0 (black) then drawimage will also result in completely black results.
If it is setcolor 255,0,0, your sprite will have a red hue (only the red channel gets drawn)

to make sure that drawimage uses the true colors of your sprite, precede it with a SetColor 255,255,255 (white)


pilgrim(Posted 2005) [#6]
xlsior,

Thanks for the response. Actually I discovered my problem last night.

My .BMP's were 256 color images. I loaded them into MS Paint and re-saved as 24-bit .BMP's and BlitzMAX was happy!

So, for future reference for all you coders out there...

Make sure you're using 16, 24 or 32 bit images, not 256 color.

Thanks to all that took the time to offer suggestions and help.

Cheers!

P.S. The SETCOLOR command is way cool in that it affects all future drawing commands...what a simple way to tint your graphics for special occasions!


Hotcakes(Posted 2005) [#7]
Cool, somebody should report that in the bug forums. 256 colour bmps shouldn't be hard to support...