A little problem with shadeblend

BlitzMax Forums/BlitzMax Beginners Area/A little problem with shadeblend

Josepho(Posted 2011) [#1]
Im trying to obtain this effect
http://img59.imageshack.us/i/efectodeseado.png/

with this image
http://img593.imageshack.us/i/pruebat.png/

but i obtain this
http://img515.imageshack.us/i/efectooobtenido.png/

The code that im using is this one

Graphics 1024,768

Global img:TImage=LoadImage("fondo.png")
Global imgSombras:TImage=LoadImage("Sombras.png",DYNAMICIMAGE)
SetImageHandle(img,ImageWidth(img)/2,ImageHeight(img)/2)

SetBlend(MASKBLEND)
'SetScale 1.07,1.07

While Not AppTerminate()
	SetBlend(MASKBLEND)

	DrawImage img,GraphicsWidth()/2,GraphicsHeight()/2

		SetBlend(SHADEBLEND)
		DrawImage imgSombras,MouseX(),MouseY() 

	Flip
Wend


How can i archieve the effect?? any suggestions?? thanks!


Arabia(Posted 2011) [#2]
Just a quick guess, have you saved your PNG files with a transparent color?


Josepho(Posted 2011) [#3]
Mmm, the png has transparent color but not at all, it shouldnt be need of that if im using the shadeblend isnt it? Like the lightblend that it works as it should with opaque pngs...


Arabia(Posted 2011) [#4]
I'm not sure I follow 100% and without having the exact files it's a bit hard to test.

The results you were getting (rectangle areas) instead of the round sort of shapes is what made me think that it wasn't picking up the area's that should be transparent.

I'm sorry, I haven't messed around with this sort of stuff to help you further.


GfK(Posted 2011) [#5]
Despite the name, ShadeBlend is not the direct opposite of LightBlend and usage is completely different. Have a read of this thread (ignore the first few tit-for-tat replies):

http://www.blitzbasic.com/Community/posts.php?topic=54903#612118


Josepho(Posted 2011) [#6]
And there is any way to archieve the effect that im looking for in blitzmax? Using other images, I mean, like the one of my example

Last edited 2011


ImaginaryHuman(Posted 2011) [#7]
Shadeblend multiplies the background color by the sprite color. Unless your sprite is white things will get darker, but it's not a subtract.


Jesse(Posted 2011) [#8]
you can achieve what you want by changing the color of the front image to a black for both solid shapes and a shade of black for both shadow.
display them in alphablend and setblend to about .5 or just adjust to your liking.

Last edited 2011


Josepho(Posted 2011) [#9]
I thought in that solution but what i want to know if its any way to make a subtract in bmax