Class that will encode a jpeg in the background and fire an event when it's done.
protected var _encoder:JPGEncoder
protected var _timer:Timer
protected var _timeSlice:int
public function BackgroundJPGEncoder(image:BitmapData, quality:Number = 50, timeSlice:int = 100)
Construct a jpeg encoder. Once started, the encoder will encode a jpeg over the course
of multiple frames, generating an event to deliver the finished jpeg when it is done.
Parameters
| image:BitmapData — The bitmap to encode.
|
|
| quality:Number (default = 50 ) — The jpeg quality from 1 to 100 which determines the compression level.
|
|
| timeSlice:int (default = 100 ) — The number of milliseconds of processing to do per frame.
|
public function cancel():void
Cancel encoding and discard any intermediate results.
public function start():void
Start encoding
protected function timerHandler(event:TimerEvent):void
Parameters
Event object type: com.threerings.util.ValueEvent
Dispatched when the jpeg is complete.
The 'value' property will contain the received data.
protected const PIXEL_GRANULARITY:int = 100
Copyright © 2007-2009 Three Rings Design, Inc.