Apache Flex 4.16.0 API Reference | All Packages | All Classes | Index | Frames No Frames |
IImageEncoder

Package | mx.graphics.codec
Interface | public interface IImageEncoder
Implementors | JPEGEncoder, PNGEncoder

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

The IImageEncoder interface defines the interface that image encoders implement to take BitmapData objects, or ByteArrays containing raw ARGB pixels, as input and convert them to popular image formats such as PNG or JPEG.

See also

PNGEncoder
JPEGEncoder

Public Properties

| Property | Defined By
--- | --- | ---
|  | contentType : String [read-only] The MIME type for the image format that this encoder produces. | IImageEncoder

Public Methods

| Method | Defined By
--- | --- | ---
|  | encode(bitmapData:BitmapData):ByteArray Encodes a BitmapData object as a ByteArray. | IImageEncoder
|  | encodeByteArray(byteArray:ByteArray, width:int, height:int, transparent:Boolean = true):ByteArray Encodes a ByteArray object containing raw pixels in 32-bit ARGB (Alpha, Red, Green, Blue) format as a new ByteArray object containing encoded image data. | IImageEncoder

Property Detail

contentType | property

`contentType:String` [read-only]

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

The MIME type for the image format that this encoder produces.

Implementation
`public function get contentType():String`
Method Detail

encode | () | method

`public function encode(bitmapData:BitmapData):ByteArray`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Encodes a BitmapData object as a ByteArray.

Parameters

| `bitmapData:BitmapData` — The input BitmapData object.

Returns

| `ByteArray` — Returns a ByteArray object containing encoded image data.

encodeByteArray | () | method |

`public function encodeByteArray(byteArray:ByteArray, width:int, height:int, transparent:Boolean = true):ByteArray`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Encodes a ByteArray object containing raw pixels in 32-bit ARGB (Alpha, Red, Green, Blue) format as a new ByteArray object containing encoded image data. The original ByteArray is left unchanged.

Parameters

| `byteArray:ByteArray` — The input ByteArray object containing raw pixels. This ByteArray should contain `4 width height` bytes. Each pixel is represented by 4 bytes, in the order ARGB. The first four bytes represent the top-left pixel of the image. The next four bytes represent the pixel to its right, etc. Each row follows the previous one without any padding.
| `width:int` — The width of the input image, in pixels.
| `height:int` — The height of the input image, in pixels.
| `transparent:Boolean` (default = `true`)`` — If `false`, alpha channel information is ignored.

Returns

| `ByteArray` — Returns a ByteArray object containing encoded image data.

Sun Mar 5 2017, 03:42 PM +11:00