lundi 21 septembre 2015

My ByteArray isn't retaining filters

I have an RTMP stream that I need to take a screenshot of. I got a security error using bitmapData.draw() since it was coming from AWS S3 so I found a workaround that allows me to take a screenshot of the video:

var bitmap = new Bitmap();              
var graphicsData : Vector.<IGraphicsData>;
graphicsData = container.graphics.readGraphicsData(); //-- container is a sprite that holds my video element                
bitmap.bitmapData = GraphicsBitmapFill(graphicsData[0]).bitmapData;
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(bitmap.bitmapData);

At this point, I send the ByteArray to PHP, create a JPG out of the ByteArray and save it to the server. That all works great.

The issue is I apply filters realtime to the container sprite which alters the look of the video like brightness, contrast, saturation etc, but when saving to the server, the saved image doesn't contain the filters I had applied.

When I call the above code, it doesn't seem to take into account the filters I have applied. I tried reapplying the filters to var bitmap, var graphicsData and bitmap.bitmapData, but nothing worked.

How can I either retain the filters applied or reapply the filters to the above code?

Aucun commentaire:

Enregistrer un commentaire