|
1 // Copyright (c) 1995-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 // |
|
15 |
|
16 #ifndef __FBS_H__ |
|
17 #define __FBS_H__ |
|
18 |
|
19 /** |
|
20 @file |
|
21 @publishedAll |
|
22 @released |
|
23 */ |
|
24 #include <e32std.h> |
|
25 #include <gdi.h> |
|
26 #include <fntstore.h> |
|
27 #include <bitmap.h> |
|
28 #include <graphics/fbsdefs.h> |
|
29 |
|
30 /** |
|
31 @publishedAll |
|
32 @released |
|
33 */ |
|
34 const TUid KCFbsFontUid = { 268435518 }; |
|
35 |
|
36 /** |
|
37 Indicates version of the font and bitmap server without heap locking. |
|
38 @publishedAll |
|
39 @released |
|
40 */ |
|
41 #define SYMBIAN_FBSERV_V2 |
|
42 |
|
43 /** |
|
44 Character width and adjustment information. |
|
45 @publishedAll |
|
46 @released |
|
47 */ |
|
48 class SCharWidth |
|
49 { |
|
50 public: |
|
51 /** The left adjust of the character. */ |
|
52 TInt iLeftAdjust; |
|
53 /** The right adjust of the character. */ |
|
54 TInt iRightAdjust; |
|
55 /** The total width of the character, defined as iLeftAdjust + iWidth + iRightAdjust. */ |
|
56 TInt iMove; |
|
57 /** The width of the character. */ |
|
58 TInt iWidth; |
|
59 }; |
|
60 |
|
61 class CFbsRalCache; |
|
62 class CFbsSessionHelper; |
|
63 class CFbsRasterizer; |
|
64 |
|
65 /** |
|
66 A session with the font and bitmap server. |
|
67 @publishedAll |
|
68 @released |
|
69 */ |
|
70 class RFbsSession : protected RSessionBase |
|
71 { |
|
72 // Allow access to internals for test |
|
73 friend class RClean; |
|
74 friend class TestFbs; |
|
75 friend class CTBitmap; |
|
76 friend class CTClean; |
|
77 friend class CTFbs; |
|
78 |
|
79 friend class CFbsBitmap; |
|
80 friend class CFbsBitmapAsyncStreamer; |
|
81 public: |
|
82 IMPORT_C RFbsSession(); |
|
83 IMPORT_C static TInt Connect(); |
|
84 IMPORT_C static TInt Connect(RFs& aFileServer); |
|
85 IMPORT_C static void Disconnect(); |
|
86 IMPORT_C static RFbsSession* GetSession(); |
|
87 IMPORT_C void CallBack(); |
|
88 IMPORT_C void SetCallBack(TCallBack aCallBack); |
|
89 IMPORT_C void ResetCallBack(); |
|
90 IMPORT_C TInt ResourceCount(); |
|
91 IMPORT_C TInt SendCommand(TInt aMessage,TInt aInt0=0,TInt aInt1=0,TInt aInt2=0,TInt aInt3=0) const; |
|
92 TInt SendCommand(TInt aMessage, const TIpcArgs& aArgs) const; |
|
93 void SendCommand(TInt aMessage, const TIpcArgs& aArgs, TRequestStatus &aStatus) const; |
|
94 IMPORT_C TVersion Version(); |
|
95 IMPORT_C TUint8* HeapBase() const; |
|
96 IMPORT_C TInt GetHeapSizes(TInt& aDefaultHeap, TInt& aSmallBmpHeap, TInt& aBigBmpChunk); |
|
97 TInt SessionHandle() const { return Handle(); } |
|
98 TInt AllocScanLineBuffer(TInt aSize); |
|
99 HBufC8* GetScanLineBuffer(); |
|
100 void SetCallBackPtr(TInt* aBitmapHandle)const; |
|
101 HBufC8* GetDecompressionBuffer(TInt aSize); |
|
102 HBufC8* GetExtraBuffer(TInt aSize); |
|
103 TInt ServerSessionHandle() const; |
|
104 public: |
|
105 /** WARNING: For internal use ONLY. Compatibility is not guaranteed in future releases. |
|
106 Used for testing server side out of memory failures. |
|
107 @test |
|
108 */ |
|
109 enum THeapFailType |
|
110 { |
|
111 EHeapFailTypeServerMemory, |
|
112 EHeapFailTypeHeapMemory, |
|
113 }; |
|
114 private: |
|
115 TBool LookupBitmapInROM(const TDesC& aFilename, TAny*& aAddr); |
|
116 RFs& FileServer() { return *((RFs*)iSpare); } |
|
117 static TInt DoAlloc(RFbsSession*& aNewSession); |
|
118 TInt DoConnect(RFs& aFileServer); |
|
119 private: |
|
120 TInt iConnections; |
|
121 mutable TCallBack iCallBack; |
|
122 RChunk iSharedChunk; |
|
123 CFbsSessionHelper* iHelper; |
|
124 RChunk iLargeBitmapChunk; |
|
125 RFs iFileServer; |
|
126 CFbsRalCache* iRomFileAddrCache; |
|
127 HBufC8* iDecompressionBuffer; |
|
128 HBufC8* iScanLineBuffer; |
|
129 TUint32* iSpare; |
|
130 }; |
|
131 |
|
132 /** |
|
133 Font managed by the font and bitmap server. |
|
134 CFbsFont objects are used for screen and off-screen bitmap fonts. They are |
|
135 usually obtained by calls to the CBitmapDevice::GetNearestFontInPixels() and |
|
136 MGraphicsDeviceMap::GetNearestFontInTwips() functions. |
|
137 The class implements a number of functions inherited from CFont. |
|
138 @see CBitmapDevice::GetNearestFontInPixels() |
|
139 @see MGraphicsDeviceMap::GetNearestFontInTwips() |
|
140 @publishedAll |
|
141 @released |
|
142 */ |
|
143 class CFbsFont: public CFont |
|
144 { |
|
145 friend class CFbsTypefaceStore; |
|
146 |
|
147 private: |
|
148 // From CFont |
|
149 /** Gets the font's UID. |
|
150 All CFbsFont objects have the constant UID KCFbsFontUid. It is safe to cast |
|
151 from CFont* to CFbsFont* if CFont::TypeUid() returns KCFbsFontUid. |
|
152 @return The font's UID. This should be KCFbsFontUid. |
|
153 @see CFont::TypeUid() */ |
|
154 virtual TUid DoTypeUid() const { return KCFbsFontUid; } |
|
155 IMPORT_C virtual TInt DoHeightInPixels() const; |
|
156 IMPORT_C virtual TInt DoAscentInPixels() const; |
|
157 IMPORT_C virtual TInt DoCharWidthInPixels(TChar aChar) const; |
|
158 IMPORT_C virtual TInt DoTextWidthInPixels(const TDesC& aText) const; |
|
159 IMPORT_C virtual TInt DoBaselineOffsetInPixels() const; |
|
160 IMPORT_C virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels) const; |
|
161 IMPORT_C virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const; |
|
162 IMPORT_C virtual TInt DoMaxCharWidthInPixels() const; |
|
163 IMPORT_C virtual TInt DoMaxNormalCharWidthInPixels() const; |
|
164 IMPORT_C virtual TFontSpec DoFontSpecInTwips() const; |
|
165 IMPORT_C virtual CFont::TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics, |
|
166 const TUint8*& aBitmap, TSize& aBitmapSize) const; |
|
167 IMPORT_C virtual TInt DoExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const; |
|
168 |
|
169 public: |
|
170 // New functions |
|
171 IMPORT_C TBool GetFontMetrics(TOpenFontMetrics& aMetrics) const; |
|
172 IMPORT_C TInt TextWidthInPixels(const TDesC& aText) const; |
|
173 IMPORT_C void TextWidthInPixels(const TDesC& aText,SCharWidth& aCharWidth) const; |
|
174 IMPORT_C TInt Handle() const; |
|
175 IMPORT_C TCharacterMetrics CharacterMetrics(TInt aCode,const TUint8*& aBytes) const; |
|
176 IMPORT_C TInt RawTextWidthInPixels(const TDesC& aText) const; |
|
177 IMPORT_C TBool GetFaceAttrib(TOpenFontFaceAttrib& aAttrib) const; |
|
178 IMPORT_C TBool IsOpenFont() const; |
|
179 IMPORT_C TBool HasCharacter(TInt aCode) const; |
|
180 IMPORT_C TInt TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const; |
|
181 IMPORT_C void TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam,SCharWidth& aCharWidth) const; |
|
182 |
|
183 |
|
184 protected: |
|
185 IMPORT_C CFbsFont(); |
|
186 IMPORT_C ~CFbsFont(); |
|
187 IMPORT_C CFbsFont(const CFbsFont& aFont); |
|
188 IMPORT_C CBitmapFont* Address() const; |
|
189 IMPORT_C TInt Duplicate(TInt aHandle); |
|
190 IMPORT_C void Reset(); |
|
191 |
|
192 private: |
|
193 TInt DoFontGetShaping(TFontShapeFunctionParameters* aParam) const; |
|
194 TInt DoFontDeleteShaping(TFontShapeDeleteFunctionParameters* aParam) const; |
|
195 TInt DoTextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const; |
|
196 |
|
197 protected: |
|
198 RFbsSession* iFbs; |
|
199 CBitmapFont* iAddressPointer; |
|
200 TInt iHandle; |
|
201 TInt iServerHandle; |
|
202 }; |
|
203 |
|
204 /** |
|
205 An interface for initialization of extended bitmaps. By implementing this interface, |
|
206 creators of extended bitmaps can set the contents of an extended bitmap without |
|
207 allocating a temporary buffer and avoid unnecessary memory copying during calls to |
|
208 CFbsBitmap::CreateExtendedBitmap(). |
|
209 |
|
210 WARNING: Class for internal and partner use ONLY. Compatibility is not guaranteed in future releases. |
|
211 |
|
212 @publishedAll |
|
213 @see CFbsBitmap::CreateExtendedBitmap() |
|
214 */ |
|
215 class MFbsExtendedBitmapInitializer |
|
216 { |
|
217 public: |
|
218 /** |
|
219 Initializes the raw data of an extended bitmap. |
|
220 @param aData A pointer to the raw data to be initialized. |
|
221 @param aDataSize The size in bytes of the raw data to be initialized. |
|
222 @return KErrNone if successful, otherwise another of the system-wide error codes. |
|
223 */ |
|
224 virtual TInt InitExtendedBitmap(TAny* aData, TInt aDataSize) = 0; |
|
225 }; |
|
226 |
|
227 class CDirectFileStore; |
|
228 |
|
229 /** |
|
230 Note that this class is not intended for user derivation. |
|
231 A bitmap managed by the font and bitmap server. |
|
232 The class also defines some palette functionality which is not yet |
|
233 implemented, since none of the modes currently supported by screen |
|
234 or bitmaps require variable palettes. |
|
235 Note that the CFbsBitmap format is internal to Symbian, but the |
|
236 Image Converter API can be used to convert such bitmaps to standard formats. |
|
237 CFbsBitmap instances cannot be shared between different threads. They use some shared |
|
238 thread local storage data. If you want to share a bitmap between threads, use Duplicate(). |
|
239 @publishedAll |
|
240 @released |
|
241 @see CFbsBitmap::Duplicate() |
|
242 */ |
|
243 class CFbsBitmap : public CBase |
|
244 { |
|
245 friend class TBitmapUtil; |
|
246 friend class CBitwiseBitmap; |
|
247 friend class CFbsBitmapAsyncStreamer; |
|
248 friend class CFbsSessionHelper; |
|
249 public: |
|
250 IMPORT_C CFbsBitmap(); |
|
251 IMPORT_C ~CFbsBitmap(); |
|
252 IMPORT_C void Reset(); |
|
253 IMPORT_C static TInt ScanLineLength(TInt aLength,TDisplayMode aDispMode); |
|
254 IMPORT_C TDisplayMode DisplayMode() const; |
|
255 IMPORT_C TDisplayMode InitialDisplayMode() const; |
|
256 IMPORT_C TInt SetDisplayMode(TDisplayMode aDisplayMode); |
|
257 IMPORT_C TInt Create(const TSize& aSizeInPixels,TDisplayMode aDispMode); |
|
258 IMPORT_C TInt Duplicate(TInt aHandle); |
|
259 IMPORT_C TBool IsRomBitmap() const; |
|
260 IMPORT_C void SetRomBitmapL(CBitwiseBitmap* aRomBitmapPointer,TInt& aBitmapSizeInBytes); |
|
261 IMPORT_C TInt Load(const TDesC& aFileName,TInt32 aId=0,TBool aShareIfLoaded=ETrue); |
|
262 IMPORT_C TInt Load(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset); |
|
263 IMPORT_C TInt LoadAndCompress(const TDesC& aFileName,TInt32 aId=0,TBool aShareIfLoaded=ETrue); |
|
264 IMPORT_C TInt LoadAndCompress(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset); |
|
265 IMPORT_C TInt Load(RFile& aFile,TInt32 aId=0,TBool aShareIfLoaded=ETrue); |
|
266 IMPORT_C TInt Load(RFile& aFile,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset); |
|
267 IMPORT_C TInt LoadAndCompress(RFile& aFile,TInt32 aId=0,TBool aShareIfLoaded=ETrue); |
|
268 IMPORT_C TInt LoadAndCompress(RFile& aFile,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset); |
|
269 IMPORT_C TInt Save(const TDesC& aFilename); |
|
270 IMPORT_C TInt Save(RFile& aFile); |
|
271 IMPORT_C static void StoreL(const TDesC& aFilename,TInt aNumSources,const TDesC* aSources[],TInt32 aSourceIds[]); |
|
272 IMPORT_C static void StoreL(RFile& aFile,TInt aNumSources,const TDesC* aSources[],TInt32 aSourceIds[]); |
|
273 IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,TDisplayMode aDispMode) const; |
|
274 IMPORT_C void SetScanLine(TDes8& aBuf,TInt aY) const; |
|
275 IMPORT_C void GetVerticalScanLine(TDes8& aBuf,TInt aX,TDisplayMode aDispMode) const; |
|
276 IMPORT_C void GetVerticalScanLine(TDes8& aBuf,TInt aX,const TPoint& aDitherOffset,TDisplayMode aDispMode) const; |
|
277 IMPORT_C TInt Handle() const; |
|
278 IMPORT_C SEpocBitmapHeader Header() const; |
|
279 IMPORT_C TInt HorizontalPixelsToTwips(TInt aPixels) const; |
|
280 IMPORT_C TInt HorizontalTwipsToPixels(TInt aTwips) const; |
|
281 IMPORT_C void GetPixel(TRgb& aColor,const TPoint& aPixel) const; |
|
282 IMPORT_C TInt Resize(const TSize& aSizeInPixels); |
|
283 IMPORT_C TSize SizeInPixels() const; |
|
284 IMPORT_C TSize SizeInTwips() const; |
|
285 IMPORT_C void SetSizeInTwips(const MGraphicsDeviceMap* aMap); |
|
286 IMPORT_C void SetSizeInTwips(const TSize& aSizeInTwips); |
|
287 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
288 IMPORT_C void ExternalizeRectangleL(RWriteStream& aStream,const TRect& aRect) const; |
|
289 IMPORT_C void InternalizeL(RReadStream& aStream); |
|
290 IMPORT_C TInt Compress(); |
|
291 IMPORT_C TInt Compress(TBitmapfileCompressionScheme aScheme); |
|
292 IMPORT_C void CompressInBackground(TRequestStatus& aRequestStatus); |
|
293 IMPORT_C TInt CompressInBackground(); |
|
294 IMPORT_C void CompressInBackground(TRequestStatus& aRequestStatus, TBitmapfileCompressionScheme aScheme); |
|
295 IMPORT_C TInt CompressInBackground(TBitmapfileCompressionScheme aScheme); |
|
296 IMPORT_C TInt VerticalPixelsToTwips(TInt aPixels) const; |
|
297 IMPORT_C TInt VerticalTwipsToPixels(TInt aTwips) const; |
|
298 IMPORT_C static TBool IsFileInRom(const TDesC& aFilename,TUint32*& aWord); |
|
299 IMPORT_C static TBool IsFileInRom(RFile& aFile,TUint32*& aWord); |
|
300 IMPORT_C TBool IsMonochrome() const; |
|
301 IMPORT_C TBool IsLargeBitmap() const; |
|
302 IMPORT_C void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const; |
|
303 IMPORT_C void SetPalette(CPalette* aPalette); |
|
304 IMPORT_C TInt GetPalette(CPalette*& aPalette) const; |
|
305 IMPORT_C TUint32* DataAddress() const; |
|
306 IMPORT_C TInt DataStride() const; |
|
307 IMPORT_C TInt CreateHardwareBitmap(const TSize& aSizeInPixels,TDisplayMode aDispMode,TUid aCreatorUid); |
|
308 IMPORT_C TInt HardwareBitmapHandle() const; |
|
309 IMPORT_C void BeginDataAccess() const; |
|
310 IMPORT_C void EndDataAccess(TBool aReadOnly=EFalse) const; |
|
311 IMPORT_C void LockHeap(TBool aAlways=EFalse) const; |
|
312 IMPORT_C void UnlockHeap(TBool aAlways=EFalse) const; |
|
313 IMPORT_C void LockHeapLC(TBool aAlways=EFalse) const; |
|
314 IMPORT_C static void UnlockHeap(TAny* aFbsBitmap); |
|
315 IMPORT_C TBool IsVolatile() const; |
|
316 IMPORT_C TInt TouchCount() const; |
|
317 IMPORT_C TInt64 SerialNumber() const; |
|
318 IMPORT_C TBool IsCompressedInRAM() const; |
|
319 IMPORT_C TInt SwapWidthAndHeight(); |
|
320 IMPORT_C TInt CreateExtendedBitmap(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aType, const TAny* aData, TInt aDataSize); |
|
321 IMPORT_C TInt CreateExtendedBitmap(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aType, TInt aDataSize, MFbsExtendedBitmapInitializer& aInitializer); |
|
322 IMPORT_C TUid ExtendedBitmapType() const; |
|
323 IMPORT_C TInt DataSize() const; |
|
324 IMPORT_C static HBufC8* GetDecompressionBuffer(TInt aSize); |
|
325 IMPORT_C static CFbsRasterizer* Rasterizer(); |
|
326 IMPORT_C TInt GetAllBitmapHandles(RArray<TInt>& aBitmapIdArray) const; |
|
327 IMPORT_C static HBufC8* GetExtraBuffer(TInt aSize); |
|
328 protected: |
|
329 IMPORT_C void GetScanLine(TDes8& aBuf,const TPoint& aPixel,TInt aLength,const TPoint& aDitherOffset,TDisplayMode aDispMode) const; |
|
330 CBitwiseBitmap* Address() const; |
|
331 IMPORT_C CBitwiseBitmap* CleanAddress() const; |
|
332 inline CBitwiseBitmap* BeginDataAccessAndGetCleanAddress(TUint32*& aDataAddress) const; |
|
333 void DoSaveL(RFile& aFile); |
|
334 TInt DoCreate(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aUid, TInt aDataSize = 0); |
|
335 private: |
|
336 TInt DoLoad(RFile& aFile,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset); |
|
337 TInt DoLoad(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset); |
|
338 TInt DoLoadFromRom(TUint32* aRomPointer, TInt32 aId, TUint aFileOffset, TBool& aRomPointerValid); |
|
339 TBool LoadShiftedRomBmpL(const TDesC& aFileName,TInt32 aId,TUint aFileOffset); |
|
340 static void DoStoreL(CDirectFileStore* aFileStore,CFbsBitmap* aBitmap,TInt aNumSources,const TDesC* aSources[],TInt32 aSourceIds[]); |
|
341 protected: |
|
342 /** WARNING: For internal use ONLY. Compatibility is not guaranteed in future releases. |
|
343 */ |
|
344 enum // Flags |
|
345 { |
|
346 EIsRomBitmap = 0x0001, |
|
347 EIsExtendedBitmap = 0x0002, |
|
348 EIsReadOnlyBitmapMask = EIsRomBitmap | EIsExtendedBitmap |
|
349 }; |
|
350 protected: |
|
351 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. */ |
|
352 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. */ |
|
353 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. */ |
|
354 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. */ |
|
355 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. */ |
|
356 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. */ |
|
357 }; |
|
358 |
|
359 |
|
360 /** |
|
361 Provides fast read/write access to the pixel data of a bitmap. |
|
362 |
|
363 Functionality includes getting and setting the individual pixels of a bitmap. |
|
364 Common to this is the concept of the current pixel position. This is held |
|
365 as member data and is changed by using various efficient functions. For example, |
|
366 incrementing the position's x- or y co-ordinate is much quicker than setting |
|
367 a completely new position. This efficiency issue is important as these functions |
|
368 are used as part of the frequently used blitting DDA used for creating |
|
369 stretched or compressed versions of bitmaps. |
|
370 |
|
371 Calls to Begin() and End() must surround any calls to the other member functions. |
|
372 Note that you should always ensure each Begin() is matched by an End() call |
|
373 when using this class. |
|
374 |
|
375 Note also that all display modes including EColor16M are supported, but the |
|
376 TDisplayMode values ERgb and ENone are not considered to be display modes. |
|
377 @publishedAll |
|
378 @released |
|
379 */ |
|
380 class TBitmapUtil |
|
381 { |
|
382 public: |
|
383 IMPORT_C void Begin(const TPoint& aPosition); |
|
384 IMPORT_C void Begin(const TPoint& aPosition,const TBitmapUtil& aUtil); |
|
385 IMPORT_C void End(); |
|
386 IMPORT_C TBitmapUtil(CFbsBitmap* aBitmap); |
|
387 IMPORT_C TUint32 GetPixel() const; |
|
388 IMPORT_C void SetPixel(TUint32 aValue); |
|
389 IMPORT_C void SetPixel(const TBitmapUtil& aSource); |
|
390 IMPORT_C void SetPos(const TPoint& aPosition); |
|
391 IMPORT_C void DecXPos(); |
|
392 IMPORT_C void DecYPos(); |
|
393 IMPORT_C void IncXPos(); |
|
394 IMPORT_C void IncYPos(); |
|
395 private: |
|
396 CFbsBitmap* iFbsBitmap; |
|
397 TUint32* iWordPos; |
|
398 TUint32* iMinWordPos; |
|
399 TUint32* iMaxWordPos; |
|
400 TInt iBpp; |
|
401 TInt iPixelShift; |
|
402 TInt iBitShift; |
|
403 TUint32 iMask; |
|
404 TInt iScanlineWordLength; |
|
405 TBool iWritten; |
|
406 }; |
|
407 |
|
408 class TFontInfo; |
|
409 |
|
410 /** |
|
411 Font and bitmap server typeface store. |
|
412 @publishedAll |
|
413 @released |
|
414 */ |
|
415 class CFbsTypefaceStore : public CTypefaceStore |
|
416 { |
|
417 friend class CWsScreenDevice; |
|
418 public: |
|
419 IMPORT_C static CFbsTypefaceStore* NewL(CGraphicsDevice* aDevice); |
|
420 IMPORT_C ~CFbsTypefaceStore(); |
|
421 IMPORT_C TInt AddFile(const TDesC& aName,TInt& aId); |
|
422 IMPORT_C TInt InstallFile(const TDesC& aName,TInt& aId); |
|
423 IMPORT_C void RemoveFile(TInt aId=0); |
|
424 IMPORT_C virtual TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec); |
|
425 IMPORT_C TInt GetNearestFontInPixels(CFont*& aFont, const TFontSpec& aFontSpec); |
|
426 IMPORT_C virtual TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec); |
|
427 IMPORT_C TInt GetNearestFontToDesignHeightInPixels(CFont*& aFont, const TFontSpec& aFontSpec); |
|
428 IMPORT_C virtual TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight); |
|
429 IMPORT_C TInt GetNearestFontToMaxHeightInPixels(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight); |
|
430 IMPORT_C TInt GetFontById(CFont *&aFont,TUid aUid,const TAlgStyle& aAlgStyle); |
|
431 IMPORT_C virtual TInt NumTypefaces() const; |
|
432 IMPORT_C virtual void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const; |
|
433 IMPORT_C virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const; |
|
434 IMPORT_C TInt FontHeightInPixels(TInt aTypefaceIndex,TInt aHeightIndex) const; |
|
435 IMPORT_C TGlyphBitmapType DefaultBitmapType() const; |
|
436 IMPORT_C void SetDefaultBitmapType(TGlyphBitmapType aType) const; |
|
437 IMPORT_C void SetFontNameAliasL(const TDesC& aFontAlias,const TDesC& aFontName) const; |
|
438 IMPORT_C void SetDefaultLanguageForMetrics(TLanguage aLanguage) const; |
|
439 IMPORT_C static void RemoveFontFileLocksL(); |
|
440 IMPORT_C static void RemoveFontFileLocksL(const TDesC& aDrive, TBool aAllFonts); |
|
441 IMPORT_C static void RemoveFontFileLocksL(const TDesC& aFileName); |
|
442 IMPORT_C void ReleaseTwipsCache(); |
|
443 IMPORT_C void SetSystemDefaultTypefaceNameL(const TDesC& aFontTypefaceName); |
|
444 IMPORT_C TInt RegisterLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec, TInt& aId); |
|
445 IMPORT_C void GetLinkedTypefaceL(CLinkedTypefaceSpecification& aLinkedTypefaceSpec); |
|
446 IMPORT_C TInt RegisterLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec); |
|
447 IMPORT_C TInt UpdateLinkedTypeface(const CLinkedTypefaceSpecification& aLinkedTypefaceSpec); |
|
448 private: |
|
449 CFbsTypefaceStore(CGraphicsDevice* aDevice); |
|
450 void ConstructL(); |
|
451 TInt CreateFont(CFont*& aFont,const TFontInfo& aFontInfo); |
|
452 TBool IsFontLoaded(CFont*& aFont, const TFontInfo& aFontInfo) const; |
|
453 TInt FontHeight(TInt aTypefaceIndex,TInt aHeightIndex,TInt aMessage) const; |
|
454 TInt GetNearestFontInTwipsAndCreateFont(CFont*& aFont, TInt aFbsMessage, const TFontSpec& aFontSpec, TInt aMaxHeight = 0); |
|
455 TInt SendGetNearestFontCommandNCreateFont( |
|
456 CFont*& aFont, TInt aFbsMessage, const TFontSpec& aFontSpec, TInt aMaxHeight = 0); |
|
457 void GetPixelSizeInTwips(TSize& aSize) const; |
|
458 |
|
459 private: |
|
460 RFbsSession* iFbs; |
|
461 CGraphicsDevice* iDevice; |
|
462 CFontCache* iTwipsCache; |
|
463 }; |
|
464 |
|
465 class CDitherColor256; |
|
466 |
|
467 /** |
|
468 Copies a bitmap in any display mode of at least 256 colours into a 256 |
|
469 colour bitmap, optionally using a user-defined palette. |
|
470 @publishedAll |
|
471 @released |
|
472 */ |
|
473 class CFbsColor256BitmapUtil : public CBase |
|
474 { |
|
475 public: |
|
476 /** Indicates whether or not to use dithering. */ |
|
477 enum TDither |
|
478 { |
|
479 /** No dithering. */ |
|
480 ENoDither, |
|
481 /** Use the Floyd-Steinberg dithering algorithm. */ |
|
482 EFloydSteinberg |
|
483 }; |
|
484 public: |
|
485 |
|
486 IMPORT_C static CFbsColor256BitmapUtil* NewL(const CPalette* aPalette); |
|
487 |
|
488 IMPORT_C TInt CopyBitmap(CFbsBitmap* aColor256Destination,CFbsBitmap* aSource,TDither aDither=ENoDither); |
|
489 |
|
490 ~CFbsColor256BitmapUtil(); |
|
491 private: |
|
492 CFbsColor256BitmapUtil(); |
|
493 private: |
|
494 TColor256Util* iColor256Util; |
|
495 CDitherColor256* iDither; |
|
496 }; |
|
497 |
|
498 #endif |