SetBlend

Monkey Forums/Monkey Programming/SetBlend

Shagwana(Posted 2011) [#1]
Currently I see that this command does different things depending what platform its on.

Any chance we can get a break down of what its should do in say Flash and html targets?

Also, is there any plans to improve on this command?


matt(Posted 2011) [#2]
I'd love to see some extra blend modes but it's a big ask for HTML5 at the moment.

(but check out context-blender on my github if you're interested)


Perturbatio(Posted 2011) [#3]
My perticles app (http://www.monkeycoder.co.nz/Community/topics.php?forum=1037&app_id=37) uses setblend(1), in HTML is does the lightblend as expected, on android they just look a little flat (I had to add the shininess to the sprite instead to achieve a vaguely decent effect).

I had a play around in the Android source to see if I could change anything, but have yet to find a blend mode that does much.


Shagwana(Posted 2011) [#4]
After a little play around, I have now managed to alter the modes available to flash. The one I was after was multiply :)


matt(Posted 2011) [#5]
Care to share the code changes?


Shagwana(Posted 2011) [#6]
In Monkey\modules\mojo\native\mojo.flash.as
internal function SetBlend( blend:int ):int{
		switch( blend ){
		case 1:
			this.blend=BlendMode.ADD;
			break;
		default:
			this.blend=null;
		}
		return 0;
	}

...Replaced with ...
internal function SetBlend( blend:int ):int{
		switch( blend ){
		case 1:
			this.blend=BlendMode.ADD;
			break;
		case 2:
			this.blend=BlendMode.SUBTRACT;
			break;
		case 3:
			this.blend=BlendMode.MULTIPLY;
			break;
		default:
			this.blend=null;
		}
		return 0;
	}


Now SetBlend on the flash platform has 2 more methods of blending

Other modes can be seen here


matt(Posted 2011) [#7]
Excellent, thanks.