epoc32/include/fbs.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
     1.1 --- a/epoc32/include/fbs.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/fbs.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,9 +1,9 @@
     1.4  // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5  // All rights reserved.
     1.6  // This component and the accompanying materials are made available
     1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// under the terms of "Eclipse Public License v1.0"
     1.9  // which accompanies this distribution, and is available
    1.10 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.12  //
    1.13  // Initial Contributors:
    1.14  // Nokia Corporation - initial contribution.
    1.15 @@ -16,11 +16,22 @@
    1.16  #ifndef __FBS_H__
    1.17  #define __FBS_H__
    1.18  
    1.19 +/**
    1.20 +@file
    1.21 +@publishedAll
    1.22 +@released
    1.23 + */
    1.24  #include <e32std.h>
    1.25  #include <gdi.h>
    1.26  #include <fntstore.h>
    1.27  #include <bitmap.h>
    1.28 -#include <fbsmessage.h>
    1.29 +#include <graphics/fbsdefs.h>
    1.30 +
    1.31 +/**
    1.32 +@publishedAll
    1.33 +@released
    1.34 + */
    1.35 +const TUid KCFbsFontUid = { 268435518 };
    1.36  
    1.37  /**
    1.38  Indicates version of the font and bitmap server without heap locking.
    1.39 @@ -29,36 +40,6 @@
    1.40  */
    1.41  #define SYMBIAN_FBSERV_V2
    1.42  
    1.43 -/**
    1.44 -@internalTechnology
    1.45 -*/
    1.46 -const TUid KCFbsFontUid = { 268435518 };
    1.47 -/**
    1.48 -@internalComponent
    1.49 -*/
    1.50 -const TUid KMultiBitmapRomImageUid = { 268435521 };
    1.51 -/**
    1.52 -@internalComponent
    1.53 -*/
    1.54 -const TUint32 KFontBitmapServerUidValue = 0x10003a16;
    1.55 -/**
    1.56 -@internalComponent
    1.57 -*/
    1.58 -const TUid KFontBitmapServerUid = { KFontBitmapServerUidValue };
    1.59 -/**
    1.60 -@internalAll
    1.61 -*/
    1.62 -IMPORT_C TInt FbsStartup();
    1.63 -
    1.64 -/** 
    1.65 -Required to ensure BC between NGage and 7.0S platforms.  
    1.66 -Function is exported at ordinal corresponding to where NGage platform
    1.67 -has extended this library and must not be moved.
    1.68 -@internalAll
    1.69 -*/
    1.70 -IMPORT_C void DummyReserved1();
    1.71 -
    1.72 -
    1.73  /** 
    1.74  Character width and adjustment information. 
    1.75  @publishedAll
    1.76 @@ -79,6 +60,7 @@
    1.77  
    1.78  class CFbsRalCache;
    1.79  class CFbsSessionHelper;
    1.80 +class CFbsRasterizer;
    1.81  
    1.82  /** 
    1.83  A session with the font and bitmap server. 
    1.84 @@ -118,12 +100,11 @@
    1.85  	void SetCallBackPtr(TInt* aBitmapHandle)const;
    1.86  	HBufC8* GetDecompressionBuffer(TInt aSize);
    1.87  	HBufC8* GetExtraBuffer(TInt aSize);
    1.88 +    TInt ServerSessionHandle() const;
    1.89  public:
    1.90 -	/**
    1.91 -	Used for testing server side out of memory failures
    1.92 -	
    1.93 -	@internalTechnology
    1.94 -	@prototype
    1.95 +	/** WARNING: For internal use ONLY.  Compatibility is not guaranteed in future releases.	 
    1.96 +	Used for testing server side out of memory failures.	
    1.97 +	@test
    1.98  	*/
    1.99  	enum THeapFailType
   1.100  		{
   1.101 @@ -196,6 +177,9 @@
   1.102  	IMPORT_C TBool GetFaceAttrib(TOpenFontFaceAttrib& aAttrib) const;
   1.103  	IMPORT_C TBool IsOpenFont() const;
   1.104  	IMPORT_C TBool HasCharacter(TInt aCode) const;
   1.105 +	IMPORT_C TInt TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const;
   1.106 +	IMPORT_C void TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam,SCharWidth& aCharWidth) const;
   1.107 +
   1.108  
   1.109  protected:
   1.110  	IMPORT_C CFbsFont();
   1.111 @@ -206,11 +190,9 @@
   1.112  	IMPORT_C void Reset();
   1.113  	
   1.114  private:
   1.115 -	void InsertCharacterInCache(TInt aCode, CLinkedFontInformation* &aInfo, CBitmapFont* &aBitmapFont) const;
   1.116 -
   1.117 -private:
   1.118  	TInt DoFontGetShaping(TFontShapeFunctionParameters* aParam) const;
   1.119  	TInt DoFontDeleteShaping(TFontShapeDeleteFunctionParameters* aParam) const;
   1.120 +	TInt DoTextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const;
   1.121  
   1.122  protected:
   1.123  	RFbsSession* iFbs;
   1.124 @@ -219,6 +201,29 @@
   1.125  	TInt iServerHandle;
   1.126  	};
   1.127  
   1.128 +/**
   1.129 +An interface for initialization of extended bitmaps. By implementing this interface, 
   1.130 +creators of extended bitmaps can set the contents of an extended bitmap without 
   1.131 +allocating a temporary buffer and avoid unnecessary memory copying during calls to 
   1.132 +CFbsBitmap::CreateExtendedBitmap().
   1.133 +
   1.134 +WARNING: Class for internal and partner use ONLY.  Compatibility is not guaranteed in future releases.
   1.135 +
   1.136 +@publishedAll
   1.137 +@see CFbsBitmap::CreateExtendedBitmap()
   1.138 +*/
   1.139 +class MFbsExtendedBitmapInitializer
   1.140 +	{
   1.141 +public:
   1.142 +	/**
   1.143 +	Initializes the raw data of an extended bitmap.
   1.144 +	@param aData A pointer to the raw data to be initialized.
   1.145 +	@param aDataSize The size in bytes of the raw data to be initialized.
   1.146 +	@return KErrNone if successful, otherwise another of the system-wide error codes.
   1.147 +	*/
   1.148 +	virtual TInt InitExtendedBitmap(TAny* aData, TInt aDataSize) = 0;
   1.149 +	};
   1.150 +
   1.151  class CDirectFileStore;
   1.152  
   1.153  /** 
   1.154 @@ -307,18 +312,26 @@
   1.155  	IMPORT_C void UnlockHeap(TBool aAlways=EFalse) const;
   1.156  	IMPORT_C void LockHeapLC(TBool aAlways=EFalse) const;
   1.157  	IMPORT_C static void UnlockHeap(TAny* aFbsBitmap);
   1.158 +	IMPORT_C TBool IsVolatile() const;
   1.159 +	IMPORT_C TInt TouchCount() const;
   1.160 +	IMPORT_C TInt64 SerialNumber() const;
   1.161  	IMPORT_C TBool IsCompressedInRAM() const;
   1.162  	IMPORT_C TInt SwapWidthAndHeight();
   1.163 +	IMPORT_C TInt CreateExtendedBitmap(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aType, const TAny* aData, TInt aDataSize);
   1.164 +	IMPORT_C TInt CreateExtendedBitmap(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aType, TInt aDataSize, MFbsExtendedBitmapInitializer& aInitializer);
   1.165 +	IMPORT_C TUid ExtendedBitmapType() const;
   1.166 +	IMPORT_C TInt DataSize() const;
   1.167  	IMPORT_C static HBufC8* GetDecompressionBuffer(TInt aSize);
   1.168 +	IMPORT_C static CFbsRasterizer* Rasterizer();
   1.169  	IMPORT_C TInt GetAllBitmapHandles(RArray<TInt>& aBitmapIdArray) const;
   1.170  	IMPORT_C static HBufC8* GetExtraBuffer(TInt aSize);
   1.171  protected:
   1.172      IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,const TPoint& aDitherOffset,TDisplayMode aDispMode) const;
   1.173  	CBitwiseBitmap* Address() const;
   1.174  	IMPORT_C CBitwiseBitmap* CleanAddress() const;
   1.175 -	inline CBitwiseBitmap* CleanAddress(TUint32*& aDataAddress) const;
   1.176 +	inline CBitwiseBitmap* BeginDataAccessAndGetCleanAddress(TUint32*& aDataAddress) const;
   1.177  	void DoSaveL(RFile& aFile);
   1.178 -	TInt DoCreate(const TSize& aSizeInPixels,TDisplayMode aDispMode,TUid aCreatorUid);
   1.179 +	TInt DoCreate(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aUid, TInt aDataSize = 0);
   1.180  private:
   1.181  	TInt DoLoad(RFile& aFile,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset);
   1.182  	TInt DoLoad(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset);
   1.183 @@ -326,74 +339,21 @@
   1.184  	TBool LoadShiftedRomBmpL(const TDesC& aFileName,TInt32 aId,TUint aFileOffset);
   1.185  	static void DoStoreL(CDirectFileStore* aFileStore,CFbsBitmap* aBitmap,TInt aNumSources,const TDesC* aSources[],TInt32 aSourceIds[]);
   1.186  protected:
   1.187 -/**
   1.188 -@internalComponent
   1.189 -*/
   1.190 +	/** WARNING: For internal use ONLY.  Compatibility is not guaranteed in future releases.
   1.191 +	 */
   1.192  	enum // Flags
   1.193  		{
   1.194 -		EIsRomBitmap = 0x0001
   1.195 +		EIsRomBitmap = 0x0001,
   1.196 +		EIsExtendedBitmap = 0x0002,
   1.197 +		EIsReadOnlyBitmapMask = EIsRomBitmap | EIsExtendedBitmap
   1.198  		};
   1.199 -protected:
   1.200 -/**
   1.201 -@internalComponent
   1.202 -*/
   1.203 -	RFbsSession* iFbs;
   1.204 -/**
   1.205 -@internalComponent
   1.206 -*/
   1.207 -	CBitwiseBitmap* iAddressPointer;
   1.208 -/**
   1.209 -@internalComponent
   1.210 -*/
   1.211 -	TUint16 iFlags;
   1.212 -/**
   1.213 -@internalComponent
   1.214 -*/
   1.215 -	TInt16 iUseCount;
   1.216 -/**
   1.217 -@internalComponent
   1.218 -*/
   1.219 -	TInt iHandle;
   1.220 -/**
   1.221 -@internalComponent
   1.222 -*/
   1.223 -	TInt iServerHandle;
   1.224 -	};
   1.225 -
   1.226 -class CDirectFileStore;
   1.227 -
   1.228 -/**
   1.229 -@deprecated
   1.230 -@internalComponent
   1.231 -*/
   1.232 -class CFbsBitmapAsyncStreamer : public CBase
   1.233 -	{
   1.234 -public:
   1.235 -	enum TMode {ELoad, ESave};
   1.236 -public:
   1.237 -	IMPORT_C ~CFbsBitmapAsyncStreamer();
   1.238 -	IMPORT_C static CFbsBitmapAsyncStreamer* NewL(TMode aMode);
   1.239 -	IMPORT_C TInt Load(const TDesC& aFilename,TInt32 aId,TInt& aScanLines);
   1.240 -	IMPORT_C TBool LoadScanLinesL(TInt aNumberOfScanLines,CFbsBitmap*& aBitmap);
   1.241 -	IMPORT_C TInt Save(const TDesC& aFilename,CFbsBitmap* aBitmap,TInt32& aId,TInt& aScanLines);
   1.242 -	IMPORT_C TBool SaveScanLinesL(TInt aNumberOfScanLines);
   1.243 -private:
   1.244 -	CFbsBitmapAsyncStreamer(TMode aMode);
   1.245 -	void ConstructL();
   1.246 -	void DoLoadL(const TDesC& aFilename,TInt32 aId);
   1.247 -	void DoSaveL(RFile& aFile);
   1.248 -private:
   1.249 -	RFbsSession* iFbs;
   1.250 -	RStoreReadStream iReadStream;
   1.251 -	RStoreWriteStream iWriteStream;
   1.252 -	TStreamId iId;
   1.253 -	CDirectFileStore* iStore;
   1.254 -	TInt iCurrentScanLine;
   1.255 -	TUint32* iScanLineBase;
   1.256 -	CFbsBitmap* iBitmap;
   1.257 -	SEpocBitmapHeader iHeader;
   1.258 -	TDisplayMode iDispMode;
   1.259 -	TMode iMode;
   1.260 +protected:		
   1.261 +	RFbsSession* iFbs;	/**< WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */	
   1.262 +	CBitwiseBitmap* iAddressPointer; /**< WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */	
   1.263 +	TUint16 iFlags; /**< WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
   1.264 +	TInt16 iUseCount; /**< WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
   1.265 +	TInt iHandle; /**< WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
   1.266 +	TInt iServerHandle; /**< WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
   1.267  	};
   1.268  
   1.269  
   1.270 @@ -482,15 +442,18 @@
   1.271  	IMPORT_C void ReleaseTwipsCache();
   1.272  	IMPORT_C void SetSystemDefaultTypefaceNameL(const TDesC& aFontTypefaceName);
   1.273  	IMPORT_C TInt RegisterLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec, TInt& aId);
   1.274 +	IMPORT_C void GetLinkedTypefaceL(CLinkedTypefaceSpecification& aLinkedTypefaceSpec);
   1.275 +	IMPORT_C TInt RegisterLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec);
   1.276 +	IMPORT_C TInt UpdateLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec);
   1.277  private:
   1.278  	CFbsTypefaceStore(CGraphicsDevice* aDevice);
   1.279  	void ConstructL();
   1.280  	TInt CreateFont(CFont*& aFont,const TFontInfo& aFontInfo);
   1.281  	TBool IsFontLoaded(CFont*& aFont, const TFontInfo& aFontInfo) const;
   1.282  	TInt FontHeight(TInt aTypefaceIndex,TInt aHeightIndex,TInt aMessage) const;
   1.283 -	TInt GetNearestFontInTwipsAndCreateFont(CFont*& aFont, TFbsMessage aFbsMessage, const TFontSpec& aFontSpec, TInt aMaxHeight = 0);
   1.284 +	TInt GetNearestFontInTwipsAndCreateFont(CFont*& aFont, TInt aFbsMessage, const TFontSpec& aFontSpec, TInt aMaxHeight = 0);
   1.285  	TInt SendGetNearestFontCommandNCreateFont(
   1.286 -		CFont*& aFont, TFbsMessage aFbsMessage, const TFontSpec& aFontSpec, TInt aMaxHeight = 0);
   1.287 +		CFont*& aFont, TInt aFbsMessage, const TFontSpec& aFontSpec, TInt aMaxHeight = 0);
   1.288  	void GetPixelSizeInTwips(TSize& aSize) const;
   1.289  
   1.290  private: