SHARE
TWEET

ColorMaskFilter

a guest May 25th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package hcmair.starling.filters
  2. {
  3.     import hcmair.starling.effects.ColorMaskEffect;
  4.    
  5.     import starling.filters.FragmentFilter;
  6.     import starling.rendering.FilterEffect;
  7.  
  8.     public class ColorMaskFilter extends FragmentFilter
  9.     {
  10.         public function ColorMaskFilter(color:uint = 0xFFFFFF, alphaOffset:Number=0):void
  11.         {
  12.             colorOffsetEffect.maskColor = color;
  13.             colorOffsetEffect.alphaOffset = alphaOffset;
  14.         }
  15.  
  16.         override protected function createEffect():FilterEffect
  17.         {
  18.             return new ColorMaskEffect();
  19.         }
  20.  
  21.         private function get colorOffsetEffect():ColorMaskEffect
  22.         {
  23.             return effect as ColorMaskEffect;
  24.         }
  25.  
  26.         public function get maskColor():uint { return colorOffsetEffect.maskColor; }
  27.         public function set maskColor(value:uint):void
  28.         {
  29.             colorOffsetEffect.maskColor = value;
  30.             setRequiresRedraw();
  31.         }
  32.  
  33.         public function get alphaOffset():Number { return colorOffsetEffect.alphaOffset; }
  34.         public function set alphaOffset(value:Number):void
  35.         {
  36.             colorOffsetEffect.alphaOffset = value;
  37.             setRequiresRedraw();
  38.         }
  39.     }
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top