imaging/imagingfws/src/ImageStraightRelay.h
changeset 0 5752a19fdefe
equal deleted inserted replaced
-1:000000000000 0:5752a19fdefe
       
     1 // Copyright (c) 2001-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 // Not for public use
       
    15 // Abstract relay between Image{Decoder,Encoder} and Priv object - will shield any threads
       
    16 // 
       
    17 //
       
    18 
       
    19 #ifndef __IMAGESTRAIGHTRELAY_H__
       
    20 #define __IMAGESTRAIGHTRELAY_H__
       
    21 
       
    22 #include <caf/caf.h>
       
    23 using namespace ContentAccess;
       
    24 
       
    25 #include "icl/ImageCodec.h"
       
    26 #include "icl/ImageData.h"
       
    27 #include "ImageRelay.h"
       
    28 #include "ImageConversion.h"
       
    29 #include "icl/imageconversionextension.h"
       
    30 
       
    31 class CImageDecoderPriv;
       
    32 class CImageEncoderPriv;
       
    33 
       
    34 // Direct relay between CImageDecoder and CImageDecoderPriv
       
    35 class CImageDecoderStraightRelay; // declared here
       
    36 NONSHARABLE_CLASS( CImageDecoderStraightRelay ): public CBase, 
       
    37                                                  public MImageDecoderRelay,
       
    38                                                  public MImageDecoderPrivSupport
       
    39 	{
       
    40 public:
       
    41 	static CImageDecoderStraightRelay* NewL(CImageDecodeConstruct *aConstruct);
       
    42 	~CImageDecoderStraightRelay();
       
    43 
       
    44 	// from MDecoderRelay
       
    45 	void Cancel();
       
    46 
       
    47 	void SetFileL(RFs& aFs, const TDesC& aSourceFilename, const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNone);
       
    48 	void SetFileL(RFile& name, const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNone);
       
    49 	void SetDataL(RFs& aFs, const TDesC8& aSourceData, const CImageDecoder::TOptions aOptions = CImageDecoder::EOptionNone);
       
    50 
       
    51 	CImageDecoderPlugin* Plugin() const;
       
    52 
       
    53 	void HandleNewlyOpenedImageL();
       
    54 
       
    55 	void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, TInt aFrameNumber);
       
    56 	void Convert(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, CFbsBitmap& aDestinationMask, TInt aFrameNumber = 0);
       
    57 	void ContinueConvert(TRequestStatus* aRequestStatus);
       
    58 
       
    59 	void ContinueProcessingHeaderL();
       
    60 
       
    61 	const TFrameInfo& FrameInfo(TInt aFrameNumber) const;
       
    62 	CFrameInfoStrings* FrameInfoStringsLC(TInt aFrameNumber);
       
    63 
       
    64 	TUid ImplementationUid() const;
       
    65 
       
    66 	TInt FrameCount() const;
       
    67 	TBool IsImageHeaderProcessingComplete() const;
       
    68 	const CFrameImageData& FrameData(TInt aFrameNumber) const;
       
    69 
       
    70 	TInt NumberOfImageComments() const;
       
    71 	HBufC* ImageCommentL(TInt aCommentNumber) const;
       
    72 	TInt NumberOfFrameComments(TInt aFrameNumber) const;
       
    73 	HBufC* FrameCommentL(TInt aFrameNumber, TInt aCommentNumber) const;
       
    74 
       
    75 	void CustomSyncL(TInt aParam);
       
    76 	void CustomAsync(TRequestStatus* aRequestStatus, TInt aParam);
       
    77 
       
    78 	void TransferConstructOwnership();
       
    79 
       
    80 	void SetImageTypeL(TInt aImageType);
       
    81 	
       
    82 	// from MImageDecoderPrivSupport
       
    83 	TBool MustUseBufferWithDescriptor() const;
       
    84 	void CopyBufferToDescriptor(TDes8& aBuffer, const TDesC8& aSource, TInt aPosition, TInt aSize);
       
    85 	TBool AmInThread() const;
       
    86 	TBool ShouldAbort() const;
       
    87 	void Lock();
       
    88 	void Unlock();
       
    89 	void SaveFrameCount(TInt aFrameCount);
       
    90 
       
    91 	// from MImageDecoderRelay
       
    92 	void SetIntent(TIntent aIntent);
       
    93 	void SetUniqueIdL(const TDesC& aUniqueId);
       
    94 	TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue);
       
    95 
       
    96 	TInt ReductionFactor(const TSize& aOriginalSize, const TSize& aReducedSize) const;
       
    97 	TInt ReducedSize(const TSize& aOriginalSize, TInt aReductionFactor, TSize& aReducedSize) const;
       
    98 	
       
    99 	TInt SetDecoderThreadPriority(TThreadPriority aPriority);
       
   100 	
       
   101 	void GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr);
       
   102 	void SetClippingRectL(const TRect* aClipRect);
       
   103 	TInt GetDestinationSize(TSize& aSize, TInt aFrameNumber = 0);
       
   104 	CImageConvExtensionCache& ExtensionCache();
       
   105 
       
   106 protected:
       
   107 	CImageDecoderStraightRelay(CImageDecodeConstruct* aConstruct);
       
   108 	void ConstructL();
       
   109 
       
   110 private:
       
   111 	CImageDecodeConstruct* iConstruct;
       
   112 	TBool iOwnConstruct;
       
   113 	CImageDecoderPriv* iBody;
       
   114 	RThread iMyThread;
       
   115 	CImageConvExtensionCache* iExtensionCache;
       
   116 	};
       
   117 
       
   118 // Straight relay between CImageEncoder and CImageEncoderPriv
       
   119 class CImageEncoderStraightRelay; // declared here
       
   120 NONSHARABLE_CLASS( CImageEncoderStraightRelay ): public CBase, 
       
   121                                                  public MImageEncoderRelay,
       
   122 								                 public MImageEncoderPrivSupport
       
   123 	{
       
   124 public:
       
   125 	static CImageEncoderStraightRelay* NewL(CImageEncodeConstruct* aConstruct);
       
   126 	~CImageEncoderStraightRelay();
       
   127 
       
   128 	// from MEncoderRelay
       
   129 	void Cancel();
       
   130 
       
   131 	void SetFileL(RFs& aFs, const TDesC& aDestinationFilename, const CImageEncoder::TOptions aOptions);
       
   132 	void SetFileL(RFile& name, const CImageEncoder::TOptions aOptions);
       
   133 	void SetDataL(HBufC8*& aDestinationData, const CImageEncoder::TOptions aOptions);
       
   134 
       
   135 	CImageEncoderPlugin* Plugin() const;
       
   136 
       
   137 	void Convert(TRequestStatus* aRequestStatus, const CFbsBitmap& aSource, const CFrameImageData* aFrameImageData);
       
   138 
       
   139 	TUid ImplementationUid() const;
       
   140 
       
   141 	void CustomSyncL(TInt aParam);
       
   142 	void CustomAsync(TRequestStatus* aRequestStatus, TInt aParam);
       
   143 
       
   144 	void TransferConstructOwnership();
       
   145 	
       
   146 	void GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr);
       
   147 	CImageConvExtensionCache& ExtensionCache();
       
   148 
       
   149 	// from MImageEncoderPrivSupport
       
   150 	TBool AmInThread() const;
       
   151 	TBool ShouldAbort() const;
       
   152 
       
   153 	void SetThumbnail(TBool aDoGenerateThumbnail);
       
   154 	
       
   155 	TInt SetEncoderThreadPriority(TThreadPriority aPriority);
       
   156 
       
   157 protected:
       
   158 	CImageEncoderStraightRelay(CImageEncodeConstruct* aConstruct);
       
   159 	void ConstructL();
       
   160 
       
   161 private:
       
   162 	CImageEncodeConstruct* iConstruct;
       
   163 	TBool iOwnConstruct;
       
   164 	CImageEncoderPriv* iBody;
       
   165 	RThread iMyThread;
       
   166 	CImageConvExtensionCache* iExtensionCache;
       
   167 	};
       
   168 
       
   169 #endif // __IMAGESTRAIGHTRELAY_H__
       
   170