os/graphics/fbs/fontandbitmapserver/inc/FBS.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/fbs/fontandbitmapserver/inc/FBS.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,544 @@
     1.4 +// Copyright (c) 1995-2010 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 "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef __FBS_H__
    1.20 +#define __FBS_H__
    1.21 +
    1.22 +/**
    1.23 +@file
    1.24 +@publishedAll
    1.25 +@released
    1.26 + */
    1.27 +#include <e32std.h>
    1.28 +#include <gdi.h>
    1.29 +#include <fntstore.h>
    1.30 +#include <bitmap.h>
    1.31 +#include <graphics/fbsdefs.h>
    1.32 +
    1.33 +/**
    1.34 +@publishedAll
    1.35 +@released
    1.36 + */
    1.37 +const TUid KCFbsFontUid = { 268435518 };
    1.38 +
    1.39 +/**
    1.40 +Indicates version of the font and bitmap server without heap locking.
    1.41 +@publishedAll
    1.42 +@released
    1.43 +*/
    1.44 +#define SYMBIAN_FBSERV_V2
    1.45 +
    1.46 +/**
    1.47 +Indicates version of FBS that provides the CFbsFont extension 
    1.48 +interfaces RFbsGlyphDataIterator for using hardware glyphs, and
    1.49 +RFbsGlyphMetricsArray.
    1.50 +@publishedAll
    1.51 +@prototype
    1.52 +*/
    1.53 +//#define SYMBIAN_FBSERV_GLYPHDATA
    1.54 +
    1.55 +/** 
    1.56 +Character width and adjustment information. 
    1.57 +@publishedAll
    1.58 +@released
    1.59 +*/
    1.60 +class SCharWidth
    1.61 +	{
    1.62 +public:
    1.63 +	/** The left adjust of the character. */
    1.64 +	TInt iLeftAdjust;
    1.65 +	/** The right adjust of the character. */
    1.66 +	TInt iRightAdjust;
    1.67 +	/** The total width of the character, defined as iLeftAdjust + iWidth + iRightAdjust. */
    1.68 +	TInt iMove;
    1.69 +	/** The width of the character. */
    1.70 +	TInt iWidth;
    1.71 +	};
    1.72 +
    1.73 +class CFbsRalCache;
    1.74 +class CFbsSessionHelper;
    1.75 +class CFbsRasterizer;
    1.76 +class TGlyphCacheMetrics;
    1.77 +class TFbsOogmMessage;
    1.78 +
    1.79 +/** 
    1.80 +A session with the font and bitmap server. 
    1.81 +@publishedAll 
    1.82 +@released
    1.83 +*/
    1.84 +class RFbsSession : protected RSessionBase
    1.85 +	{
    1.86 +	// Allow access to internals for test
    1.87 +	friend class RClean;
    1.88 +	friend class TestFbs;
    1.89 +	friend class CTBitmap;
    1.90 +	friend class CTClean;
    1.91 +	friend class CTFbs;
    1.92 +	
    1.93 +	friend class CFbsBitmap;
    1.94 +	friend class CFbsBitmapAsyncStreamer;
    1.95 +public:
    1.96 +	IMPORT_C RFbsSession();
    1.97 +	IMPORT_C static TInt Connect();
    1.98 +	IMPORT_C static TInt Connect(RFs& aFileServer);
    1.99 +	IMPORT_C static void Disconnect();
   1.100 +	IMPORT_C static RFbsSession* GetSession();
   1.101 +	IMPORT_C void CallBack();
   1.102 +	IMPORT_C void SetCallBack(TCallBack aCallBack);
   1.103 +	IMPORT_C void ResetCallBack();
   1.104 +	IMPORT_C TInt ResourceCount();
   1.105 +	IMPORT_C TInt SendCommand(TInt aMessage,TInt aInt0=0,TInt aInt1=0,TInt aInt2=0,TInt aInt3=0) const;
   1.106 +	TInt SendCommand(TInt aMessage, const TIpcArgs& aArgs) const;
   1.107 +	void SendCommand(TInt aMessage, const TIpcArgs& aArgs, TRequestStatus &aStatus) const;
   1.108 +	IMPORT_C TVersion Version();
   1.109 +	IMPORT_C TUint8* HeapBase() const;
   1.110 +	IMPORT_C TInt GetHeapSizes(TInt& aDefaultHeap, TInt& aSmallBmpHeap, TInt& aBigBmpChunk);
   1.111 +	TInt SessionHandle() const { return Handle(); }
   1.112 +	TInt AllocScanLineBuffer(TInt aSize);
   1.113 +	HBufC8* GetScanLineBuffer();
   1.114 +	void SetCallBackPtr(TInt* aBitmapHandle)const;
   1.115 +	HBufC8* GetDecompressionBuffer(TInt aSize);
   1.116 +	HBufC8* GetExtraBuffer(TInt aSize);
   1.117 +    TInt ServerSessionHandle() const;
   1.118 +    IMPORT_C TInt GetGlyphCacheMetrics(TGlyphCacheMetrics& aGlyphCacheMetrics);
   1.119 +    IMPORT_C TInt ConveyOogmMessage( TFbsOogmMessage& aOogmMessage );
   1.120 +
   1.121 +public:
   1.122 +	/** WARNING: For internal use ONLY.  Compatibility is not guaranteed in future releases.	 
   1.123 +	Used for testing server side out of memory failures.	
   1.124 +	@test
   1.125 +	*/
   1.126 +	enum THeapFailType
   1.127 +		{
   1.128 +		EHeapFailTypeServerMemory,
   1.129 +		EHeapFailTypeHeapMemory,
   1.130 +		};
   1.131 +private:
   1.132 +	TBool LookupBitmapInROM(const TDesC& aFilename, TAny*& aAddr);
   1.133 +	RFs& FileServer() { return *((RFs*)iSpare); }
   1.134 +	static TInt DoAlloc(RFbsSession*& aNewSession);
   1.135 +	TInt DoConnect(RFs& aFileServer);
   1.136 +private:
   1.137 +	TInt iConnections;
   1.138 +	mutable TCallBack iCallBack;
   1.139 +	RChunk iSharedChunk;
   1.140 +	CFbsSessionHelper* iHelper;
   1.141 +	RChunk iLargeBitmapChunk;
   1.142 +	RFs iFileServer;
   1.143 +	CFbsRalCache* iRomFileAddrCache;
   1.144 +	HBufC8* iDecompressionBuffer;
   1.145 +	HBufC8* iScanLineBuffer;	
   1.146 +	TUint32* iSpare;
   1.147 +	};
   1.148 +
   1.149 +/** forward declaration of some private classes. */
   1.150 +class TGetFontTableParam;
   1.151 +class TReleaseGlyphOutlineParam;
   1.152 +class TGetGlyphOutlineParam;
   1.153 +
   1.154 +
   1.155 +/** 
   1.156 +Font managed by the font and bitmap server.
   1.157 +CFbsFont objects are used for screen and off-screen bitmap fonts. They are 
   1.158 +usually obtained by calls to the CBitmapDevice::GetNearestFontInPixels() and 
   1.159 +MGraphicsDeviceMap::GetNearestFontInTwips() functions.
   1.160 +The class implements a number of functions inherited from CFont.
   1.161 +@see CBitmapDevice::GetNearestFontInPixels()
   1.162 +@see MGraphicsDeviceMap::GetNearestFontInTwips() 
   1.163 +@publishedAll 
   1.164 +@released
   1.165 +*/
   1.166 +class CFbsFont: public CFont
   1.167 +	{
   1.168 +	friend class CFbsTypefaceStore;
   1.169 +	friend class RFbsGlyphDataIterator;
   1.170 +	friend class RFbsGlyphMetricsArray;
   1.171 +
   1.172 +private:
   1.173 +	// From CFont
   1.174 +	/** Gets the font's UID. 
   1.175 +	All CFbsFont objects have the constant UID KCFbsFontUid. It is safe to cast 
   1.176 +	from CFont* to CFbsFont* if CFont::TypeUid() returns KCFbsFontUid.
   1.177 +	@return The font's UID. This should be KCFbsFontUid. 
   1.178 +	@see CFont::TypeUid() */
   1.179 +	virtual TUid DoTypeUid() const { return KCFbsFontUid; }
   1.180 +	IMPORT_C virtual TInt DoHeightInPixels() const;
   1.181 +	IMPORT_C virtual TInt DoAscentInPixels() const;
   1.182 +	IMPORT_C virtual TInt DoCharWidthInPixels(TChar aChar) const;
   1.183 +	IMPORT_C virtual TInt DoTextWidthInPixels(const TDesC& aText) const;
   1.184 +	IMPORT_C virtual TInt DoBaselineOffsetInPixels() const;
   1.185 +	IMPORT_C virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels) const;
   1.186 +	IMPORT_C virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const;
   1.187 +	IMPORT_C virtual TInt DoMaxCharWidthInPixels() const;
   1.188 +	IMPORT_C virtual TInt DoMaxNormalCharWidthInPixels() const;
   1.189 +	IMPORT_C virtual TFontSpec DoFontSpecInTwips() const;
   1.190 +	IMPORT_C virtual CFont::TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,
   1.191 +		const TUint8*& aBitmap, TSize& aBitmapSize) const;
   1.192 +	IMPORT_C virtual TInt DoExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const;
   1.193 +
   1.194 +public:
   1.195 +	// New functions
   1.196 +	IMPORT_C TBool GetFontMetrics(TOpenFontMetrics& aMetrics) const;
   1.197 +	IMPORT_C TInt TextWidthInPixels(const TDesC& aText) const;
   1.198 +	IMPORT_C void TextWidthInPixels(const TDesC& aText,SCharWidth& aCharWidth) const;
   1.199 +	IMPORT_C TInt Handle() const;
   1.200 +	IMPORT_C TCharacterMetrics CharacterMetrics(TInt aCode,const TUint8*& aBytes) const;
   1.201 +	IMPORT_C TInt RawTextWidthInPixels(const TDesC& aText) const;
   1.202 +	IMPORT_C TBool GetFaceAttrib(TOpenFontFaceAttrib& aAttrib) const;
   1.203 +	IMPORT_C TBool IsOpenFont() const;
   1.204 +	IMPORT_C TBool HasCharacter(TInt aCode) const;
   1.205 +	IMPORT_C TInt TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const;
   1.206 +	IMPORT_C void TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam,SCharWidth& aCharWidth) const;
   1.207 +
   1.208 +
   1.209 +protected:
   1.210 +	IMPORT_C CFbsFont();
   1.211 +	IMPORT_C ~CFbsFont();
   1.212 +	IMPORT_C CFbsFont(const CFbsFont& aFont);
   1.213 +	IMPORT_C CBitmapFont* Address() const;
   1.214 +	IMPORT_C TInt Duplicate(TInt aHandle);
   1.215 +	IMPORT_C void Reset();
   1.216 +	
   1.217 +private:
   1.218 +	TInt DoFontGetShaping(TFontShapeFunctionParameters* aParam) const;
   1.219 +	TInt DoFontDeleteShaping(TFontShapeDeleteFunctionParameters* aParam) const;
   1.220 +	TInt DoTextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const;
   1.221 +	TInt DoGetFontTable(TGetFontTableParam * aParam) const;
   1.222 +	TInt DoGetGlyphOutline(TGetGlyphOutlineParam *aParam) const;
   1.223 +	TInt DoReleaseGlyphOutline(TReleaseGlyphOutlineParam *aParam) const;
   1.224 +	TInt DoReleaseFontTable(TUint32 *aParam) const;
   1.225 +
   1.226 +protected:
   1.227 +	RFbsSession* iFbs;
   1.228 +	CBitmapFont* iAddressPointer;
   1.229 +	TInt iHandle;
   1.230 +    TInt iServerHandle;
   1.231 +	};
   1.232 +
   1.233 +/**
   1.234 +An interface for initialization of extended bitmaps. By implementing this interface, 
   1.235 +creators of extended bitmaps can set the contents of an extended bitmap without 
   1.236 +allocating a temporary buffer and avoid unnecessary memory copying during calls to 
   1.237 +CFbsBitmap::CreateExtendedBitmap().
   1.238 +
   1.239 +WARNING: Class for internal and partner use ONLY.  Compatibility is not guaranteed in future releases.
   1.240 +
   1.241 +@publishedAll
   1.242 +@see CFbsBitmap::CreateExtendedBitmap()
   1.243 +*/
   1.244 +class MFbsExtendedBitmapInitializer
   1.245 +	{
   1.246 +public:
   1.247 +	/**
   1.248 +	Initializes the raw data of an extended bitmap.
   1.249 +	@param aData A pointer to the raw data to be initialized.
   1.250 +	@param aDataSize The size in bytes of the raw data to be initialized.
   1.251 +	@return KErrNone if successful, otherwise another of the system-wide error codes.
   1.252 +	*/
   1.253 +	virtual TInt InitExtendedBitmap(TAny* aData, TInt aDataSize) = 0;
   1.254 +	};
   1.255 +
   1.256 +class CDirectFileStore;
   1.257 +
   1.258 +/** 
   1.259 +Note that this class is not intended for user derivation.
   1.260 +A bitmap managed by the font and bitmap server.
   1.261 +The class also defines some palette functionality which is not yet 
   1.262 +implemented, since none of the modes currently supported by screen 
   1.263 +or bitmaps require variable palettes.
   1.264 +Note that the CFbsBitmap format is internal to Symbian, but the 
   1.265 +Image Converter API can be used to convert such bitmaps to standard formats. 
   1.266 +CFbsBitmap instances cannot be shared between different threads. They use some shared
   1.267 +thread local storage data. If you want to share a bitmap between threads, use Duplicate().
   1.268 +@publishedAll 
   1.269 +@released
   1.270 +@see CFbsBitmap::Duplicate()
   1.271 +*/
   1.272 +class CFbsBitmap : public CBase
   1.273 +	{
   1.274 +	friend class TBitmapUtil;
   1.275 +	friend class CBitwiseBitmap;
   1.276 +	friend class CFbsBitmapAsyncStreamer;
   1.277 +	friend class CFbsSessionHelper;
   1.278 +public:
   1.279 +	IMPORT_C CFbsBitmap();
   1.280 +	IMPORT_C ~CFbsBitmap();
   1.281 +	IMPORT_C void Reset();
   1.282 +	IMPORT_C static TInt ScanLineLength(TInt aLength,TDisplayMode aDispMode);
   1.283 +	IMPORT_C TDisplayMode DisplayMode() const;
   1.284 +	IMPORT_C TDisplayMode InitialDisplayMode() const;
   1.285 +	IMPORT_C TInt SetDisplayMode(TDisplayMode aDisplayMode);
   1.286 +	IMPORT_C TInt Create(const TSize& aSizeInPixels,TDisplayMode aDispMode);
   1.287 +	IMPORT_C TInt Duplicate(TInt aHandle);
   1.288 +	IMPORT_C TBool IsRomBitmap() const;
   1.289 +	IMPORT_C void SetRomBitmapL(CBitwiseBitmap* aRomBitmapPointer,TInt& aBitmapSizeInBytes);
   1.290 +	IMPORT_C TInt Load(const TDesC& aFileName,TInt32 aId=0,TBool aShareIfLoaded=ETrue);
   1.291 +	IMPORT_C TInt Load(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset);
   1.292 +	IMPORT_C TInt LoadAndCompress(const TDesC& aFileName,TInt32 aId=0,TBool aShareIfLoaded=ETrue);
   1.293 +	IMPORT_C TInt LoadAndCompress(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset);
   1.294 +	IMPORT_C TInt Load(RFile& aFile,TInt32 aId=0,TBool aShareIfLoaded=ETrue);
   1.295 +	IMPORT_C TInt Load(RFile& aFile,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset);		
   1.296 +	IMPORT_C TInt LoadAndCompress(RFile& aFile,TInt32 aId=0,TBool aShareIfLoaded=ETrue);	
   1.297 +	IMPORT_C TInt LoadAndCompress(RFile& aFile,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset);	
   1.298 +	IMPORT_C TInt Save(const TDesC& aFilename);
   1.299 +	IMPORT_C TInt Save(RFile& aFile);
   1.300 +	IMPORT_C static void StoreL(const TDesC& aFilename,TInt aNumSources,const TDesC* aSources[],TInt32 aSourceIds[]);
   1.301 +	IMPORT_C static void StoreL(RFile& aFile,TInt aNumSources,const TDesC* aSources[],TInt32 aSourceIds[]);
   1.302 +    IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TDisplayMode aDispMode) const;
   1.303 +    IMPORT_C void SetScanLine(TDes8& aBuf,TInt aY) const;
   1.304 +	IMPORT_C void GetVerticalScanLine(TDes8& aBuf,TInt aX,TDisplayMode aDispMode) const;
   1.305 +	IMPORT_C void GetVerticalScanLine(TDes8& aBuf,TInt aX,const TPoint& aDitherOffset,TDisplayMode aDispMode) const;
   1.306 +	IMPORT_C TInt Handle() const;
   1.307 +	IMPORT_C SEpocBitmapHeader Header() const;
   1.308 +	IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const;
   1.309 +	IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const;
   1.310 +	IMPORT_C void GetPixel(TRgb& aColor,const TPoint& aPixel) const;
   1.311 +	IMPORT_C TInt Resize(const TSize& aSizeInPixels);
   1.312 +	IMPORT_C TSize SizeInPixels() const;
   1.313 +	IMPORT_C TSize SizeInTwips() const;
   1.314 +	IMPORT_C void SetSizeInTwips(const MGraphicsDeviceMap* aMap);
   1.315 +	IMPORT_C void SetSizeInTwips(const TSize& aSizeInTwips);
   1.316 +	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   1.317 +	IMPORT_C void ExternalizeRectangleL(RWriteStream& aStream,const TRect& aRect) const;
   1.318 +	IMPORT_C void InternalizeL(RReadStream& aStream);
   1.319 +	IMPORT_C TInt Compress();
   1.320 +	IMPORT_C TInt Compress(TBitmapfileCompressionScheme aScheme);
   1.321 +	IMPORT_C void CompressInBackground(TRequestStatus& aRequestStatus);
   1.322 +	IMPORT_C TInt CompressInBackground();
   1.323 +	IMPORT_C void CompressInBackground(TRequestStatus& aRequestStatus, TBitmapfileCompressionScheme aScheme);
   1.324 +	IMPORT_C TInt CompressInBackground(TBitmapfileCompressionScheme aScheme);
   1.325 +	IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const;
   1.326 +	IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const;
   1.327 +	IMPORT_C static TBool IsFileInRom(const TDesC& aFilename,TUint32*& aWord);
   1.328 +	IMPORT_C static TBool IsFileInRom(RFile& aFile,TUint32*& aWord);
   1.329 +	IMPORT_C TBool IsMonochrome() const;
   1.330 +	IMPORT_C TBool IsLargeBitmap() const;
   1.331 +	IMPORT_C void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const;
   1.332 +	IMPORT_C void SetPalette(CPalette* aPalette);
   1.333 +	IMPORT_C TInt GetPalette(CPalette*& aPalette) const;
   1.334 +	IMPORT_C TUint32* DataAddress() const;
   1.335 +	IMPORT_C TInt DataStride() const;
   1.336 +	IMPORT_C TInt CreateHardwareBitmap(const TSize& aSizeInPixels,TDisplayMode aDispMode,TUid aCreatorUid);
   1.337 +	IMPORT_C TInt HardwareBitmapHandle() const;
   1.338 +	IMPORT_C void BeginDataAccess() const;
   1.339 +	IMPORT_C void EndDataAccess(TBool aReadOnly=EFalse) const;
   1.340 +	IMPORT_C void LockHeap(TBool aAlways=EFalse) const;
   1.341 +	IMPORT_C void UnlockHeap(TBool aAlways=EFalse) const;
   1.342 +	IMPORT_C void LockHeapLC(TBool aAlways=EFalse) const;
   1.343 +	IMPORT_C static void UnlockHeap(TAny* aFbsBitmap);
   1.344 +	IMPORT_C TBool IsVolatile() const;
   1.345 +	IMPORT_C TInt TouchCount() const;
   1.346 +	IMPORT_C TInt64 SerialNumber() const;
   1.347 +	IMPORT_C TBool IsCompressedInRAM() const;
   1.348 +	IMPORT_C TInt SwapWidthAndHeight();
   1.349 +	IMPORT_C TInt CreateExtendedBitmap(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aType, const TAny* aData, TInt aDataSize);
   1.350 +	IMPORT_C TInt CreateExtendedBitmap(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aType, TInt aDataSize, MFbsExtendedBitmapInitializer& aInitializer);
   1.351 +	IMPORT_C TUid ExtendedBitmapType() const;
   1.352 +	IMPORT_C TInt DataSize() const;
   1.353 +	IMPORT_C static HBufC8* GetDecompressionBuffer(TInt aSize);
   1.354 +	IMPORT_C static CFbsRasterizer* Rasterizer();
   1.355 +	IMPORT_C TInt GetAllBitmapHandles(RArray<TInt>& aBitmapIdArray) const;
   1.356 +	IMPORT_C static HBufC8* GetExtraBuffer(TInt aSize);
   1.357 +protected:
   1.358 +    IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,const TPoint& aDitherOffset,TDisplayMode aDispMode) const;
   1.359 +	CBitwiseBitmap* Address() const;
   1.360 +	IMPORT_C CBitwiseBitmap* CleanAddress() const;
   1.361 +	inline CBitwiseBitmap* BeginDataAccessAndGetCleanAddress(TUint32*& aDataAddress) const;
   1.362 +	void DoSaveL(RFile& aFile);
   1.363 +	TInt DoCreate(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aUid, TInt aDataSize = 0);
   1.364 +private:
   1.365 +	TInt DoLoad(RFile& aFile,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset);
   1.366 +	TInt DoLoad(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset);
   1.367 +	TInt DoLoadFromRom(TUint32* aRomPointer, TInt32 aId, TUint aFileOffset, TBool& aRomPointerValid);
   1.368 +	TBool LoadShiftedRomBmpL(const TDesC& aFileName,TInt32 aId,TUint aFileOffset);
   1.369 +	static void DoStoreL(CDirectFileStore* aFileStore,CFbsBitmap* aBitmap,TInt aNumSources,const TDesC* aSources[],TInt32 aSourceIds[]);
   1.370 +	TInt DuplicateInRom(TInt aBitmapHandle);
   1.371 +	TInt DuplicateInRam(TInt aBitmapHandle);
   1.372 +protected:
   1.373 +	/** WARNING: For internal use ONLY.  Compatibility is not guaranteed in future releases.
   1.374 +	 */
   1.375 +	enum // Flags
   1.376 +		{
   1.377 +		EIsRomBitmap = 0x0001,
   1.378 +		EIsExtendedBitmap = 0x0002,
   1.379 +		EIsReadOnlyBitmapMask = EIsRomBitmap | EIsExtendedBitmap
   1.380 +		};
   1.381 +protected:		
   1.382 +	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.383 +	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.384 +	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.385 +	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.386 +	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.387 +	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.388 +	};
   1.389 +
   1.390 +
   1.391 +/** 
   1.392 +Provides fast read/write access to the pixel data of a bitmap. 
   1.393 +
   1.394 +Functionality includes getting and setting the individual pixels of a bitmap. 
   1.395 +Common to this is the concept of the current pixel position. This is held 
   1.396 +as member data and is changed by using various efficient functions. For example, 
   1.397 +incrementing the position's x- or y co-ordinate is much quicker than setting 
   1.398 +a completely new position. This efficiency issue is important as these functions 
   1.399 +are used as part of the frequently used blitting DDA used for creating 
   1.400 +stretched or compressed versions of bitmaps.
   1.401 +
   1.402 +Calls to Begin() and End() must surround any calls to the other member functions.
   1.403 +Note that you should always ensure each Begin() is matched by an End() call 
   1.404 +when using this class.
   1.405 +
   1.406 +Note also that all display modes including EColor16M are supported, but the 
   1.407 +TDisplayMode values ERgb and ENone are not considered to be display modes. 
   1.408 +@publishedAll 
   1.409 +@released
   1.410 +*/
   1.411 +class TBitmapUtil
   1.412 +	{
   1.413 +public:
   1.414 +	IMPORT_C void Begin(const TPoint& aPosition);
   1.415 +	IMPORT_C void Begin(const TPoint& aPosition,const TBitmapUtil& aUtil);
   1.416 +	IMPORT_C void End();
   1.417 +	IMPORT_C TBitmapUtil(CFbsBitmap* aBitmap);
   1.418 +	IMPORT_C TUint32 GetPixel() const;
   1.419 +	IMPORT_C void SetPixel(TUint32 aValue);
   1.420 +	IMPORT_C void SetPixel(const TBitmapUtil& aSource);
   1.421 +	IMPORT_C void SetPos(const TPoint& aPosition);
   1.422 +	IMPORT_C void DecXPos();
   1.423 +	IMPORT_C void DecYPos();
   1.424 +	IMPORT_C void IncXPos();
   1.425 +	IMPORT_C void IncYPos();
   1.426 +private:
   1.427 +	CFbsBitmap* iFbsBitmap;
   1.428 +	TUint32* iWordPos;
   1.429 +	TUint32* iMinWordPos;
   1.430 +	TUint32* iMaxWordPos;
   1.431 +	TInt iBpp;
   1.432 +	TInt iPixelShift;
   1.433 +	TInt iBitShift;
   1.434 +	TUint32 iMask;
   1.435 +	TInt iScanlineWordLength;
   1.436 +	TBool iWritten;
   1.437 +	};
   1.438 +
   1.439 +class TFontInfo;
   1.440 +
   1.441 +/** 
   1.442 +Font and bitmap server typeface store. 
   1.443 +@publishedAll 
   1.444 +@released
   1.445 +*/
   1.446 +class CFbsTypefaceStore : public CTypefaceStore
   1.447 +	{
   1.448 +	friend class CWsScreenDevice;
   1.449 +public:
   1.450 +	IMPORT_C static CFbsTypefaceStore* NewL(CGraphicsDevice* aDevice);
   1.451 +	IMPORT_C ~CFbsTypefaceStore();
   1.452 +	IMPORT_C TInt AddFile(const TDesC& aName,TInt& aId);
   1.453 +	IMPORT_C TInt InstallFile(const TDesC& aName,TInt& aId);
   1.454 +	IMPORT_C void RemoveFile(TInt aId=0);
   1.455 +	IMPORT_C virtual TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
   1.456 +	IMPORT_C TInt GetNearestFontInPixels(CFont*& aFont, const TFontSpec& aFontSpec);
   1.457 +	IMPORT_C virtual TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec);
   1.458 +	IMPORT_C TInt GetNearestFontToDesignHeightInPixels(CFont*& aFont, const TFontSpec& aFontSpec);
   1.459 +	IMPORT_C virtual TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
   1.460 +	IMPORT_C TInt GetNearestFontToMaxHeightInPixels(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight);
   1.461 +	IMPORT_C TInt GetFontById(CFont *&aFont,TUid aUid,const TAlgStyle& aAlgStyle);
   1.462 +	IMPORT_C virtual TInt NumTypefaces() const;
   1.463 +	IMPORT_C virtual void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const;
   1.464 +	IMPORT_C virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const;
   1.465 +	IMPORT_C TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const;
   1.466 +	IMPORT_C TGlyphBitmapType DefaultBitmapType() const;
   1.467 +	IMPORT_C void SetDefaultBitmapType(TGlyphBitmapType aType) const;
   1.468 +	IMPORT_C void SetFontNameAliasL(const TDesC& aFontAlias,const TDesC& aFontName) const;
   1.469 +	IMPORT_C void SetDefaultLanguageForMetrics(TLanguage aLanguage) const;
   1.470 +	IMPORT_C static void RemoveFontFileLocksL();
   1.471 +	IMPORT_C static void RemoveFontFileLocksL(const TDesC& aDrive, TBool aAllFonts);
   1.472 +	IMPORT_C static void RemoveFontFileLocksL(const TDesC& aFileName);
   1.473 +	IMPORT_C void ReleaseTwipsCache();
   1.474 +	IMPORT_C void SetSystemDefaultTypefaceNameL(const TDesC& aFontTypefaceName);
   1.475 +	IMPORT_C TInt RegisterLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec, TInt& aId);
   1.476 +	IMPORT_C void GetLinkedTypefaceL(CLinkedTypefaceSpecification& aLinkedTypefaceSpec);
   1.477 +	IMPORT_C TInt RegisterLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec);
   1.478 +	IMPORT_C TInt UpdateLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec);
   1.479 +private:
   1.480 +	CFbsTypefaceStore(CGraphicsDevice* aDevice);
   1.481 +	void ConstructL();
   1.482 +	TInt CreateFont(CFont*& aFont,const TFontInfo& aFontInfo);
   1.483 +	TBool IsFontLoaded(CFont*& aFont, const TFontInfo& aFontInfo) const;
   1.484 +	TInt FontHeight(TInt aTypefaceIndex,TInt aHeightIndex,TInt aMessage) const;
   1.485 +	TInt GetNearestFontInTwipsAndCreateFont(CFont*& aFont, TInt aFbsMessage, const TFontSpec& aFontSpec, TInt aMaxHeight = 0);
   1.486 +	TInt SendGetNearestFontCommandNCreateFont(
   1.487 +		CFont*& aFont, TInt aFbsMessage, const TFontSpec& aFontSpec, TInt aMaxHeight = 0);
   1.488 +	void GetPixelSizeInTwips(TSize& aSize) const;
   1.489 +
   1.490 +private:
   1.491 +	RFbsSession* iFbs;
   1.492 +	CGraphicsDevice* iDevice;
   1.493 +	CFontCache* iTwipsCache;
   1.494 +	};
   1.495 +
   1.496 +class CDitherColor256;
   1.497 +
   1.498 +/** 
   1.499 +Copies a bitmap in any display mode of at least 256 colours into a 256 
   1.500 +colour bitmap, optionally using a user-defined palette. 
   1.501 +@publishedAll 
   1.502 +@released
   1.503 +*/
   1.504 +class CFbsColor256BitmapUtil : public CBase
   1.505 +	{
   1.506 +public:
   1.507 +	/** Indicates whether or not to use dithering. */
   1.508 +	enum TDither
   1.509 +		{
   1.510 +		/** No dithering. */
   1.511 +		ENoDither,
   1.512 +		/** Use the Floyd-Steinberg dithering algorithm. */
   1.513 +		EFloydSteinberg
   1.514 +		};
   1.515 +public:
   1.516 +
   1.517 +	IMPORT_C static CFbsColor256BitmapUtil* NewL(const CPalette* aPalette);
   1.518 +
   1.519 +	IMPORT_C TInt CopyBitmap(CFbsBitmap* aColor256Destination,CFbsBitmap* aSource,TDither aDither=ENoDither);
   1.520 +
   1.521 +	~CFbsColor256BitmapUtil();
   1.522 +private:
   1.523 +	CFbsColor256BitmapUtil();
   1.524 +private:
   1.525 +	TColor256Util* iColor256Util;
   1.526 +	CDitherColor256* iDither;
   1.527 +	};
   1.528 +
   1.529 +
   1.530 +/**
   1.531 + A class encapsulating the current state of the glyph cache.
   1.532 +
   1.533 + @publishedAll
   1.534 + @released
   1.535 +*/
   1.536 +class TGlyphCacheMetrics
   1.537 +    {
   1.538 +public:
   1.539 +    TInt iMaxCacheSizeInBytes;
   1.540 +    TInt iMaxCacheSizeHigh;
   1.541 +    TInt iMaxCacheSizeLow;
   1.542 +    TInt iCacheSizeInBytes;
   1.543 +    TBool iGpuCacheSizeLimitIsMax;
   1.544 +    };
   1.545 +
   1.546 +#endif // __FBS_H__
   1.547 +