Search code examples
apache-flexflashactionscript-3pixel-bender

How to stretch out the movie clip after applying some Pixel Bender filter? (Flash)


How to stretch out the movie clip to twice its width and height after applying some Pixel Bender filter?

I have some object with video on it (for ex 512 by 512) I apply a Pixel Bender Filter on it. Now I want to stretch the result (for ex to 1024 by 1024). How to stretch it?

So my point is 1) Render the result of effect 2) Stretch out the result

(It’s all fore CPU/GPU resources saving so if such operation would not help me to save than please inform me)


Solution

  • You can create a new Bitmap from it and scale that:

    //mv is your movieclip with the filter applied, mine had shadow so i added 20 pixels in size
    var bitmapData:BitmapData = new BitmapData(mv.width + 20, mv.height + 20, true, 0x00000000);
    bitmapData.draw(mv);
    
    new_mv = new Bitmap(bitmapData);
    new_mv.width *= 2;
    new_mv.height *= 2;
    
    
    addChild(new_mv);
    

    You might want to tweak some stuff like smoothing or pixelsnapping