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