Packagecom.yworks.remote
Classpublic class ImageExportHandler
InheritanceImageExportHandler Inheritance AbstractImageExportHandler Inheritance flash.events.EventDispatcher

A handler that will create a bitmap representation of the canvas content and upload it to the server. The server is expected to respond with a file stream, so the exported image can be saved on the client.



Public Properties
 PropertyDefined By
  additionalParameters : Object
Get or set an object containing additional parameters that will be transfered to the service URL.
ImageExportHandler
 InheritedmaxImageSize : ISize
Get or set the maximum allowed image size.
AbstractImageExportHandler
Protected Properties
 PropertyDefined By
 InheritedfileReference : FileReference
The FileReference which handles the file operations.
AbstractImageExportHandler
Public Methods
 MethodDefined By
  
ImageExportHandler(downloadURL:String)
Creates a new export handler that will use the given downloadURL to download the exported images.
ImageExportHandler
 Inherited
export(canvas:CanvasComponent, defaultFileName:String, exportOptions:ExportOptions = null, canvasSprite:Sprite = null):void
Exports the image using the provided export options.
AbstractImageExportHandler
Protected Methods
 MethodDefined By
 Inherited
createFileReference():FileReference
Creates a new FileReference and sets the fileReference property.
AbstractImageExportHandler
 Inherited
createImageAsByteArray(canvas:CanvasComponent, exportOptions:ExportOptions, canvasSprite:Sprite = null):ByteArray
Create a ByteArray which contains an encoded image of the canvas.
AbstractImageExportHandler
  
createURLRequest(downloadURL:String):URLRequest
Create the URLRequest instance that will be used for the download request.
ImageExportHandler
  
createURLVariables(canvas:CanvasComponent, exportOptions:ExportOptions, canvasSprite:Sprite = null):URLVariables
Create the URL variables that will be sent to the server.
ImageExportHandler
 Inherited
decorateExportSprite(sprite:Sprite, m:Matrix, exportOptions:ExportOptions, canvas:CanvasComponent):void
Callback that allows additional painting on the sprite that will be exported as a bitmap.
AbstractImageExportHandler
 Inherited
encodeBitmap(bitmap:BitmapData):ByteArray
Encodes the given bitmap data to a byte array.
AbstractImageExportHandler
  
exportCore(canvas:CanvasComponent, defaultFileName:String, exportOptions:ExportOptions = null, canvasSprite:Sprite = null):void
[override] Creates the URL variables for the file download using method createURLVariables and starts a download.
ImageExportHandler
 Inherited
getImageData(canvas:CanvasComponent, exportOptions:ExportOptions, canvasSprite:Sprite = null):BitmapData
Draws the canvas contents to a BitmapData instance.
AbstractImageExportHandler
 Inherited
onCancel(event:Event):void
Called when the user chose the cancel button of the download dialog.
AbstractImageExportHandler
 Inherited
onComplete(evt:Event):void
Called when the export operation has finished succesfully.
AbstractImageExportHandler
 Inherited
onHTTPStatus(evt:HTTPStatusEvent):void
Called when the server sends a HTTP status.
AbstractImageExportHandler
 Inherited
onIOError(evt:IOErrorEvent):void
Called when an IO error occurs while executing the image file download.
AbstractImageExportHandler
 Inherited
onProgress(evt:ProgressEvent):void
Dispatched periodically during the file upload or download operation.
AbstractImageExportHandler
 Inherited
onSecurityError(evt:SecurityErrorEvent):void
Called when a security error occurs while executing the image file download.
AbstractImageExportHandler
 Inherited
onSelect(evt:Event):void
Called when the user has selected a location for the image file download.
AbstractImageExportHandler
Property Detail
additionalParametersproperty
additionalParameters:Object

Get or set an object containing additional parameters that will be transfered to the service URL.


Implementation
    public function get additionalParameters():Object
    public function set additionalParameters(value:Object):void
Constructor Detail
ImageExportHandler()Constructor
public function ImageExportHandler(downloadURL:String)

Creates a new export handler that will use the given downloadURL to download the exported images.

Parameters
downloadURL:String
Method Detail
createURLRequest()method
protected function createURLRequest(downloadURL:String):URLRequest

Create the URLRequest instance that will be used for the download request.

Parameters

downloadURL:String — The service URL that was passed upon initialization.

Returns
URLRequest — An URLRequest instance that will be used in the download method.
createURLVariables()method 
protected function createURLVariables(canvas:CanvasComponent, exportOptions:ExportOptions, canvasSprite:Sprite = null):URLVariables

Create the URL variables that will be sent to the server.

The default key name that is used for the image url variable is "exportData".

A pre-calculated Sprite containing a copy of the canvas object tree can be passed to support the export of lazy-loading image data.

Parameters

canvas:CanvasComponent — The canvas that should be exported to a bitmap.
 
exportOptions:ExportOptions — The export options for this export.
 
canvasSprite:Sprite (default = null) — A pre-calculated canvas Sprite.

Returns
URLVariables — The URL variables that will be send to the server.

See also

getImageData()
encodeBitmap()
CanvasComponent.createSprite
exportCore()method 
override protected function exportCore(canvas:CanvasComponent, defaultFileName:String, exportOptions:ExportOptions = null, canvasSprite:Sprite = null):void

Creates the URL variables for the file download using method createURLVariables and starts a download.

This method is called by the export method.

Parameters

canvas:CanvasComponent — The canvas to create the image from.
 
defaultFileName:String — A default file name.
 
exportOptions:ExportOptions (default = null) — The export options.
 
canvasSprite:Sprite (default = null) — An optional pre-calculated sprite to create the image file from.