some confusions using CImageEncoder

Login to reply to this topic.
Sun, 2007-11-18 13:19
Joined: 2007-11-02
Forum posts: 37

Hi,

I am using the following code

TJpegImageData* imageData=new(ELeave)TJpegImageData;
imageData->iSampleScheme=TJpegImageData::EColor444;
imageData->iQualityFactor=KJpegQualityFactor;
iFrameImgData=CFrameImageData::NewL();
iFrameImgData->AppendImageData(imageData);

void CSmsEncoder::EncodeImageToFile(CFbsBitmap& aBitmap, RFile* aDestFile)
{
if(iImgEncoder!=NULL)
{
delete iImgEncoder;
iImgEncoder=NULL;
iImgEncoder=CImageEncoder::FileNewL(*aDestFile,KJpgMime,CImageEncoder::EOptionNone);//DataNewL(aDestBuffer,KJpgMime);
iImgEncoder->Convert(&iStatus,aBitmap,iFrameImgData);
SetActive();
}
}

where

#define KDirPictures PathInfo::ImagesPath()
#define KPhoneRootPath PathInfo::PhoneMemoryRootPath()

_LIT (KFileName2,"Smpp.jpg");

RFS is the server session:-- which I get by CCoeEnv::Static()->FsSession()
RFile iFile;
TFilename file(KPhoneRootPath);
file.Append(KDirpictures);
file.Append(KFileName);
iFile.Open(CCoenv::Static->FsSession,file,EFileShareExclusive|EFileWrite);

CFBsBitmap aBitmap---> is the bitmap image taken from camera

I am confused

what is the purpose of
1. JPegImagrdata
2.FrameImageData


Mon, 2007-11-19 13:29
Joined: 2004-11-29
Forum posts: 1142
Re: some confusions using CImageEncoder

I have never used this class, but from its name and its usage, it seems the purpose is to define what color sampling and quality setting to use when encoding the jpeg.

A quick check in the header file where it is defined confirms this (found it using a search-in-all-files)

The CFrameImageData is just a generic container for the jpeg-specific "TJpegImageData". (ImageEncoder supports several different format as you probably know)

/**
@publishedAll
@released

JPEG specific image data variant which holds color sampling and quality
factor information.

It can be used with both the JPEG decoder and encoder.
*/
class TJpegImageData : public TImageDataBlock
	{
public:
	/**
	Flag reflecting the color sampling type.
	*/
	enum TColorSampling
		{
		/** Monochrome.
		*/
		EMonochrome,

		/** Horizontal and vertical chrominance decimation.
		*/
		EColor420,

		/** Horizontal chrominance decimation.
		*/
		EColor422,

		/** No chrominance decimation.
		*/
		EColor444
		};
public:
	IMPORT_C TJpegImageData(); // Defaults to EColor420 and 75

public:
	/**
	@see enum TColorSampling

	The color sampling scheme to use.
	*/
	TColorSampling iSampleScheme;

	/** The quality factor. 
	
	This represents the current allowable percentage level of degradation when compressing the image 
	data.

	The range is 0 to 100 inclusive.
	*/
	TInt iQualityFactor; 

private:
	TImageDataBlock* DuplicateL(CFrameImageData& aFrameImageData) const;
	};

  • Login to reply to this topic.