diff -r 000000000000 -r e686773b3f54 phonebookui/Phonebook2/Presentation/inc/CPbk2ImageReader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/Phonebook2/Presentation/inc/CPbk2ImageReader.h Tue Feb 02 10:12:17 2010 +0200 @@ -0,0 +1,179 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Phonebook image reader class definition. +* +*/ + + +#ifndef CPBK2IMAGEREADER_H +#define CPBK2IMAGEREADER_H + +// INCLUDES +#include // CBase +#include // RFs +#include "TPbk2ImageManagerParams.h" + +// FORWARD DECLARATIONS +class MPbk2ImageReaderObserver; +class CImageDecoder; +class CBitmapScaler; +class TFrameInfo; +class CFbsBitmap; + +// CLASS DECLARATIONS + +/** + * Phonebook image file or buffer -> bitmap reader. + */ +NONSHARABLE_CLASS(CPbk2ImageReader) : + public CActive + { + public: // interface + /** + * Creates a new instance of this class. + * + * @param aObserver observer to notify about progress of this + * operation. + * @return Image reader + */ + static CPbk2ImageReader* NewL(MPbk2ImageReaderObserver& aObserver); + + /** + * Destructor. Cancels any executing read operation and destroys this + * object. Observer is not notified about the cancellation. + */ + ~CPbk2ImageReader(); + + /** + * Reads bitmap from file. Cancels any previously executing read + * operation. Observer is not notified about the cancellation. + * + * @param aFileName name of the image file to read + * @param aParams optional parameters, @see TPbkImageLoadParameters + */ + void ReadFromFileL + (const TDesC& aFileName, + const TPbk2ImageManagerParams* aParams=NULL); + + /** + * Reads bitmap from buffer. Cancels any previously executing read + * operation. Observer is not notified about the cancellation. + * + * @param aBuffer the buffer to read the image from. Caller must keep + * the buffer alive as long as this reader is + * executing + * @param aParams optional parameters, @see TPbkImageLoadParameters + */ + void ReadFromBufferL + (const TDesC8& aBuffer, + const TPbk2ImageManagerParams* aParams=NULL); + + /** + * Recognizes image format in a file. + * + * @param aFileName file to recognize image format from. + * @see ImageFormat(). + */ + void RecognizeFormatFromFileL(const TDesC& aFileName); + + /** + * Recognizes image format in a buffer. + * + * @param aBuffer buffer to recognize image format from. + * @see ImageFormat(). + */ + void RecognizeFormatFromBufferL(const TDesC8& aBuffer); + + /** + * Returns Mime string of the recognized format. Recognizing + * function has to be called before this, otherwise Mime string + * is not known and NULL descriptor will be returned. + * + * @return Mime string of the recognized format. + */ + const TDesC8& MimeString() const; + + /** + * Returns information about a frame of the image. + * Can be called after this object calls ImageOpenComplete to its + * observer. + * + * @param aFrame number of the frame to get inforamtion of. + * @param aInfo frame information is written to this parameter. + * @precond aFrame>=0 && aFrame