MaskImage Broken In Vista?

BlitzPlus Forums/BlitzPlus Programming/MaskImage Broken In Vista?

VIP3R(Posted 2007) [#1]
The MaskImage function appears to be broken in Windows Vista.

DrawImage always draws the masked area of the image regardless of the mask colour used.

It seems to be working ok in Blitz3D, but not in BlitzPlus.

Can anyone please confirm the problem?


Petron(Posted 2007) [#2]
I have run blitzplus exe files on vista and it worked fine, check your software, make sure you have a recent update.


VIP3R(Posted 2007) [#3]
Define worked fine. Are the images being masked correctly?

I don't recall noticing the problem on Vista with an ATI GPU, only on an nVidia GPU. It might be a vendor driver issue.


Petron(Posted 2007) [#4]
By 'fine' I mean that the masking was correct.


VIP3R(Posted 2007) [#5]
Ok thanks


Petron(Posted 2007) [#6]
Do know of a way to fix this error on Vista?


VIP3R(Posted 2007) [#7]
Heh, so it is an error now then? ;)

I fixed it by masking the images manually, using ReadPixelFast/WritePixelFast and skipping the pixels with the mask colour information.

There was no noticable difference in performance using the above workaround, although it depends on how much you're using it per frame.


Petron(Posted 2007) [#8]
I assume that it is an error, and it could be a problem for the current games, and for me the update would take to long, because of my progress.


Petron(Posted 2007) [#9]
VIP3R can you post an example of how you fixed the mask image error, I recently upgraded my computer to vista and I am receiving the same error.


VIP3R(Posted 2007) [#10]
Here you go...

maskcolour=$FF000000 ; (Black)
imgwidth=ImageWidth(sourceimage)
imgheight=ImageHeight(sourceimage)

LockBuffer ImageBuffer(sourceimage)
LockBuffer BackBuffer()

For y=0 To imgheight-1

	For x=0 To imgwidth-1

		rgb=ReadPixelFast(x,y,ImageBuffer(sourceimage))
		If rgb<>maskcolour Then WritePixelFast(x,y,rgb,BackBuffer())

	Next

Next

UnlockBuffer ImageBuffer(sourceimage)
UnlockBuffer BackBuffer()



norki(Posted 2007) [#11]
So now you're drawing your sprites using WPF instead of DrawSprite?
o_O


Réno(Posted 2007) [#12]
I wonder if it is a drivers problem ; some VISTA users haven't got this mask broken...


Petron(Posted 2007) [#13]
In a fullscreen graphics mode, maskimage is not broken.


Petron(Posted 2007) [#14]
I wrote this to fix the problem. http://blitzbasic.com/codearcs/codearcs.php?code=2112


VIP3R(Posted 2007) [#15]

So now you're drawing your sprites using WPF instead of DrawSprite?
o_O


It's a workaround FFS, MaskImage doesn't work correctly in Vista on some video cards.

You got any better suggestions?