android blurFilter issue

26 views
Skip to first unread message

nathanael tardif

unread,
Jan 20, 2016, 6:07:48 AM1/20/16
to HaxeFlixel
Hi,

I got an issue with blurFilter, hope you'll be able to help me.
I tried to use a blurFilter (on a FlxSprite containing an ellipse drawn with drawEllipse) and it work pretty well on neko and flash.
But on android instead of a smooth blur I got this result :

nathanael tardif

unread,
Jan 20, 2016, 3:51:06 PM1/20/16
to HaxeFlixel
Hi,

Me again, I found the origin of the bug but not the solution !
The FlxSprite on which I'm trying to apply the blurFilter was inside a FlxSpriteGroup. And it seems that the filter doesn't display properly because of that. I tried to add the same filter on a FlxSprite which was not inside a FlxSpriteGroup and it worked just fine.
Is it a known bug or am I doing something wrong ?

nathanael tardif

unread,
Jan 21, 2016, 4:32:38 AM1/21/16
to HaxeFlixel
Hi,

Solved it, sorry for this useless post.
The bug wasn't coming from the FlxSpriteGoup. It doesn't work because I was applying an alpha value (different from 1) to the FlxSprite before adding the filter.
Non working code :
ellipse.makeGraphic(100, 100, FlxColor.TRANSPARENT, true);
ellipse
.drawEllipse(0, 0, 100,100, 0x00ff00, { color: 0x00000000, thickness: 0 }, { color:0xffffffff, hasFill:true } );
ellipse
.alpha = .2; // wrong place to set alpha
               
blurFilter
= new BlurFilter(8,8,5);
sp_filter
= new FlxSpriteFilter(ellipse, 5, 5);
sp_filter
.addFilter(blurFilter);



Working code :
ellipse.makeGraphic(100, 100, FlxColor.TRANSPARENT, true);
ellipse
.drawEllipse(0, 0, 100,100, 0x00ff00, { color: 0x00000000, thickness: 0 }, { color:0xffffffff, hasFill:true } );
               
blurFilter
= new BlurFilter(8,8,5);
sp_filter
= new FlxSpriteFilter(ellipse, 5, 5);
sp_filter
.addFilter(blurFilter);
sp_filter
.sprite.alpha = .2; //good place to set alpha

The first code doesn't work on android but is fine for neko and flash.


Reply all
Reply to author
Forward
0 new messages