imageeditorengine/JpegRotator/inc/JpegRotatorImpl.h
changeset 1 edfc90759b9f
equal deleted inserted replaced
0:57d4cdd99204 1:edfc90759b9f
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Ixonos Plc
       
    14 *
       
    15 * Description:  
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef JPEGROTATORIMPL_H
       
    21 #define JPEGROTATORIMPL_H
       
    22 
       
    23 
       
    24 // INCLUDES
       
    25 #include "JpegRotator.h"
       
    26 #include "MJpRotateCallBack.h"
       
    27 
       
    28 // debug log writer
       
    29 //#include "imageeditordebugutils.h"
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 
       
    35 class CJpRotate;
       
    36 
       
    37 /*	CLASS: 	CJpegRotatorImpl
       
    38 *
       
    39 *	CJpegRotatorImpl
       
    40 *	Internal representation of CJpegRotator
       
    41 *
       
    42 */
       
    43 class CJpegRotatorImpl : public CBase, public MJpRotateCallBack
       
    44 {
       
    45     
       
    46 public:
       
    47 
       
    48 /** @name Methods:*/
       
    49 //@{
       
    50 
       
    51 	/** NewL factory method, pops cleanup stack
       
    52 	*
       
    53 	*	@param - aFsSession
       
    54 	*	@return pointer to created CJpegRotatorImpl object
       
    55 	*/
       
    56 	static CJpegRotatorImpl * NewL (RFs& aFsSession);
       
    57 
       
    58 	/** Destructor
       
    59 	*
       
    60 	*	@param -
       
    61 	*	@return -
       
    62 	*/
       
    63 	~CJpegRotatorImpl ();
       
    64 
       
    65 	/** PrepareRotateFileL
       
    66 	*
       
    67 	*	@param aRotationMode - 
       
    68 	*	@param aSourceFileName - 
       
    69 	*	@param aTargetFileName -
       
    70 	*	@param aHandleExifData -
       
    71 	*	@return -
       
    72 	*/
       
    73     void PrepareRotateFileL (
       
    74         const TDesC& aSourceFileName,
       
    75         const TDesC& aTargetFileName,
       
    76         CJpegRotator::TRotationMode aRotationMode,
       
    77         TBool aHandleExifData
       
    78         );
       
    79 
       
    80 	/** Start asynchronous rotate
       
    81 	*
       
    82 	*	@param - aStatus
       
    83     *   @param - aStatus
       
    84 	*/
       
    85     void StartAsyncRotate (TRequestStatus& aStatus, TBool aForceLossyMode);
       
    86 
       
    87 	/** Start asynchronous rotate
       
    88 	*
       
    89 	*	@param - aStatus
       
    90 	*/
       
    91     void StartAsyncLosslessRotate (TRequestStatus& aStatus);
       
    92 
       
    93 	/** Finish asynchronous rotate
       
    94 	*
       
    95 	*	@param - aError
       
    96 	*	@return -
       
    97 	*/
       
    98     void FinishAsyncRotate (TInt aError);
       
    99 
       
   100 	/** IsLosslessRotatePossible
       
   101     *
       
   102     *   Check if the image dimensions are suitable for the use of
       
   103     *   rajpeg lossless rotate (divisible by 8)
       
   104 	*/
       
   105     TBool IsLosslessRotatePossible() const;
       
   106 
       
   107 
       
   108 	/** Cancel
       
   109     *   
       
   110     *   Set cancel flag.
       
   111 	*/
       
   112     void Cancel ();
       
   113 
       
   114     /** SetExifData
       
   115 	*
       
   116 	*	@see MImageEditorExifHandlerObserver
       
   117 	*/
       
   118 	void SetExifData (TUint8* aExifData, TUint aDataSize);
       
   119 
       
   120     /** GetThumbnailImageL
       
   121 	*
       
   122 	*	@see MImageEditorExifHandlerObserver
       
   123 	*/
       
   124 	void GetThumbnailImageL (
       
   125         TUint8*& aThumbnailData, 
       
   126         TUint& aDataSize, 
       
   127         const TSize& aThumbnailResolution
       
   128         );
       
   129 
       
   130     /** SetJpegCommentL
       
   131 	*
       
   132 	*	@see MImageEditorExifHandlerObserver
       
   133 	*/
       
   134     void SetJpegCommentL (const TDesC8& aComment);
       
   135 
       
   136     /** GetOutputImageSize
       
   137 	*
       
   138 	*	@see MImageEditorExifHandlerObserver
       
   139 	*/
       
   140 	void GetOutputImageSize ( TInt& aWidth, TInt& aHeight ) const;
       
   141 
       
   142     /** JpRotateStatus
       
   143 	*
       
   144 	*	@see MJpRotateCallBack
       
   145 	*/
       
   146     void JpRotateStatus( TInt aCount, TInt aTotal );
       
   147 
       
   148 //@}
       
   149 
       
   150 protected:
       
   151 
       
   152 /** @name Methods:*/
       
   153 //@{
       
   154 
       
   155 //@}
       
   156 
       
   157 private:
       
   158 
       
   159 /** @name Methods:*/
       
   160 //@{
       
   161 
       
   162 	/** Default constructor
       
   163 	*
       
   164 	*	@param - aFsSession
       
   165 	*	@return -
       
   166 	*/
       
   167 	CJpegRotatorImpl (RFs& aFsSession);
       
   168 
       
   169 	/** Second phase constructor, may leave
       
   170 	*
       
   171 	*	@param -
       
   172 	*	@return -
       
   173 	*/
       
   174 	void ConstructL ();
       
   175 
       
   176 	/** Cleanup
       
   177 	*
       
   178 	*	@param -
       
   179 	*	@return -
       
   180 	*/
       
   181 	void Cleanup ();
       
   182 	
       
   183     /** AsyncRotate
       
   184 	*
       
   185 	*	@param - 
       
   186 	*	@return -
       
   187 	*/
       
   188     static TInt AsyncRotate (TAny* aThis);
       
   189 
       
   190     /** AsyncLosslessRotate
       
   191 	*
       
   192 	*	@param - 
       
   193 	*	@return -
       
   194 	*/
       
   195     static TInt AsyncLosslessRotate (TAny* aThis);
       
   196 
       
   197     /** DoRotateL
       
   198 	*
       
   199 	*	@param - 
       
   200 	*	@return -
       
   201 	*/
       
   202     void DoRotateL ();
       
   203 
       
   204     /** DoLosslessRotateL
       
   205 	*
       
   206 	*	@param - 
       
   207 	*	@return -
       
   208 	*/
       
   209     void DoLosslessRotateL ();
       
   210 
       
   211 	/** GetSourceImagePropertiesL
       
   212 	*
       
   213 	*	@param - 
       
   214 	*	@return -
       
   215 	*/
       
   216     void GetSourceImagePropertiesL ( const TDesC& aFileName );
       
   217 
       
   218 	/** PostRotate
       
   219 	*
       
   220 	*/
       
   221     void PostRotate ();
       
   222 
       
   223 //@}
       
   224 
       
   225 /** @name Members:*/
       
   226 //@{
       
   227 
       
   228     /// File Server session handle
       
   229     RFs& 						iFsSession;
       
   230 
       
   231     /// Source and target files
       
   232     TFileName					iSourceFileName;
       
   233     TFileName					iTargetFileName;
       
   234 
       
   235     /// Current rotate mode 
       
   236     TInt        				iRotationMode;
       
   237 
       
   238     /// Rotator
       
   239     CJpRotate*                  iRotator;
       
   240 
       
   241     /// Do we update EXIF data or not?
       
   242     TBool 						iHandleExifData;
       
   243 
       
   244     /// Quality factor of the original image
       
   245     TUint						iOriginalJpegQualityFactor;
       
   246 
       
   247     /// Size of the source image
       
   248     TSize 						iSourceImageSize;
       
   249 
       
   250     /// 
       
   251     TRequestStatus *			iCallerStatus;
       
   252 
       
   253     ///
       
   254     CAsyncCallBack *			iCallBack;
       
   255 
       
   256     ///
       
   257     TCallBack                   iCb;
       
   258 
       
   259     /// Lossless mode
       
   260     TBool                       iLosslessMode;
       
   261 
       
   262     /// Cancel flag
       
   263     TBool                       iCancelled;
       
   264     
       
   265 #if defined (LOG_TIMING)
       
   266     TTime                       iStartTime;
       
   267     TTime                       iSavingStartTime;
       
   268     TTime                       iFinishTime;
       
   269 #endif
       
   270 
       
   271 
       
   272 //@}
       
   273 
       
   274 };
       
   275 
       
   276 #endif
       
   277 
       
   278 
       
   279 // End of File