Jump to content
Search Community

Support for ConvolutionFilter?

rondog test
Moderator Tag

Recommended Posts

Sorry Carl and Jack, I know you guys said you like to keep the questions on topic with the API, but I feel this is. I am applying filters to a bitmap using something like: 

TweenLite.to(origBitmap,0,{colorMatrixFilter:{saturation:2,brightness:3});

 and that works fine.

 

I need to somehow apply a sharpen filter to the video which I have successfully achieved using a ConvolutionFilter. The problem is after I've ran the above tweenlite call, then create a convolution filter and apply it to origBitmap, it removes the initial saturation and brightness filters and just keeps the sharpen filter

private function applyEffects(effects:Array):void
{
  currentEffects = effects;
  var props:Object = {};
  for (var i:String in effects)
  {
    props[effects[i].effect] = effects[i].amount;
  }
  TweenLite.to(bitmap,0,{colorMatrixFilter:props});
  //-- props could look like {saturation:2,brightness:3}


  //-- This will sharpen the container sprite
  var matrix:Array = [0, -1,  0,
                     -1,  5, -1,
                      0, -1,  0];
  var conv:ConvolutionFilter = new ConvolutionFilter();
  conv.matrixX = 3;
  conv.matrixY = 3;
  conv.matrix = matrix;
  conv.divisor = 1; 
  bitmap.filters = [conv]; //-- this removes the above filters and just sharpens the image
}

Is there a way to also incorporate the ConvolutionFilter in that TweenLite call above? I've searched quite a bit and found some guy made a class called TweenMan which was based around your class where ConvolutionFilter is incorporated: https://github.com/danro/tweenman-as3

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...