×
Namespaces

Variants
Actions
Revision as of 02:08, 26 July 2012 by hamishwillee (Talk | contribs)

Image Encoding

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: eswar_illuri (25 Mar 2008)
Last edited: hamishwillee (26 Jul 2012)

Using CImageEncoder class we can save images originating from the screen and photos from camera, etc. to files or descriptors. This process is in two stages:

Object Creation

Creation of encoder object is synchronous operation and is performed using the constructors FileNewL() or DataNewL().

The FileNewL() constructor is used when converting image data that is to be saved to file. And DataNewL() constructor is used when converting image data that is to be saved to descriptor.

Object Conversion

Before converting image data, we need to the destination image format specific data using CFrameImageData. And using Convert() method we can convert the image to destination image format. Following is the code snippet for convert the image

TJpegImageData * imageData = new (ELeave) TJpegImageData;
 
// Set some format specific data
imageData->iSampleScheme = TJpegImageData::EColor444;
imageData->iQualityFactor = 95;
 
iFrameImageData = CFrameImageData::NewL();
 
// frameData - ownership passed to iFrameImageData after AppendImageData
User::LeaveIfError(iFrameImageData->AppendImageData(imageData));
 
// Do the convert
iEncoder->Convert(iRequesStatus,iFrameBitmap,(const CFrameImageData*) iFrameImageData);
 
// Note: the convert function is asynchronous.
// If you use descriptor as target for convertion, call the SetActive()
// after iEncoder->Convert() and catch the end of convertion with RunL()
// (i.e. use the CActive stuff)
49 page views in the last 30 days.
×