mmplugins/imagingplugins/codecs/JPEGCodec/Exif/ExifThumbnailGenerator.h
branchRCL_3
changeset 50 948c7f65f6d4
parent 0 40261b775718
equal deleted inserted replaced
49:735348f59235 50:948c7f65f6d4
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef EXIFTHUMBNAILGENERATOR_H
       
    17 #define EXIFTHUMBNAILGENERATOR_H
       
    18 
       
    19 
       
    20 #include <e32base.h>
       
    21 #include <f32file.h>
       
    22 #include <icl/imagecodec.h>
       
    23 #include <imageconversion.h>
       
    24 #include "JpegTypes.h"
       
    25 
       
    26 class CFbsBitmap;
       
    27 class CBitmapScaler;
       
    28 class CImageWriteCodec;
       
    29 class MExifSource;
       
    30 
       
    31 //class CFrameImageData;
       
    32 class CScaledJpegGenerator : public CActive
       
    33 	{
       
    34 public:
       
    35 	enum TImageToGenerate
       
    36 		{
       
    37 		EMainImage,
       
    38 		EThumbnail
       
    39 		};
       
    40 
       
    41 
       
    42 public:
       
    43 	static CScaledJpegGenerator* NewL(TRequestStatus* aNotifier, const MExifSource* aSource, 
       
    44 		TBool aMaintainAspectRatio = ETrue, CImageDecoder::TOptions aDecoderOptions = CImageDecoder::EOptionNone);
       
    45 	~CScaledJpegGenerator();
       
    46 	
       
    47 	void StartL(TSize aSize, TImageToGenerate aImageType);
       
    48 	HBufC8* GetJpegDataL();
       
    49 	HBufC8* JpegDataBufferL(const TUint aIndex);
       
    50 	void GetScaledImageSize(TSize &aSize);
       
    51 private:
       
    52 	CScaledJpegGenerator(TRequestStatus* aNotifier, TBool aMaintainAspectRatio, 
       
    53 		CImageDecoder::TOptions aDecoderOptions);
       
    54 	void ConstructL(const MExifSource* aSource);
       
    55 	
       
    56 	void RunL();
       
    57 	void DoCancel();
       
    58 
       
    59 	void GenerationCompleteL();	
       
    60 	TInt RunError(TInt aError);
       
    61 
       
    62 	void DoScaleBitmapL();
       
    63 	void DoConvertL();
       
    64 
       
    65 	void CreateJpegCodecL();
       
    66 	void CleanTempData();
       
    67 	void CleanResultData();
       
    68 	void CleanData();
       
    69 	
       
    70 private:
       
    71 	const MExifSource* iSource;
       
    72 	TRequestStatus* iNotifier;
       
    73 	TSize iSize;
       
    74 	TImageToGenerate iImageType;
       
    75 	
       
    76 	CFbsBitmap* iBitmap;
       
    77 	CImageDecoder* iImageDecoder;
       
    78 	CBitmapScaler* iBitmapScaler;
       
    79 	CImageWriteCodec* iJpegCodec;
       
    80 	TFrameState iFrameState;
       
    81 
       
    82 	RPointerArray<HBufC8> iJPegImage;
       
    83 	HBufC8* iJpegChunck;
       
    84 	TBufPtr8 iJpegChunckPtr;
       
    85 	CImageDecoder::TOptions iDecoderOptions;
       
    86 	enum TThumbnailGeneratorState
       
    87 		{
       
    88 		EEmpty,
       
    89 		EDecode,
       
    90 		EScale,
       
    91 		EConvert,
       
    92 		EFinished
       
    93 		};
       
    94 	TThumbnailGeneratorState iState;
       
    95 
       
    96 	RPointerArray<HBufC8> iComment;
       
    97 	TQTable* iLumaTable;
       
    98 	TQTable* iChromaTable;
       
    99 
       
   100 	TBool iMaintainAspectRatio;
       
   101 	};
       
   102 
       
   103 
       
   104 
       
   105 #endif 	// EXIFTHUMBNAILGENERATOR_H