class flixel.effects.FlxSpriteFilter
Available on all platforms
This class allows you to add sprite filters to FlxSprites * Create a new instance and pass it an FlxSprite then add new bitmapFilters using addFilter() * * To refresh the filters applied to a sprite use applyFilters(). * * @author Zaphod
Class Fields
Instance Fields
var backupGraphics:CachedGraphics
Stores a copy of pixels before any bitmap filter is applied, this is necessary for native targets where bitmap filters only show when applied * directly to pixels, so a backup is needed to clear filters when removeFilter() is called or when filters are reapplied during calcFrame().
var filters:Array<BitmapFilter>
An array that contains each filter object currently associated with this sprite.
function new(Sprite:FlxSprite, ?WidthIncrease:Int = 0, ?HeightIncrease:Int = 0):Void
Create a new filter for a FlxSprite. * *
Sprite | The FlxSprite to add the filter to. * |
WidthIncrease | How much to increase the graphic's width (useful for things like BlurFilter that need space outside the actual graphic). * |
HeightIncrease | How much to increase the graphic's height (useful for things like BlurFilter that need space outside the actual graphic). |
function addFilter(filter:BitmapFilter, ?regenPixels:Bool = true):Void
Adds a filter to this sprite, the sprite becomes unique and won't share its graphics with other sprites. * Note that for effects like outer glow, or drop shadow, updating the sprite clipping * area may be required, use widthInc or heightInc to increase the sprite area. * *
filter | The filter to be added. |
function applyFilters():Void
Use this to update the sprite when filters are changed. * Its also called automatically when adding a new filter.
function removeAllFilters(?regenPixels:Bool = true):Void
Removes all filters from the sprite, additionally you may call loadGraphic() after removing * the filters to reuse cached graphics/bitmaps and stop this sprite from being unique.
function removeFilter(filter:BitmapFilter, ?regenPixels:Bool = true):Void
Removes a filter from the sprite. * *
filter | The filter to be removed. |