1 graphicsaccelerator.h |
1 // Copyright (c) 2001-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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __GRAPHICSACCELERATOR_H__ |
|
17 #define __GRAPHICSACCELERATOR_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <gdi.h> |
|
21 |
|
22 // |
|
23 // Bitmaps |
|
24 // |
|
25 |
|
26 // Forward references |
|
27 class CFbsBitmap; |
|
28 class TAcceleratedBitmapSpec; |
|
29 |
|
30 /** |
|
31 A data structure that holds the information needed to directly access a bitmap. |
|
32 |
|
33 The bitmap can be a hardware bitmap (RHardwareBitmap), or an ordinary bitmap |
|
34 (CFbsBitmap). An object of this class is filled by calling TAcceleratedBitmapSpec::GetInfo(). |
|
35 |
|
36 @see RHardwareBitmap |
|
37 @see CFbsBitmap |
|
38 @see TAcceleratedBitmapSpec::GetInfo() |
|
39 @publishedAll |
|
40 @released |
|
41 */ |
|
42 class TAcceleratedBitmapInfo |
|
43 { |
|
44 public: |
|
45 |
|
46 /** The bitmap's display mode. */ |
|
47 TDisplayMode iDisplayMode; |
|
48 |
|
49 /** The address of the start of the bitmap. */ |
|
50 TUint8* iAddress; |
|
51 |
|
52 /** The width and height of the bitmap in pixels. */ |
|
53 TSize iSize; |
|
54 |
|
55 /** The address offset (in bytes) between successive lines in a bitmap. */ |
|
56 TInt iLinePitch; |
|
57 |
|
58 /** The shift required to obtain the number of bits needed to represent one pixel in the bitmap. |
|
59 The number of bits per pixel is calculated as 1 << iPixelShift */ |
|
60 TInt iPixelShift; |
|
61 |
|
62 /** The physical address of the start of the bitmap. This is the address which a |
|
63 hardware graphics accelerator will use and is zero if the bitmap is not accessible |
|
64 to hardware graphics accelerators. */ |
|
65 TUint8* iPhysicalAddress; |
|
66 }; |
|
67 |
|
68 /** |
|
69 The interface to a hardware bitmap. |
|
70 |
|
71 This is a bitmap that can be drawn to by graphics acceleration hardware. It |
|
72 is stored in a contiguous area of physical memory. |
|
73 |
|
74 After creating the hardware bitmap, it can be passed to CHardwareGraphicsAccelerator::NewL(). |
|
75 |
|
76 @see CHardwareGraphicsAccelerator::NewL() |
|
77 @publishedAll |
|
78 @released |
|
79 */ |
|
80 class RHardwareBitmap |
|
81 { |
|
82 friend class CBitwiseBitmap; |
|
83 friend class CFbsScreenDevice; |
|
84 public: |
|
85 |
|
86 /** Default constructor. */ |
|
87 inline RHardwareBitmap(); |
|
88 |
|
89 /** Constructor taking the handle of an existing RHardwareBitmap to duplicate it. */ |
|
90 inline RHardwareBitmap(TInt aHandle); |
|
91 |
|
92 /** |
|
93 Gets the information needed for accessing a bitmap directly into TAcceleratedBitmapInfo structure. |
|
94 |
|
95 @param aInfo On return, holds the information needed to directly access the bitmap. |
|
96 @return KErrNone if sucessful, otherwise one of the system error codes, including |
|
97 KErrUnknown if the object's type is ENoBitmap. |
|
98 */ |
|
99 IMPORT_C TInt GetInfo(TAcceleratedBitmapInfo& aInfo) const; |
|
100 private: |
|
101 IMPORT_C TInt SetAsScreenReference(TInt aScreen=-1); |
|
102 IMPORT_C TInt Create(TDisplayMode aDisplayMode, TSize aSize, TUid aCreatorUid); |
|
103 IMPORT_C void Destroy(); |
|
104 public: |
|
105 |
|
106 /** The bitmap's handle; assigned during construction. This is used to identify |
|
107 the bitmap. */ |
|
108 TInt iHandle; // Must be only member data |
|
109 }; |
|
110 |
|
111 /** Default constructor. Initialises the handle to zero. */ |
|
112 inline RHardwareBitmap::RHardwareBitmap() |
|
113 : iHandle(0) |
|
114 {} |
|
115 |
|
116 /** Constructor taking the handle of an existing RHardwareBitmap to duplicate. |
|
117 @param aHandle The RHardwareBitmap handle to duplicate. */ |
|
118 inline RHardwareBitmap::RHardwareBitmap(TInt aHandle) |
|
119 : iHandle(aHandle) |
|
120 {} |
|
121 |
|
122 /** |
|
123 Maintains a count of the number of locks made on a bitmap through a TAcceleratedBitmapSpec |
|
124 object. |
|
125 |
|
126 Passed as a parameter to TAcceleratedBitmapSpec::Lock() and TAcceleratedBitmapSpec::Unlock(). |
|
127 |
|
128 @see TAcceleratedBitmapSpec |
|
129 @publishedAll |
|
130 @released |
|
131 */ |
|
132 class TBitmapLockCount |
|
133 { |
|
134 friend class TAcceleratedBitmapSpec; |
|
135 public: |
|
136 |
|
137 /** Default constructor. Initialises the lock count to zero. */ |
|
138 inline TBitmapLockCount() : iCount(0) {} |
|
139 private: |
|
140 inline TInt Inc() { return iCount++; } |
|
141 inline TInt Dec() { return --iCount; } |
|
142 private: |
|
143 TInt iCount; |
|
144 }; |
|
145 |
|
146 |
|
147 /** |
|
148 A utility class that provides access to the contents of a bitmap. |
|
149 |
|
150 The bitmap can be a hardware bitmap (RHardwareBitmap), or an ordinary bitmap |
|
151 (CFbsBitmap). An object of this class is used as a parameter by several accelerated |
|
152 graphics operations, e.g. TGopBitBlt, to specify the source bitmap for the |
|
153 operation. |
|
154 @publishedAll |
|
155 @released |
|
156 */ |
|
157 class TAcceleratedBitmapSpec |
|
158 { |
|
159 public: |
|
160 // Constructors |
|
161 inline TAcceleratedBitmapSpec(); |
|
162 IMPORT_C TAcceleratedBitmapSpec(CFbsBitmap* aBitmap); |
|
163 IMPORT_C TAcceleratedBitmapSpec(RHardwareBitmap aBitmap); |
|
164 // Bitmap access (use with caution, see documentation) |
|
165 |
|
166 IMPORT_C TInt GetInfo(TAcceleratedBitmapInfo& aInfo) const; |
|
167 inline void Lock(TBitmapLockCount& aCount); |
|
168 inline void Lock(TBitmapLockCount& aCount,TAcceleratedBitmapInfo& aInfo); |
|
169 inline void Unlock(TBitmapLockCount& aCount); |
|
170 |
|
171 // enums |
|
172 /** Identifies the type of the bitmap. |
|
173 |
|
174 Type() returns this value. |
|
175 |
|
176 @see CFbsBitmap */ |
|
177 enum TAcceleratedBitmapType |
|
178 { |
|
179 /** The object was created using the default constructor, and has no type. */ |
|
180 ENoBitmap, |
|
181 |
|
182 /** The bitmap is of type CFbsBitmap. |
|
183 |
|
184 @see CFbsBitmap */ |
|
185 EFbsBitmap, |
|
186 |
|
187 /** The bitmap is of type RHardwareBitmap. |
|
188 |
|
189 @see RHardwareBitmap */ |
|
190 EHardwareBitmap, |
|
191 }; |
|
192 enum TAcceleratedBitmapLock |
|
193 { |
|
194 EBitmapIsStatic, |
|
195 EBitmapNeedsLocking, |
|
196 }; |
|
197 // Getters |
|
198 inline TAcceleratedBitmapType Type() const; |
|
199 inline TInt Handle() const; |
|
200 private: |
|
201 IMPORT_C void DoLock(TBitmapLockCount& aCount); |
|
202 IMPORT_C void DoLock(TBitmapLockCount& aCount,TAcceleratedBitmapInfo& aInfo); |
|
203 IMPORT_C void DoUnlock(TBitmapLockCount& aCount); |
|
204 private: |
|
205 TUint8 iType; // TAcceleratedBitmapType |
|
206 TUint8 iLockStatus; // TAcceleratedBitmapLock |
|
207 TUint8 iSpare1; |
|
208 TUint8 iSpare2; |
|
209 TInt iHandle; |
|
210 }; |
|
211 |
|
212 /** Default constructor. |
|
213 Use one of the other constructor overloads instead. */ |
|
214 inline TAcceleratedBitmapSpec::TAcceleratedBitmapSpec() |
|
215 : iType(ENoBitmap), iLockStatus(EBitmapIsStatic) |
|
216 {} |
|
217 |
|
218 /** Prevents a bitmap from moving in memory. Lock() should be called before accessing |
|
219 the bitmap and Unlock() immediately afterwards. Although it is not necessary |
|
220 to lock and unlock some types of bitmap, it is a small overhead, and it is |
|
221 recommended that you always do it. |
|
222 |
|
223 If a bitmap is already locked, all uses of the Lock() and Unlock() methods |
|
224 within the same thread must use the same TBitmapLockCount object, even if |
|
225 Lock() and Unlock() are called by different instances of TAcceleratedBitmapSpec. |
|
226 |
|
227 @param aCount Maintains a count of the number of locks made on the bitmap. */ |
|
228 inline void TAcceleratedBitmapSpec::Lock(TBitmapLockCount& aCount) |
|
229 { if(iLockStatus==EBitmapNeedsLocking) DoLock(aCount); } |
|
230 |
|
231 /** Prevents a bitmap from moving in memory. Lock() should be called before accessing |
|
232 the bitmap and Unlock() immediately afterwards. Although it is not necessary |
|
233 to lock and unlock some types of bitmap, it is a small overhead, and it is |
|
234 recommended that you always do it. Also updates a TAcceleratedBitmapInfo structure |
|
235 with any information that may have changed, (typically the bitmap's memory |
|
236 address). |
|
237 |
|
238 If a bitmap is already locked, all uses of the Lock() and Unlock() methods |
|
239 within the same thread must use the same TBitmapLockCount object, even if |
|
240 Lock() and Unlock() are called by different instances of TAcceleratedBitmapSpec. |
|
241 |
|
242 @param aCount Maintains a count of the number of locks made on the bitmap. |
|
243 @param aInfo On return, contains the new address of the start of the bitmap. */ |
|
244 inline void TAcceleratedBitmapSpec::Lock(TBitmapLockCount& aCount,TAcceleratedBitmapInfo& aInfo) |
|
245 { if(iLockStatus==EBitmapNeedsLocking) DoLock(aCount,aInfo); } |
|
246 |
|
247 /** Frees a bitmap after a call to Lock(). A call to Unlock() must be made for each corresponding |
|
248 call to Lock(). This function should be called as soon as any bitmap access has finished. If, after |
|
249 the Unlock() operation, no more calls to Lock() are outstanding on the bitmap, the bitmap is free to |
|
250 be moved in memory again. |
|
251 |
|
252 If a bitmap is already locked, all uses of the Lock() and Unlock() methods |
|
253 within the same thread must use the same TBitmapLockCount object, even if |
|
254 Lock() and Unlock() are called by different instances of TAcceleratedBitmapSpec. |
|
255 |
|
256 @param aCount Maintains a count of the number of locks made on the bitmap. */ |
|
257 inline void TAcceleratedBitmapSpec::Unlock(TBitmapLockCount& aCount) |
|
258 { if(iLockStatus==EBitmapNeedsLocking) DoUnlock(aCount); } |
|
259 |
|
260 /** Returns the type of the bitmap. The type is assigned during construction. |
|
261 |
|
262 @return The type of bitmap. */ |
|
263 inline TAcceleratedBitmapSpec::TAcceleratedBitmapType TAcceleratedBitmapSpec::Type() const |
|
264 { return (TAcceleratedBitmapSpec::TAcceleratedBitmapType)iType; } |
|
265 |
|
266 /** Returns the handle to the bitmap. |
|
267 |
|
268 @return The handle to the bitmap. */ |
|
269 inline TInt TAcceleratedBitmapSpec::Handle() const |
|
270 { return iHandle; } |
|
271 |
|
272 // |
|
273 // Accelerator capabilities |
|
274 // |
|
275 |
|
276 |
|
277 /** |
|
278 Enumerates the four transparency types. |
|
279 |
|
280 ETransparentPixel and ETransparentColor are used with a pixel value or a TRgb |
|
281 respectively. |
|
282 |
|
283 @see TGopTransparency |
|
284 @see TGraphicsAcceleratorCaps::iTransparency |
|
285 @publishedAll |
|
286 @released |
|
287 */ |
|
288 enum TTransparencyType |
|
289 { |
|
290 |
|
291 /** Any pixel that has all bits equal to zero is treated as transparent. */ |
|
292 ETransparentPixelZero, |
|
293 |
|
294 /** Any pixel that is equal to the pixel value passed to the TGopTransparency constructor |
|
295 is treated as transparent. */ |
|
296 ETransparentPixel, |
|
297 |
|
298 /** Any pixel that is equal to the TRgb value passed to the TGopTransparency constructor |
|
299 is treated as transparent. */ |
|
300 ETransparentColor, |
|
301 |
|
302 /** In 16 bits per pixel display mode, which uses 5 bits each for red, green and |
|
303 blue, the most significant bit is an Alpha value. Alpha=0 means the pixel |
|
304 is transparent, Alpha=1 means the pixel is fully opaque. */ |
|
305 ETransparent1555, |
|
306 }; |
|
307 |
|
308 /** |
|
309 Stores the capabilities of a graphics accelerator. |
|
310 |
|
311 All of the member enums except TMaskBitmapCaps define flags that are stored |
|
312 as public data of type TUint. Only TMaskBitmapCaps takes sequential values, |
|
313 so its values are mutually exclusive. |
|
314 |
|
315 An object of this class is returned by CGraphicsAccelerator::Capabilities() |
|
316 or by GenericCapabilities(), which is implemented by CSoftwareGraphicsAccelerator |
|
317 and CHardwareGraphicsAccelerator. |
|
318 |
|
319 @see CGraphicsAccelerator::Capabilities() |
|
320 @publishedAll |
|
321 @released |
|
322 */ |
|
323 class TGraphicsAcceleratorCaps |
|
324 { |
|
325 public: |
|
326 /** Clipping capabilities. Used by the iClipping member. |
|
327 |
|
328 @see CGraphicsAccelerator::Operation() */ |
|
329 enum TClipCaps // Bit flags |
|
330 { |
|
331 EClipToBitmap = 1, // Will always clip all operations to the bitmap |
|
332 |
|
333 /** The accelerator supports the Operation() methods which take clipping rectangles |
|
334 as parameters. |
|
335 |
|
336 @see CGraphicsAccelerator::Operation() */ |
|
337 EClipping = 2 // Is able to clip operations to a region |
|
338 }; |
|
339 |
|
340 /** Enumerates the capabilities relating to operations taking a bitmap mask parameter, |
|
341 for instance TGopBitBltMasked. These are mutually exclusive values used by |
|
342 the iMaskType member. */ |
|
343 enum TMaskBitmapCaps // Enum |
|
344 { |
|
345 /** No masked operations are supported. */ |
|
346 EMaskBitmapNone = 0, |
|
347 |
|
348 /** The mask bitmap can be in any display mode at all. */ |
|
349 EMaskBitmapAnyDisplayMode, |
|
350 |
|
351 /** The mask bitmap must be in the same display mode as the destination bitmap. */ |
|
352 EMaskBitmapMatchingDisplayMode, |
|
353 |
|
354 /** The mask bitmap must be in EGray2 display mode. */ |
|
355 EMaskBitmapGray2, |
|
356 }; |
|
357 |
|
358 /** Bit flags for the capabilities relating to operations that use an alpha channel |
|
359 (TGopBitBltAlphaChannel and TGopScaledBitBltAlphaChannel). These flags are |
|
360 used by the iAlphaChannel member. */ |
|
361 enum TAlphaChannelCaps //Bit flags |
|
362 { |
|
363 /** The accelerator can draw bitmaps with 4 bits each for the alpha value and the |
|
364 red, green and blue components. */ |
|
365 EAlpha4444 = 1, // Bitmaps with 4 bits for Alpha value and Red, Green, Blue components |
|
366 |
|
367 /** The accelerator can draw bitmaps with 8 bits each for the alpha value and the |
|
368 red, green and blue components. */ |
|
369 EAlpha8888 = 2, // Bitmaps with 8 bits for Alpha value and Red, Green, Blue components |
|
370 |
|
371 /** The accelerator can draw bitmaps with 1 bit for the alpha value and and 5 bits |
|
372 for the red, green and blue components. */ |
|
373 EAlpha1555 = 4, // Bitmaps with 1 bit for Alpha value and 5 bits for Red, Green, and Blue |
|
374 }; |
|
375 |
|
376 /** Bit flags for the capabilities relating to operations which take an alpha bitmap |
|
377 parameter, for instance TGopBitBltAlphaBitmap. These flags are used by the |
|
378 iAlphaBitmap member. */ |
|
379 enum TAlphaBitmapCaps //Bit flags |
|
380 { |
|
381 /** For 256 greyscale bitmaps, the value of each pixel in the alpha bitmap (from |
|
382 0 to 255) is used as the alpha value. */ |
|
383 EAlphaBitmapGray256 = 1, |
|
384 |
|
385 /** An EColor16M bitmap may be used as the alpha bitmap. The red, green and blue |
|
386 values for each pixel in this bitmap are used as the alpha values for the |
|
387 red, green and blue components of the corresponding pixel in the source bitmap. */ |
|
388 EAlphaBitmapColor16M = 2, |
|
389 |
|
390 /** The alpha bitmap must have the same display mode as the source bitmap. */ |
|
391 EAlphaBitmapMatchingMode = 4, // Alpha bitmap must be same mode as source |
|
392 }; |
|
393 |
|
394 /** Indicates whether there is a restriction on the sizes of bitmaps that can be |
|
395 used in bitmap patterns. |
|
396 |
|
397 This is one of the possible values for the iPatternSizes member. |
|
398 |
|
399 @see TGopFillPattern */ |
|
400 enum TPatternSizeCaps //Bit flags |
|
401 { |
|
402 /** There is no restriction on the dimensions of bitmap patterns. */ |
|
403 EPatternSizeAny = 0xFFFFFFFF, |
|
404 }; |
|
405 |
|
406 /** Bit flags for the capabilities relating to operations that draw a fill pattern |
|
407 using a bitmap, for instance TGopFilledRectWithPatern. They are used in the |
|
408 iPattern member. */ |
|
409 enum TPatternCaps //Bit flags |
|
410 { |
|
411 /** The pattern bitmap can be in any display mode. */ |
|
412 EPatternAnyDisplayMode = 1, // Patterns can be in any supported display mode |
|
413 |
|
414 /** The pattern bitmap must be in the same display mode as the destination. */ |
|
415 EPatternMatchingDisplayMode = 2, // Pattern must be in same displ mode as target |
|
416 |
|
417 /** The pattern bitmap must be square (width==height). */ |
|
418 EPatternMustBeSquare = 4, // The pattern must be square (width==height) |
|
419 }; |
|
420 |
|
421 /** Bit flags for how self-crossing polygons are filled. |
|
422 |
|
423 @see CGraphicsContext::TFillRule */ |
|
424 enum TPolygonCaps // Bit flags for fill rules (see CGraphicsContext::TFillRule) |
|
425 { |
|
426 /** Only areas with odd winding numbers are filled. */ |
|
427 EPolygonFillAlternate = 1, |
|
428 |
|
429 /** All areas with a winding number greater than zero are filled. |
|
430 |
|
431 @see CGraphicsContext::TFillRule */ |
|
432 EPolygonFillWinding = 2, |
|
433 }; |
|
434 |
|
435 /** Bit flags for the specifying the supported rendering orientations. |
|
436 @see CFbsBitGc::TGraphicsOrientation */ |
|
437 enum TOrientationCaps |
|
438 { |
|
439 /** Normal orientation is supported. */ |
|
440 EOrientationCapNormal = 1, |
|
441 /** A 90 degree rotation is supported. */ |
|
442 EOrientationCapRotated90 = 2, |
|
443 /** A 180 degree rotation is supported. */ |
|
444 EOrientationCapRotated180 = 4, |
|
445 /** A 270 degree rotation is supported. */ |
|
446 EOrientationCapRotated270 = 8, |
|
447 /** All orientations are supported. */ |
|
448 EOrientationCapAll = EOrientationCapNormal|EOrientationCapRotated90|EOrientationCapRotated180|EOrientationCapRotated270, |
|
449 }; |
|
450 |
|
451 /** The size of this class in bytes. */ |
|
452 TInt iStructureSize; // The size of this class |
|
453 |
|
454 /** The version number of the API. */ |
|
455 TInt iVersion; // == 1 to specify current API |
|
456 |
|
457 /** Optional UID to identify the vendor of the graphics accelerator. This UID can |
|
458 be used to recognise a particular accelerator, enabling code to use any custom |
|
459 graphics operations and capabilities that it knows the accelerator provides. */ |
|
460 TUid iVendorUid; // Optional ID |
|
461 |
|
462 /** A bit mask of the supported display modes for the bitmap passed to the graphics |
|
463 accelerator's NewL(). Uses the least significant 11 bits as flags for each |
|
464 TDisplayMode supported. For instance, to check whether the EColor256 display |
|
465 mode is available, use the expression iDisplayModes & (1 << EColor256). |
|
466 |
|
467 @see TDisplayMode */ |
|
468 TUint iDisplayModes; // One bit for each TDisplayMode enumeration |
|
469 |
|
470 /** Indicates whether the Operation() methods which take clipping rectangles as |
|
471 parameters are supported. |
|
472 |
|
473 @see TClipCaps */ |
|
474 TUint iClipping; // TClipCaps bit flags |
|
475 |
|
476 /** Specifies the display mode restrictions for bitmap masks. These are mutually |
|
477 exclusive values. |
|
478 |
|
479 @see TMaskBitmapCaps */ |
|
480 TMaskBitmapCaps iMaskType; // Mask type used |
|
481 |
|
482 /** Specifies the transparency types supported. Uses a bit flag for each TTransparencyType |
|
483 supported. |
|
484 |
|
485 @see TTransparencyType */ |
|
486 TUint iTransparency; // Bit flag for each TTransparencyType supported |
|
487 |
|
488 /** Specifies the capabilities relating to operations that use an alpha channel. Uses a bit flag for |
|
489 each TAlphaChannelCaps supported. |
|
490 |
|
491 @see TAlphaChannelCaps */ |
|
492 TUint iAlphaChannel; // TAlphaChannelCaps bit flags |
|
493 |
|
494 /** Specifies the supported alpha bitmap types. Uses a bit flag for each TAlphaBitmapCaps |
|
495 supported. |
|
496 |
|
497 @see TAlphaBitmapCaps */ |
|
498 TUint iAlphaBitmap; // TAlphaBitmapCaps bit flags |
|
499 |
|
500 /** Specifies the sizes of bitmaps that can be used in bitmap patterns. |
|
501 |
|
502 This is a bitmask for each power of 2, or EPatternSizeAny. For example, if |
|
503 bitmaps used in patterns can only have a width or height of 16 pixels then |
|
504 this value should be set to 16. If patterns can have dimensions of 16, 32, |
|
505 64, 128 or 256, then this value would equal the sum of these, (i.e. bits 4, |
|
506 5, 6, 7 and 8 would be set). If this value is equal to EPatternSizeAny, there |
|
507 are no restrictions on the size of patterns that can be used. |
|
508 |
|
509 @see TPatternSizeCaps */ |
|
510 TUint iPatternSizes; // a mask bit for each power of 2, or EPatternSizeAny |
|
511 |
|
512 /** Specifies the supported bitmap types for fill patterns. Uses a bit flag for |
|
513 each TPatternCaps supported. |
|
514 |
|
515 @see TPatternCaps */ |
|
516 TUint iPattern; // TPatternCaps bit flags |
|
517 |
|
518 /** Specifies the supported fill rules for self crossing polygons. Uses a bit flag |
|
519 for each TPolygonCaps supported. |
|
520 |
|
521 @see TPolygonCaps */ |
|
522 TUint iPolygon; // TPolygonCaps bit flags |
|
523 |
|
524 /** |
|
525 iReserved[0] specifies the supported rendering orientations.Uses a bit flags |
|
526 for each TOrientationCaps supported. |
|
527 @see TOrientationCaps |
|
528 iReserved[1]-iReserved[3] are reserved for future use. All should be set to zero. |
|
529 */ |
|
530 TUint iReserved[4]; |
|
531 }; |
|
532 |
|
533 |
|
534 // |
|
535 // TGraphicsOperation |
|
536 // |
|
537 |
|
538 /** |
|
539 Abstract base class for all graphics operations. |
|
540 |
|
541 Derived classes encapsulate all the arguments needed by a given graphics operation. |
|
542 An object of one of the derived classes is passed as a parameter to CGraphicsAccelerator::Operation(). |
|
543 The member functions and enum defined in this class are not used directly |
|
544 in third party code. |
|
545 |
|
546 @see CGraphicsAccelerator::Operation() |
|
547 @publishedAll |
|
548 @released |
|
549 */ |
|
550 class TGraphicsOperation |
|
551 { |
|
552 public: |
|
553 enum TGopFunction |
|
554 { // Require arguments commented below here |
|
555 |
|
556 EFilledRect, // (TRect,TRgb) |
|
557 EFilledRectUsingDrawMode, // (TRect,TRgb,CGraphicsContext:TDrawMode) |
|
558 EFilledRectWithPattern, // (TRect,TGopFillPattern) |
|
559 EInvertRect, // (TRect) |
|
560 EFadeRect, // (TRect,TGopFadeParams) |
|
561 |
|
562 EBitBlt, // (TPoint,TAcceleratedBitmapSpec,TRect&) |
|
563 EBitBltMasked, // (TPoint,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aMask) |
|
564 EBitBltTransparent, // (TPoint,TAcceleratedBitmapSpec,TRect&,TGopTransparency) |
|
565 EBitBltAlphaChannel, // (TPoint,TAcceleratedBitmapSpec,TRect&) |
|
566 EBitBltAlphaBitmap, // (TPoint,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aAlpha) |
|
567 |
|
568 EScaledBitBlt, // (TRect,TAcceleratedBitmapSpec,TRect&) |
|
569 EScaledBitBltMasked, // (TRect,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aMask) |
|
570 EScaledBitBltTransparent, // (TRect,TAcceleratedBitmapSpec,TRect&,TGopTransparency) |
|
571 EScaledBitBltAlphaChannel, // (TRect,TAcceleratedBitmapSpec,TRect&) |
|
572 EScaledBitBltAlphaBitmap, // (TRect,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aAlpha) |
|
573 |
|
574 EFilledPolygon, // (TRGb aColor,CGraphicsContext::TFillRule aFillRule,TInt aNumPoints,TPoint[]) |
|
575 EFilledPolygonWithPattern, // (TGopFillPattern,CGraphicsContext::TFillRule aFillRule,TInt aNumPoints,TPoint[]) |
|
576 EAlphaBlendTwoBitmaps, // (TPoint,TAcceleratedBitmapSpec aSrce1,TAcceleratedBitmapSpec aSrce2,TRect&,TAcceleratedBitmapSpec aAlpha) |
|
577 EAlphaBlendOneBitmap, // (TPoint,TAcceleratedBitmapSpec aSrce,TRect&,TAcceleratedBitmapSpec aAlpha) |
|
578 EChunkTest, |
|
579 EVirtualAddressTest, |
|
580 }; |
|
581 public: |
|
582 // Getters |
|
583 inline TGopFunction Function() const { return iFunction; } |
|
584 inline TInt Size() const { return iSize; } |
|
585 // Utility functions |
|
586 inline TGraphicsOperation* Next() const; |
|
587 inline void Append(TInt aNumBytes,TAny* aData); |
|
588 protected: |
|
589 inline TGraphicsOperation(TGopFunction aFunction, TInt aArgSize); |
|
590 inline TGraphicsOperation() {} |
|
591 protected: |
|
592 TGopFunction iFunction; |
|
593 TInt iSize; // Total size of derived class |
|
594 }; |
|
595 |
|
596 inline TGraphicsOperation::TGraphicsOperation(TGopFunction aFunction, TInt aSize) |
|
597 : iFunction(aFunction) , iSize(aSize) {} |
|
598 |
|
599 inline TGraphicsOperation* TGraphicsOperation::Next() const |
|
600 { return (TGraphicsOperation*)((TUint8*)this+iSize); } |
|
601 |
|
602 inline void TGraphicsOperation::Append(TInt aNumBytes,TAny* aData) |
|
603 { |
|
604 Mem::Copy(Next(),aData,aNumBytes); |
|
605 iSize += aNumBytes; |
|
606 } |
|
607 |
|
608 |
|
609 // |
|
610 // Graphics accelerator |
|
611 // |
|
612 |
|
613 /** |
|
614 Abstract base class for 2D graphics accelerators. |
|
615 |
|
616 This class can be derived from to provide accelerated implementations of some |
|
617 common 2D graphics algorithms. Support for accelerated 2D graphics has been |
|
618 integrated into existing classes in the Graphics API for instance CFbsBitGc, |
|
619 so that existing code does not need to be altered, but a graphics accelerator |
|
620 can be used directly by applications. The accelerated 2D graphics operations |
|
621 may be implemented in software, hardware, or both. |
|
622 @publishedAll |
|
623 @released |
|
624 */ |
|
625 class CGraphicsAccelerator : public CBase |
|
626 { |
|
627 public: |
|
628 // Return the capabilities of this accelerator |
|
629 |
|
630 /** Returns the capabilities of the graphics accelerator. |
|
631 |
|
632 @return The capabilities of the accelerator. */ |
|
633 virtual const TGraphicsAcceleratorCaps* Capabilities() = 0; |
|
634 |
|
635 // Perform a graphics operation |
|
636 |
|
637 /** Requests the graphics accelerator to perform a single graphics operation. |
|
638 |
|
639 @param aOperation An instance of a TGraphicsOperation-derived class that identifies |
|
640 the graphics operation to be performed. |
|
641 @return KErrNone if successful, otherwise one of the system error codes. The |
|
642 function should return KErrNotSupported if the accelerator does not support |
|
643 the requested operation. */ |
|
644 virtual TInt Operation(const TGraphicsOperation& aOperation) = 0; |
|
645 |
|
646 /** Requests the graphics accelerator perform a single graphics operation within |
|
647 a clipping region. This version is of Operation() is only usable if the |
|
648 accelerator capabilities returned by Capabilities() indicate that clipping to a region |
|
649 is supported. |
|
650 |
|
651 @param aOperation An instance of a TGraphicsOperation-derived class that identifies |
|
652 the graphics operation to be performed. |
|
653 @param aNumClipRects The number of rectangles in the clipping region. |
|
654 @param aClipRects A pointer to the first rectangle in the clipping region. |
|
655 @return KErrNone if successful, otherwise one of the system error codes. The |
|
656 function should return KErrNotSupported if the accelerator does not support |
|
657 the requested operation. |
|
658 @see TGraphicsAcceleratorCaps::iClipping */ |
|
659 virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects) = 0; |
|
660 |
|
661 // Process a buffer of TGraphicsOperation. (Each operation immediately follows the |
|
662 // one preceding it in the buffer) |
|
663 |
|
664 /** Requests the graphics accelerator perform one or more graphics operations contained |
|
665 in a buffer. |
|
666 |
|
667 The underlying implementation may be able to process a group of graphics operations |
|
668 more efficiently than if Operation() was called for each individually. |
|
669 |
|
670 This function should be implemented as if Operation() was called in turn for |
|
671 each operation contained in the buffer. Each operation should be carried out |
|
672 immediately after the one preceding it. If a method returns an error, the |
|
673 length of aBuffer should be set to indicate the number of operations that |
|
674 have been successfully processed. In this case, the operation in which the |
|
675 error occurred will be indicated by the memory address &aBuffer[aBuffer.Length()]. |
|
676 |
|
677 @param aBuffer A descriptor which holds a concatenation of graphics operations |
|
678 (TGraphicsOperation-derived objects). |
|
679 @return KErrNone if successful, otherwise one of the system error codes. The |
|
680 function should return KErrNotSupported if the accelerator does not support |
|
681 any of the requested operations. */ |
|
682 virtual TInt Operation(TDes8& aBuffer) = 0; |
|
683 |
|
684 /** Requests the graphics accelerator perform one or more graphics operations within |
|
685 a clipping region. This version is of Operation() is only usable if the |
|
686 accelerator capabilities returned by Capabilities() indicate that clipping to a region |
|
687 is supported. |
|
688 |
|
689 The underlying implementation may be able to process a group of graphics operations |
|
690 more efficiently than if Operation() was called for each individually. |
|
691 |
|
692 This function should be implemented as if Operation() was called in turn for |
|
693 each operation contained in the buffer. Each operation should be carried out |
|
694 immediately after the one preceding it. If a method returns an error, the |
|
695 length of aBuffer should be set to indicate the number of operations that |
|
696 have been successfully processed. In this case, the operation in which the |
|
697 error occurred will be indicated by the memory address &aBuffer[aBuffer.Length()]. |
|
698 |
|
699 @param aBuffer A descriptor which holds a concatenation of graphics operations |
|
700 (TGraphicsOperation objects). |
|
701 @param aNumClipRects The number of rectangles in the clipping region. |
|
702 @param aClipRects A pointer to the first rectangle in the clipping region. |
|
703 @return KErrNone if successful, otherwise one of the system error codes. The |
|
704 function should return KErrNotSupported if the accelerator does not support |
|
705 any of the requested operations. |
|
706 @see TGraphicsAcceleratorCaps::iClipping */ |
|
707 virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects) = 0; |
|
708 public: |
|
709 // Reserved virtual functions for future use |
|
710 virtual void Reserved_1() = 0; |
|
711 virtual void Reserved_2() = 0; |
|
712 virtual void Reserved_3() = 0; |
|
713 virtual void Reserved_4() = 0; |
|
714 }; |
|
715 |
|
716 |
|
717 |
|
718 /** |
|
719 A factory for creating 2D graphics accelerator objects whose graphics operations |
|
720 are implemented in software. |
|
721 |
|
722 Objects of derived classes can write to all types of bitmap, not just hardware |
|
723 bitmaps. Note that graphics accelerators may support only a subset of all |
|
724 graphics operations. |
|
725 @publishedAll |
|
726 @released |
|
727 */ |
|
728 class CSoftwareGraphicsAccelerator : public CGraphicsAccelerator |
|
729 { |
|
730 public: |
|
731 // Create a new CSoftwareGraphicsAccelerator for use with a given bitmap |
|
732 IMPORT_C static CSoftwareGraphicsAccelerator* NewL(CFbsBitmap* aBitmap); |
|
733 |
|
734 // Get the non-bitmap-specific capabilities of the hardware accelerator. |
|
735 IMPORT_C static const TGraphicsAcceleratorCaps* GenericCapabilities(); |
|
736 public: |
|
737 // From CGraphicsAccelerator |
|
738 virtual const TGraphicsAcceleratorCaps* Capabilities() = 0; |
|
739 virtual TInt Operation(const TGraphicsOperation& aOperation) = 0; |
|
740 virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects) = 0; |
|
741 virtual TInt Operation(TDes8& aBuffer) = 0; |
|
742 virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects) = 0; |
|
743 // From CGraphicsAccelerator |
|
744 virtual void Reserved_1() = 0; |
|
745 virtual void Reserved_2() = 0; |
|
746 virtual void Reserved_3() = 0; |
|
747 virtual void Reserved_4() = 0; |
|
748 }; |
|
749 |
|
750 |
|
751 /** |
|
752 A factory for creating 2D graphics accelerator objects whose graphics operations |
|
753 are implemented in hardware, software or a mixture of both. |
|
754 |
|
755 Objects of derived classes can only write to hardware bitmaps (RHardwareBitmap). |
|
756 Note that graphics accelerators may support only a subset of all graphics |
|
757 operations. |
|
758 |
|
759 @see RHardwareBitmap |
|
760 @publishedAll |
|
761 @released |
|
762 */ |
|
763 class CHardwareGraphicsAccelerator : public CGraphicsAccelerator |
|
764 { |
|
765 public: |
|
766 /** |
|
767 Create a new CHardwareGraphicsAccelerator for use with a given hardware bitmap. |
|
768 |
|
769 Do not use, link against scdv.lib. |
|
770 |
|
771 @param aBitmap A bitmap that can be drawn by graphics acceleration hardware. |
|
772 It can be any bitmap. |
|
773 @return Reference to hardware graphics accelerator object. |
|
774 */ |
|
775 IMPORT_C static CHardwareGraphicsAccelerator* NewL(RHardwareBitmap aBitmap); |
|
776 |
|
777 /** |
|
778 Gets the generic capabilities of the accelerator, including the supported display modes |
|
779 for the bitmap passed to NewL(). |
|
780 |
|
781 Do not use, link against scdv.lib. |
|
782 |
|
783 @return Generic capabilities for software graphics accelerators. |
|
784 */ |
|
785 IMPORT_C static const TGraphicsAcceleratorCaps* GenericCapabilities(); |
|
786 public: |
|
787 // From CGraphicsAccelerator |
|
788 virtual const TGraphicsAcceleratorCaps* Capabilities() = 0; |
|
789 virtual TInt Operation(const TGraphicsOperation& aOperation) = 0; |
|
790 virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects) = 0; |
|
791 virtual TInt Operation(TDes8& aBuffer) = 0; |
|
792 virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects) = 0; |
|
793 // From CGraphicsAccelerator |
|
794 virtual void Reserved_1() = 0; |
|
795 virtual void Reserved_2() = 0; |
|
796 virtual void Reserved_3() = 0; |
|
797 virtual void Reserved_4() = 0; |
|
798 }; |
|
799 |
|
800 // |
|
801 // Classes used as arguments to graphics operations |
|
802 // |
|
803 |
|
804 /** |
|
805 A pattern represented by a bitmap that is used by a graphics accelerator to |
|
806 fill a rectangle or polygon. |
|
807 |
|
808 An object of this class is specified when constructing a TGopFilledRectWithPattern |
|
809 or TGopFilledPolygonWithPattern. The types and sizes of fill pattern bitmaps |
|
810 supported by the accelerator are given by TGraphicsAcceleratorCaps::iPattern |
|
811 and TGraphicsAcceleratorCaps::iPatternSizes respectively. |
|
812 |
|
813 @see TGopFilledRectWithPattern |
|
814 @see TGopFilledPolygonWithPattern |
|
815 @see TGraphicsAcceleratorCaps::iPatternSizes |
|
816 @see TGraphicsAcceleratorCaps::iPattern |
|
817 @publishedAll |
|
818 @released |
|
819 */ |
|
820 class TGopFillPattern |
|
821 { |
|
822 public: |
|
823 |
|
824 /** Provides a handle to the bitmap, and other information needed to draw it. */ |
|
825 TAcceleratedBitmapSpec iBitmap; |
|
826 |
|
827 /** The origin of the pattern. This is the position at which to draw the pixel at |
|
828 the top left hand corner of the bitmap around which copies of the bitmap are |
|
829 "tiled" to form the pattern. It is relative to the top left hand corner of |
|
830 the rectangle being filled, so specify 0,0 if you want the bitmaps drawn flush |
|
831 with the top and left hand sides of the rectangle. */ |
|
832 TPoint iOrigin; |
|
833 }; |
|
834 |
|
835 /** |
|
836 Specifies the amount of fading for all the pixels in a rectangular area. |
|
837 |
|
838 Fading changes colours so that they are closer to white or closer to black. |
|
839 To make colours whiter, increase iOffset; to use a smaller range of colours, |
|
840 reduce iScale. Fading uses the following formula (where C is a red, green |
|
841 or blue value in a TRgb): |
|
842 |
|
843 colour component C = ( ( iScale * C ) / 256 )+iOffset; |
|
844 |
|
845 For example: |
|
846 - to fade to white, specify iScale=128, iOffset=128 |
|
847 - to fade to black, specify iScale=128, iOffset=0 |
|
848 - for no change, specify iScale=256, iOffset=0 |
|
849 |
|
850 An object of this class is specified when constructing a TGopFadeRect. |
|
851 |
|
852 @see TGopFadeRect |
|
853 @publishedAll |
|
854 @released |
|
855 */ |
|
856 class TGopFadeParams // color component C = ( ( iScale * C ) >> 8 )+iOffset; |
|
857 { |
|
858 public: |
|
859 |
|
860 /** Specifies the degree of fading, maximum=256. */ |
|
861 TInt iScale; |
|
862 |
|
863 /** The fading offset. Specifies whether to fade to black or to white. */ |
|
864 TInt iOffset; |
|
865 }; |
|
866 |
|
867 /** |
|
868 Specifies which pixels should be treated as transparent in a bitblt operation |
|
869 that supports transparency. |
|
870 |
|
871 This is used by the TGopBitBltTransparent and TGopScaledBitBltTransparent |
|
872 graphics operations. |
|
873 |
|
874 For the possible transparency types, see the TTransparencyType enumeration. |
|
875 |
|
876 An object of this class is specified when constructing a TGopBitBltTransparent or |
|
877 TGopScaledBitBltTransparent. |
|
878 |
|
879 @see TTransparencyType |
|
880 @see TGopBitBltTransparent |
|
881 @see TGopScaledBitBltTransparent |
|
882 @publishedAll |
|
883 @released |
|
884 */ |
|
885 class TGopTransparency |
|
886 { |
|
887 public: |
|
888 |
|
889 /** Constructor with a transparency type. iParam is initialised to zero. |
|
890 |
|
891 @param aType The transparency type. */ |
|
892 inline TGopTransparency(TTransparencyType aType) : iType(aType), iParam(0) {} |
|
893 |
|
894 /** Constructor with a pixel value. The type is initialised to ETransparentPixel. |
|
895 Any pixel that has a value equal to aPixelValue is treated as transparent. |
|
896 aPixelValue is the bit pattern of the pixel as stored in the bitmap. |
|
897 |
|
898 @param aPixelValue The pixel value. */ |
|
899 inline TGopTransparency(TInt aPixelValue) : iType(ETransparentPixel), iParam(aPixelValue) {} |
|
900 |
|
901 /** Constructor with a TRgb value. The type is initialised to ETransparentColor. |
|
902 Any pixel that has a color of aRgb is treated as transparent. |
|
903 |
|
904 @param aRgb The TRgb value. */ |
|
905 inline TGopTransparency(TRgb aRgb) : iType(ETransparentColor), iParam(aRgb.Value()) {} |
|
906 |
|
907 /** Gets the colour that is treated as transparent. This is the value of iParam |
|
908 as a TRgb. |
|
909 |
|
910 @return The colour that is treated as transparent. */ |
|
911 inline TRgb Color() const { return TRgb(iParam); } |
|
912 |
|
913 /** Gets the value of the colour as a TInt that is treated as transparent. This |
|
914 is the value of iParam. |
|
915 |
|
916 @return The colour that is treated as transparent. This is the bit pattern |
|
917 of the colour as stored in the bitmap. */ |
|
918 inline TInt Pixel() const { return iParam; } |
|
919 public: |
|
920 |
|
921 /** The transparency type. */ |
|
922 TTransparencyType iType; |
|
923 |
|
924 /** Holds the value of the colour/pixel that is treated as transparent. */ |
|
925 TUint32 iParam; |
|
926 }; |
|
927 |
|
928 |
|
929 // |
|
930 // Wrapper classes for graphics operation arguments |
|
931 // |
|
932 |
|
933 #ifdef __WINS__ |
|
934 #pragma warning(disable : 4355) // Disable warning - 'this' : used in base member initializer list |
|
935 #endif |
|
936 |
|
937 /** |
|
938 An accelerated graphics operation that fills a rectangular area with a colour. |
|
939 |
|
940 The data members are all initialised on construction. Objects of this class |
|
941 can be passed to a graphics accelerator's Operation() function either individually, |
|
942 or in a buffer. |
|
943 @publishedAll |
|
944 @released |
|
945 */ |
|
946 class TGopFilledRect : public TGraphicsOperation |
|
947 { |
|
948 public: |
|
949 /** Constructor with a rectangle and a colour. |
|
950 @param aRect The rectangle to fill. |
|
951 @param aColor The fill colour. */ |
|
952 inline TGopFilledRect(const TRect& aRect,TRgb aColor) |
|
953 : TGraphicsOperation(EFilledRect,sizeof(*this)), iRect(aRect) , iColor(aColor) {} |
|
954 public: |
|
955 |
|
956 /** The rectangle to fill. */ |
|
957 TRect iRect; |
|
958 |
|
959 /** The fill colour. */ |
|
960 TRgb iColor; |
|
961 }; |
|
962 |
|
963 /** |
|
964 An accelerated graphics operation that fills a rectangular area with a colour, |
|
965 whilst performing a bitwise logical operation with the pixels in the region, |
|
966 for instance AND, OR, Exclusive OR. |
|
967 |
|
968 The bitwise logical operation is specified in the draw mode. The data members |
|
969 are all initialised on construction. Objects of this class can be passed to |
|
970 a graphics accelerator's Operation() function either individually, or in a |
|
971 buffer. |
|
972 @publishedAll |
|
973 @released |
|
974 */ |
|
975 class TGopFilledRectUsingDrawMode : public TGraphicsOperation |
|
976 { |
|
977 public: |
|
978 /** Constructor with a rectangle, a colour and a draw mode. |
|
979 @param aRect The rectangle to fill. |
|
980 @param aColor The fill colour. |
|
981 @param aDrawMode The draw mode. */ |
|
982 inline TGopFilledRectUsingDrawMode(const TRect& aRect,TRgb aColor,CGraphicsContext::TDrawMode aDrawMode) |
|
983 : TGraphicsOperation(EFilledRectUsingDrawMode,sizeof(*this)), iRect(aRect) , iColor(aColor) , iDrawMode(aDrawMode) {} |
|
984 public: |
|
985 |
|
986 /** The rectangle to fill. */ |
|
987 TRect iRect; |
|
988 |
|
989 /** The fill colour. */ |
|
990 TRgb iColor; |
|
991 |
|
992 /** The draw mode. */ |
|
993 CGraphicsContext::TDrawMode iDrawMode; |
|
994 }; |
|
995 |
|
996 /** |
|
997 An accelerated graphics operation that fills a rectangular area with a pattern. |
|
998 |
|
999 The pattern consists of multiple copies of a bitmap, drawn tiled around an |
|
1000 origin. Objects of this class can be passed to a graphics accelerator's Operation() |
|
1001 function either individually, or in a buffer. |
|
1002 |
|
1003 @see TGopFillPattern |
|
1004 @publishedAll |
|
1005 @released |
|
1006 */ |
|
1007 class TGopFilledRectWithPattern : public TGraphicsOperation |
|
1008 { |
|
1009 public: |
|
1010 /** Constructor with a rectangle and a pattern. |
|
1011 @param aRect The rectangle to fill. |
|
1012 @param aPattern Specifies the handle to the bitmap to use for the pattern, |
|
1013 and the origin for the pattern. */ |
|
1014 inline TGopFilledRectWithPattern(const TRect& aRect,TGopFillPattern aPattern) |
|
1015 : TGraphicsOperation(EFilledRectWithPattern,sizeof(*this)), iRect(aRect) , iPattern(aPattern) {} |
|
1016 public: |
|
1017 |
|
1018 /** The rectangle to fill. */ |
|
1019 TRect iRect; |
|
1020 |
|
1021 /** Specifies the handle to the bitmap to use for the pattern and the origin for |
|
1022 the pattern. */ |
|
1023 TGopFillPattern iPattern; |
|
1024 }; |
|
1025 |
|
1026 /** |
|
1027 An accelerated graphics operation that inverts the colour of all pixels in |
|
1028 a rectangular area. |
|
1029 |
|
1030 Objects of this class can be passed to a graphics accelerator's Operation() |
|
1031 function either individually, or in a buffer. |
|
1032 @publishedAll |
|
1033 @released |
|
1034 */ |
|
1035 class TGopInvertRect : public TGraphicsOperation |
|
1036 { |
|
1037 public: |
|
1038 /** Constructor with a rectangle. |
|
1039 @param aRect The rectangle in which to invert the colours. */ |
|
1040 inline TGopInvertRect(const TRect& aRect) |
|
1041 : TGraphicsOperation(EInvertRect,sizeof(*this)), iRect(aRect) {} |
|
1042 public: |
|
1043 |
|
1044 /** The rectangle in which to invert the colours. */ |
|
1045 TRect iRect; |
|
1046 }; |
|
1047 |
|
1048 /** |
|
1049 An accelerated graphics operation that fades the pixels in a rectangular area. |
|
1050 |
|
1051 Objects of this class can be passed to a graphics accelerator's Operation() |
|
1052 function either individually, or in a buffer. |
|
1053 @publishedAll |
|
1054 @released |
|
1055 */ |
|
1056 class TGopFadeRect : public TGraphicsOperation |
|
1057 { |
|
1058 public: |
|
1059 /** Constructor with a rectangle and fade parameters. |
|
1060 @param aRect The rectangle to fade. |
|
1061 @param aFade The fade parameters. */ |
|
1062 inline TGopFadeRect(const TRect& aRect, const TGopFadeParams aFade) |
|
1063 : TGraphicsOperation(EFadeRect,sizeof(*this)), iRect(aRect), iFade(aFade) {} |
|
1064 public: |
|
1065 |
|
1066 /** The rectangle to fade. */ |
|
1067 TRect iRect; |
|
1068 |
|
1069 /** The fade parameters. */ |
|
1070 TGopFadeParams iFade; |
|
1071 }; |
|
1072 |
|
1073 /** |
|
1074 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1075 into another. |
|
1076 |
|
1077 The data members are all initialised on construction. Objects of this class |
|
1078 can be passed to a graphics accelerator's Operation() function either individually, |
|
1079 or in a buffer. |
|
1080 @publishedAll |
|
1081 @released |
|
1082 */ |
|
1083 class TGopBitBlt : public TGraphicsOperation |
|
1084 { |
|
1085 public: |
|
1086 /** Constructor with a position, a source bitmap handle and a rectangle. |
|
1087 @param aDestination The destination for the top left hand corner of the portion |
|
1088 of the source bitmap. |
|
1089 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1090 to draw it. |
|
1091 @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative |
|
1092 to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */ |
|
1093 inline TGopBitBlt(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect) |
|
1094 : TGraphicsOperation(EBitBlt,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {} |
|
1095 public: |
|
1096 |
|
1097 /** The destination for the top left hand corner of the portion of the source bitmap. */ |
|
1098 TPoint iDestination; |
|
1099 |
|
1100 /** A handle to the source bitmap, and other information needed to draw it. */ |
|
1101 TAcceleratedBitmapSpec iSourceBitmap; |
|
1102 |
|
1103 /** A rectangle defining all or a part of the bitmap to be copied. */ |
|
1104 TRect iSourceRect; |
|
1105 }; |
|
1106 |
|
1107 /** |
|
1108 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1109 into another, using a third bitmap as a mask. |
|
1110 |
|
1111 The mask must be the same size as the source bitmap. The parts of the source |
|
1112 bitmap that are drawn are the areas that are black in the mask. |
|
1113 |
|
1114 The data members are all initialised on construction. Objects of this class |
|
1115 can be passed to a graphics accelerator's Operation() function either individually, |
|
1116 or in a buffer. |
|
1117 |
|
1118 @see TGraphicsAcceleratorCaps::iMaskType |
|
1119 @publishedAll |
|
1120 @released |
|
1121 */ |
|
1122 class TGopBitBltMasked : public TGraphicsOperation |
|
1123 { |
|
1124 public: |
|
1125 /** Constructor with a position, a source bitmap handle, a rectangle and a mask bitmap handle. |
|
1126 @param aDestination The destination for the top left hand corner of the portion |
|
1127 of the source bitmap. |
|
1128 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1129 to draw it. |
|
1130 @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative |
|
1131 to the top left of the bitmap. Defines the part of the source bitmap to be copied. |
|
1132 @param aMask A handle to the mask bitmap. The parts of the source bitmap |
|
1133 that are drawn are the areas that are black in the mask bitmap. */ |
|
1134 inline TGopBitBltMasked(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aMask) |
|
1135 : TGraphicsOperation(EBitBltMasked,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iMask(aMask) {} |
|
1136 public: |
|
1137 |
|
1138 /** The destination for the top left hand corner of the portion of the bitmap. */ |
|
1139 TPoint iDestination; |
|
1140 |
|
1141 /** A handle to the source bitmap, and other information needed to draw it. */ |
|
1142 TAcceleratedBitmapSpec iSourceBitmap; |
|
1143 |
|
1144 /** A rectangle defining all or a part of the bitmap to be copied. */ |
|
1145 TRect iSourceRect; |
|
1146 |
|
1147 /** A handle to the source bitmap mask. */ |
|
1148 TAcceleratedBitmapSpec iMask; |
|
1149 }; |
|
1150 |
|
1151 /** |
|
1152 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1153 into another, with some transparent pixels in the bitmap. |
|
1154 |
|
1155 The data members are all initialised on construction. Objects of this class |
|
1156 can be passed to a graphics accelerator's Operation() function either individually, |
|
1157 or in a buffer. |
|
1158 |
|
1159 @see TGraphicsAcceleratorCaps::iTransparency |
|
1160 @see TGopTransparency |
|
1161 @publishedAll |
|
1162 @released |
|
1163 */ |
|
1164 class TGopBitBltTransparent : public TGraphicsOperation |
|
1165 { |
|
1166 public: |
|
1167 /** Constructor with a destination, a handle to the source bitmap, a rectangle |
|
1168 and a specification for which pixels should be treated as transparent. |
|
1169 |
|
1170 @param aDestination The destination for the top left hand corner of the portion |
|
1171 of the source bitmap. |
|
1172 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1173 to draw it. |
|
1174 @param aSourceRect A rectangle within the source bitmap. Its coordinates are |
|
1175 relative to the top left of the bitmap. Defines the part of the source bitmap to |
|
1176 be copied. |
|
1177 @param aTransparency A specification for which pixels in the source bitmap should |
|
1178 be treated as transparent. */ |
|
1179 inline TGopBitBltTransparent(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TGopTransparency aTransparency) |
|
1180 : TGraphicsOperation(EBitBltTransparent,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iTransparency(aTransparency) {} |
|
1181 public: |
|
1182 |
|
1183 /** The destination for the top left hand corner of the portion of the bitmap. */ |
|
1184 TPoint iDestination; |
|
1185 |
|
1186 /** A handle to the source bitmap, and other information needed to draw it. */ |
|
1187 TAcceleratedBitmapSpec iSourceBitmap; |
|
1188 |
|
1189 /** A rectangle defining all or a part of the bitmap to be copied. */ |
|
1190 TRect iSourceRect; |
|
1191 |
|
1192 /** A specification for which pixels should be treated as transparent. */ |
|
1193 TGopTransparency iTransparency; |
|
1194 }; |
|
1195 |
|
1196 /** |
|
1197 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1198 into another, using alpha blending. |
|
1199 |
|
1200 The alpha value is part of each pixel in the source bitmap. For instance, |
|
1201 a 32 bits per pixel bitmap may have 8 bits for each of the alpha, red, green |
|
1202 and blue values. |
|
1203 |
|
1204 Supported bitmap formats with an alpha-channel are given in by |
|
1205 TGraphicsAcceleratorCaps::iAlphaChannel. |
|
1206 |
|
1207 The data members are all initialised on construction. Objects of this class |
|
1208 can be passed to a graphics accelerator's Operation() function either individually, |
|
1209 or in a buffer. |
|
1210 |
|
1211 @see TGraphicsAcceleratorCaps::iAlphaChannel |
|
1212 @publishedAll |
|
1213 @released |
|
1214 */ |
|
1215 class TGopBitBltAlphaChannel : public TGraphicsOperation |
|
1216 { |
|
1217 public: |
|
1218 /** Constructor with a position, a bitmap handle and a rectangle. |
|
1219 @param aDestination The destination for the top left hand corner of the portion |
|
1220 of the source bitmap. |
|
1221 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1222 to draw it. |
|
1223 @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative |
|
1224 to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */ |
|
1225 inline TGopBitBltAlphaChannel(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect) |
|
1226 : TGraphicsOperation(EBitBltAlphaChannel,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {} |
|
1227 public: |
|
1228 |
|
1229 /** The destination for the top left hand corner of the portion of the bitmap. */ |
|
1230 TPoint iDestination; |
|
1231 |
|
1232 /** A handle to the source bitmap, and other information needed to access it. */ |
|
1233 TAcceleratedBitmapSpec iSourceBitmap; |
|
1234 |
|
1235 /** A rectangle defining all or a part of the bitmap to be copied. */ |
|
1236 TRect iSourceRect; |
|
1237 }; |
|
1238 |
|
1239 /** |
|
1240 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1241 into another using alpha blending values provided in a third bitmap. |
|
1242 |
|
1243 The way alpha blending works is as follows: if the alpha value is the maximum, |
|
1244 the source pixel is opaque, in other words, the full colour of the pixel is |
|
1245 written to the destination. If the alpha value is zero, the source pixel is |
|
1246 fully transparent, and the destination is left unaltered. Values in-between |
|
1247 cause blending with the following formula: |
|
1248 |
|
1249 Destination = Source*Alpha/max_Alpha + Destination*(max_Alpha-Alpha)/max_Alpha |
|
1250 |
|
1251 Colour alpha-bitmaps specify red, green and blue alpha values for each pixel, |
|
1252 greyscale bitmaps specify a single alpha value for each pixel. The maximum |
|
1253 alpha value depends on the bitmap's display mode. For example, 255 is the |
|
1254 maximum for an EGray256 or EColor16M bitmap. The maximum is less for bitmaps |
|
1255 which use fewer bits per colour component. |
|
1256 |
|
1257 Supported bitmap formats than can be used as alpha bitmaps are given in |
|
1258 TGraphicsAcceleratorCaps::iAlphaBitmap. |
|
1259 |
|
1260 Objects of this class can be passed to a graphics accelerator's Operation() |
|
1261 function either individually, or in a buffer. |
|
1262 |
|
1263 @see TGraphicsAcceleratorCaps::iAlphaBitmap |
|
1264 @publishedAll |
|
1265 @released |
|
1266 */ |
|
1267 class TGopBitBltAlphaBitmap : public TGraphicsOperation |
|
1268 { |
|
1269 public: |
|
1270 /** Constructor with a position, two bitmap specs and a rectangle. |
|
1271 @param aDestination The destination for the top left hand corner of the portion |
|
1272 of the source bitmap. |
|
1273 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1274 to draw it. |
|
1275 @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative |
|
1276 to the top left of the source bitmap. Defines the part of the source bitmap to be copied. |
|
1277 @param aAlphaBitmap A handle to the alpha bitmap, the bitmap that contains |
|
1278 alpha blending values. */ |
|
1279 inline TGopBitBltAlphaBitmap(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aAlphaBitmap) |
|
1280 : TGraphicsOperation(EBitBltAlphaBitmap,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iAlphaBitmap(aAlphaBitmap) {} |
|
1281 public: |
|
1282 |
|
1283 /** The destination for the top left hand corner of the portion of the source bitmap. */ |
|
1284 TPoint iDestination; |
|
1285 |
|
1286 /** A handle to the source bitmap, and other information needed to access it. */ |
|
1287 TAcceleratedBitmapSpec iSourceBitmap; |
|
1288 |
|
1289 /** A rectangle defining the part of the source bitmap to be copied. */ |
|
1290 TRect iSourceRect; |
|
1291 |
|
1292 /** A handle to the alpha bitmap, the bitmap that contains alpha blending values. */ |
|
1293 TAcceleratedBitmapSpec iAlphaBitmap; |
|
1294 }; |
|
1295 |
|
1296 /** |
|
1297 An accelerated graphics operation that copies a rectangular region of two bitmaps |
|
1298 to a destination, using alpha blending values provided in a third bitmap to blend the |
|
1299 corresponding entries in the first and second bitmaps. |
|
1300 |
|
1301 The way alpha blending works is as follows: if the alpha value is the maximum, |
|
1302 the pixel from the first source is opaque, in other words, the full colour of |
|
1303 the pixel is written to the destination. If the alpha value is zero, the pixel |
|
1304 from the first source is fully transparent, in other words, the full colour of |
|
1305 the pixel in the second source is used. Values in-between cause blending with |
|
1306 the following formula: |
|
1307 |
|
1308 Destination = Source1*Alpha/max_Alpha + Source2*(max_Alpha-Alpha)/max_Alpha |
|
1309 |
|
1310 Colour alpha bitmaps specify red, green and blue alpha values for each pixel, |
|
1311 greyscale bitmaps specify a single alpha value for each pixel. The maximum |
|
1312 alpha value depends on the bitmap's display mode. For example, 255 is the |
|
1313 maximum for an EGray256 or EColor16M bitmap. The maximum is less for bitmaps |
|
1314 which use fewer bits per colour component. |
|
1315 |
|
1316 Supported bitmap formats than can be used as alpha bitmaps are given in |
|
1317 TGraphicsAcceleratorCaps::iAlphaBitmap. |
|
1318 |
|
1319 Objects of this class can be passed to a graphics accelerator's Operation() |
|
1320 function either individually, or in a buffer. |
|
1321 |
|
1322 @see TGraphicsAcceleratorCaps::iAlphaBitmap |
|
1323 @publishedAll |
|
1324 @released |
|
1325 */ |
|
1326 class TGopAlphaBlendTwoBitmaps : public TGraphicsOperation |
|
1327 { |
|
1328 public: |
|
1329 /** |
|
1330 Constructor with a position, three bitmap specs and a rectangle. |
|
1331 @param aDestination The destination for the top left hand corner of the portion |
|
1332 of the source bitmaps. |
|
1333 @param aSourceBmp1 A handle to the first of the source bitmaps, and other information |
|
1334 needed to draw it. |
|
1335 @param aSourceBmp2 A handle to the second of the source bitmaps, and other information |
|
1336 needed to draw it. |
|
1337 @param aSourceRect A rectangle within the source bitmaps. Its coordinates are relative |
|
1338 to the top left of the bitmap. Defines the part of the bitmap to be copied. |
|
1339 @param aSourcePt2 The point in the second source bitmap from which we take pixels to blend |
|
1340 @param aAlphaBitmap A handle to the alpha bitmap, the bitmap that contains |
|
1341 alpha blending values. |
|
1342 @param aAlphaPt The point in the alpha bitmap from which we take pixels to blend |
|
1343 */ |
|
1344 inline TGopAlphaBlendTwoBitmaps(const TPoint& aDestination,TAcceleratedBitmapSpec aSourceBmp1,TAcceleratedBitmapSpec aSourceBmp2,TRect& aSourceRect,const TPoint& aSrcPt2,TAcceleratedBitmapSpec aAlphaBmp, const TPoint& aAlphaPt) |
|
1345 : TGraphicsOperation(EAlphaBlendTwoBitmaps,sizeof(*this)), iDestination(aDestination), iSourceBmp1(aSourceBmp1), iSourceBmp2(aSourceBmp2), iSourceRect(aSourceRect), iSrcPt2(aSrcPt2), iAlphaBmp(aAlphaBmp), iAlphaPt(aAlphaPt) {} |
|
1346 public: |
|
1347 |
|
1348 /** The destination for the top left hand corner of the portion of the source bitmaps. */ |
|
1349 TPoint iDestination; |
|
1350 |
|
1351 /** A handle to the first source bitmap, and other information needed to access it. */ |
|
1352 TAcceleratedBitmapSpec iSourceBmp1; |
|
1353 |
|
1354 /** A handle to the second source bitmap, and other information needed to access it. */ |
|
1355 TAcceleratedBitmapSpec iSourceBmp2; |
|
1356 |
|
1357 /** A rectangle defining the part of the source bitmaps to be copied. */ |
|
1358 TRect iSourceRect; |
|
1359 |
|
1360 /** The point in the second source bitmap from which we take pixels to blend. */ |
|
1361 TPoint iSrcPt2; |
|
1362 |
|
1363 /** A handle to the alpha bitmap, the bitmap that contains alpha blending values. */ |
|
1364 TAcceleratedBitmapSpec iAlphaBmp; |
|
1365 |
|
1366 /** The point in the alpha bitmap from which we take pixels to blend. */ |
|
1367 TPoint iAlphaPt; |
|
1368 }; |
|
1369 |
|
1370 /** |
|
1371 An accelerated graphics operation that copies a rectangular region of a bitmap blended |
|
1372 with the screen image to the screen, using alpha blending values provided in an alpha bitmap |
|
1373 to blend the corresponding entries in the bitmap and on the screen. |
|
1374 |
|
1375 The way alpha blending works is as follows: if the alpha value is the maximum, |
|
1376 the pixel from the source bitmap is opaque, in other words, the full colour of |
|
1377 the pixel is written to the destination. If the alpha value is zero, the pixel |
|
1378 from the source bitmap is fully transparent, in other words, the full colour of |
|
1379 the pixel on the screen is used. Values in-between cause blending with the |
|
1380 following formula: |
|
1381 |
|
1382 Destination = Source*Alpha/max_Alpha + Screen*(max_Alpha-Alpha)/max_Alpha |
|
1383 |
|
1384 Colour alpha bitmaps specify red, green and blue alpha values for each pixel, |
|
1385 greyscale bitmaps specify a single alpha value for each pixel. The maximum |
|
1386 alpha value depends on the bitmap's display mode. For example, 255 is the |
|
1387 maximum for an EGray256 or EColor16M bitmap. The maximum is less for bitmaps |
|
1388 which use fewer bits per colour component. |
|
1389 |
|
1390 Supported bitmap formats than can be used as alpha bitmaps are given in |
|
1391 TGraphicsAcceleratorCaps::iAlphaBitmap. |
|
1392 |
|
1393 Objects of this class can be passed to a graphics accelerator's Operation() |
|
1394 function either individually, or in a buffer. |
|
1395 |
|
1396 @see TGraphicsAcceleratorCaps::iAlphaBitmap |
|
1397 @publishedAll |
|
1398 @released |
|
1399 */ |
|
1400 class TGopAlphaBlendOneBitmap : public TGraphicsOperation |
|
1401 { |
|
1402 public: |
|
1403 /** |
|
1404 Constructor with a position, two bitmap specs and a rectangle. |
|
1405 @param aDestination The destination for the top left hand corner of the portion |
|
1406 of the source bitmap. |
|
1407 @param aSourceBmp A handle to the source bitmap, and other information needed |
|
1408 to draw it. |
|
1409 @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative |
|
1410 to the top left of the source bitmap. Defines the part of the source bitmap to be copied. |
|
1411 @param aAlphaBitmap A handle to the alpha bitmap, the bitmap that contains |
|
1412 alpha blending values. |
|
1413 @param aAlphaPt The point in the alpha bitmap from which we take pixels to blend |
|
1414 */ |
|
1415 |
|
1416 |
|
1417 inline TGopAlphaBlendOneBitmap(const TPoint& aDestination,TAcceleratedBitmapSpec aSourceBmp,TRect& aSourceRect,TAcceleratedBitmapSpec aAlphaBmp, const TPoint& aAlphaPt) |
|
1418 : TGraphicsOperation(EAlphaBlendOneBitmap,sizeof(*this)), iDestination(aDestination), iSourceBmp(aSourceBmp), iSourceRect(aSourceRect), iAlphaBmp(aAlphaBmp), iAlphaPt(aAlphaPt) {} |
|
1419 public: |
|
1420 |
|
1421 /** The destination for the top left hand corner of the portion of the source bitmap. */ |
|
1422 TPoint iDestination; |
|
1423 |
|
1424 /** A handle to the source bitmap, and other information needed to access it. */ |
|
1425 TAcceleratedBitmapSpec iSourceBmp; |
|
1426 |
|
1427 /** A rectangle defining the part of the bitmap to be copied. */ |
|
1428 TRect iSourceRect; |
|
1429 |
|
1430 /** A handle to the alpha bitmap, the bitmap that contains alpha blending values. */ |
|
1431 TAcceleratedBitmapSpec iAlphaBmp; |
|
1432 |
|
1433 /** Position of the first pixel in the alpha bitmap to be used for alpha blending. */ |
|
1434 TPoint iAlphaPt; |
|
1435 }; |
|
1436 |
|
1437 /** |
|
1438 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1439 into a different sized region of another. |
|
1440 |
|
1441 The data members are all initialised on construction. Objects of this class |
|
1442 can be passed to a graphics accelerator's Operation() function either individually, |
|
1443 or in a buffer. |
|
1444 @publishedAll |
|
1445 @released |
|
1446 */ |
|
1447 class TGopScaledBitBlt : public TGraphicsOperation |
|
1448 { |
|
1449 public: |
|
1450 /** Constructor with a destination rectangle, a handle to the source bitmap and |
|
1451 a source rectangle. |
|
1452 @param aDestination The destination for the portion of the source bitmap. If necessary, |
|
1453 the source bitmap portion is resized to fit into this rectangle. |
|
1454 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1455 to draw it. |
|
1456 @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative |
|
1457 to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */ |
|
1458 inline TGopScaledBitBlt(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect) |
|
1459 : TGraphicsOperation(EScaledBitBlt,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {} |
|
1460 public: |
|
1461 |
|
1462 /** The destination rectangle for the portion of the source bitmap. */ |
|
1463 TRect iDestination; |
|
1464 |
|
1465 /** A handle to the source bitmap. */ |
|
1466 TAcceleratedBitmapSpec iSourceBitmap; |
|
1467 |
|
1468 /** A rectangle defining all or a part of the source bitmap to be copied. */ |
|
1469 TRect iSourceRect; |
|
1470 }; |
|
1471 |
|
1472 /** |
|
1473 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1474 into a different sized region of another, using a third bitmap as a mask. |
|
1475 |
|
1476 The mask must be the same size as the source bitmap. The parts of the source |
|
1477 bitmap that are drawn are the areas that are black in the mask. |
|
1478 |
|
1479 The data members are all initialised on construction. Objects of this class |
|
1480 can be passed to a graphics accelerator's Operation() function either individually, |
|
1481 or in a buffer. |
|
1482 |
|
1483 @see TGraphicsAcceleratorCaps::iMaskType |
|
1484 @publishedAll |
|
1485 @released |
|
1486 */ |
|
1487 class TGopScaledBitBltMasked : public TGraphicsOperation |
|
1488 { |
|
1489 public: |
|
1490 /** Constructor with a source and destination rectangle, and handles to the source |
|
1491 and mask bitmaps. |
|
1492 |
|
1493 @param aDestination The destination for the portion of the source bitmap. If necessary, |
|
1494 the source bitmap portion is resized to fit into this rectangle. |
|
1495 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1496 to draw it. |
|
1497 @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative |
|
1498 to the top left of the source bitmap. Defines the part of the source bitmap to be copied. |
|
1499 @param aMask A handle to the mask bitmap. */ |
|
1500 inline TGopScaledBitBltMasked(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aMask) |
|
1501 : TGraphicsOperation(EScaledBitBltMasked,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iMask(aMask) {} |
|
1502 public: |
|
1503 |
|
1504 /** The destination rectangle for the portion of the bitmap. */ |
|
1505 TRect iDestination; |
|
1506 |
|
1507 /** A handle to the source bitmap. */ |
|
1508 TAcceleratedBitmapSpec iSourceBitmap; |
|
1509 |
|
1510 /** A rectangle defining all or a part of the source bitmap to be copied. */ |
|
1511 TRect iSourceRect; |
|
1512 |
|
1513 /** A handle to the source bitmap mask. */ |
|
1514 TAcceleratedBitmapSpec iMask; |
|
1515 }; |
|
1516 |
|
1517 /** |
|
1518 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1519 into a different sized region of another, with some transparent pixels in |
|
1520 the source bitmap. |
|
1521 |
|
1522 The data members are all initialised on construction. Objects of this class |
|
1523 can be passed to a graphics accelerator's Operation() function either individually, |
|
1524 or in a buffer. |
|
1525 |
|
1526 @see TGraphicsAcceleratorCaps::iTransparency |
|
1527 @see TGopTransparency |
|
1528 @publishedAll |
|
1529 @released |
|
1530 */ |
|
1531 class TGopScaledBitBltTransparent : public TGraphicsOperation |
|
1532 { |
|
1533 public: |
|
1534 /** Constructor with destination and source rectangles, a handle to the source |
|
1535 bitmap and a specification for which pixels should be treated as transparent. |
|
1536 |
|
1537 @param aDestination The destination for the portion of the source bitmap. If necessary, |
|
1538 the source bitmap portion is resized to fit into this rectangle. |
|
1539 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1540 to draw it. |
|
1541 @param aSourceRect A rectangle within the source bitmap. Its coordinates are |
|
1542 relative to the top left of the source bitmap. Defines the part of the source bitmap to |
|
1543 be copied. |
|
1544 @param aTransparency A specification for which pixels in the source bitmap should be treated as |
|
1545 transparent. */ |
|
1546 inline TGopScaledBitBltTransparent(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TGopTransparency aTransparency) |
|
1547 : TGraphicsOperation(EScaledBitBltTransparent,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iTransparency(aTransparency) {} |
|
1548 public: |
|
1549 |
|
1550 /** The destination rectangle for the portion of the source bitmap. */ |
|
1551 TRect iDestination; |
|
1552 |
|
1553 /** A handle to the source bitmap. */ |
|
1554 TAcceleratedBitmapSpec iSourceBitmap; |
|
1555 |
|
1556 /** A rectangle defining all or a part of the source bitmap to be copied. */ |
|
1557 TRect iSourceRect; |
|
1558 |
|
1559 /** A specification for which pixels in the source bitmap should be treated as transparent. */ |
|
1560 TGopTransparency iTransparency; |
|
1561 }; |
|
1562 |
|
1563 /** |
|
1564 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1565 into a different sized region of another using alpha blending. The alpha value |
|
1566 is part of each pixel in the source bitmap. |
|
1567 |
|
1568 Supported bitmap formats with an alpha-channel are given in by |
|
1569 TGraphicsAcceleratorCaps::iAlphaChannel. |
|
1570 |
|
1571 The data members are all initialised on construction. Objects of this class |
|
1572 can be passed to a graphics accelerator's Operation() function either individually, |
|
1573 or in a buffer. |
|
1574 |
|
1575 @see TGraphicsAcceleratorCaps::iAlphaChannel |
|
1576 @publishedAll |
|
1577 @released |
|
1578 */ |
|
1579 class TGopScaledBitBltAlphaChannel : public TGraphicsOperation |
|
1580 { |
|
1581 public: |
|
1582 /** Constructor with a destination rectangle, a handle to the source bitmap and |
|
1583 a source rectangle. |
|
1584 |
|
1585 @param aDestination The destination for the portion of the source bitmap. If necessary, |
|
1586 the source bitmap portion is resized to fit into this rectangle. |
|
1587 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1588 to draw it. |
|
1589 @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative |
|
1590 to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */ |
|
1591 inline TGopScaledBitBltAlphaChannel(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect) |
|
1592 : TGraphicsOperation(EScaledBitBltAlphaChannel,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {} |
|
1593 public: |
|
1594 |
|
1595 /** The destination for the portion of the source bitmap. */ |
|
1596 TRect iDestination; |
|
1597 |
|
1598 /** A handle to the source bitmap, and other information needed to draw it. */ |
|
1599 TAcceleratedBitmapSpec iSourceBitmap; |
|
1600 |
|
1601 /** A rectangle defining the part of the source bitmap to be copied. */ |
|
1602 TRect iSourceRect; |
|
1603 }; |
|
1604 |
|
1605 /** |
|
1606 An accelerated graphics operation that copies a rectangular region of one bitmap |
|
1607 into a different sized region of another using alpha blending values provided |
|
1608 in a third bitmap. |
|
1609 |
|
1610 The data members are all initialised on construction. Objects of this class |
|
1611 can be passed to a graphics accelerator's Operation() function either individually, |
|
1612 or in a buffer. |
|
1613 |
|
1614 @see TGraphicsAcceleratorCaps::iAlphaBitmap |
|
1615 @publishedAll |
|
1616 @released |
|
1617 */ |
|
1618 class TGopScaledBitBltAlphaBitmap : public TGraphicsOperation |
|
1619 { |
|
1620 public: |
|
1621 /** Constructor with a source and destination rectangle and two bitmap handles. |
|
1622 |
|
1623 @param aDestination The destination for the portion of the source bitmap. If necessary, |
|
1624 the source bitmap portion is resized to fit into this rectangle. |
|
1625 @param aSourceBitmap A handle to the source bitmap, and other information needed |
|
1626 to draw it. |
|
1627 @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative |
|
1628 to the top left of the source bitmap. Defines the part of the source bitmap to be copied. |
|
1629 @param aAlphaBitmap A handle to the bitmap that contains alpha blending values. */ |
|
1630 inline TGopScaledBitBltAlphaBitmap(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aAlphaBitmap) |
|
1631 : TGraphicsOperation(EScaledBitBltAlphaBitmap,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iAlphaBitmap(aAlphaBitmap) {} |
|
1632 public: |
|
1633 |
|
1634 /** The destination for the portion of the bitmap. */ |
|
1635 TRect iDestination; |
|
1636 |
|
1637 /** A handle to the source bitmap, and other information needed to draw it. */ |
|
1638 TAcceleratedBitmapSpec iSourceBitmap; |
|
1639 |
|
1640 /** A rectangle defining the part of the source bitmap to be copied. */ |
|
1641 TRect iSourceRect; |
|
1642 |
|
1643 /** A handle to the bitmap that contains alpha blending values. */ |
|
1644 TAcceleratedBitmapSpec iAlphaBitmap; |
|
1645 }; |
|
1646 |
|
1647 /** |
|
1648 An accelerated graphics operation that fills a polygon with a colour. |
|
1649 |
|
1650 AddPoints() must be called to specify the polygon to be filled. Objects of |
|
1651 this class can be passed to a graphics accelerator's Operation() function |
|
1652 either individually, or in a buffer. |
|
1653 |
|
1654 How a graphics accelerator can fill polygons is given by TGraphicsAcceleratorCaps::iPolygon. |
|
1655 |
|
1656 @see TGraphicsAcceleratorCaps::iPolygon |
|
1657 @publishedAll |
|
1658 @released |
|
1659 */ |
|
1660 class TGopFilledPolygon : public TGraphicsOperation |
|
1661 { |
|
1662 public: |
|
1663 /** Constructor with a fill rule and a fill colour. The number of points is initialised |
|
1664 to zero. |
|
1665 |
|
1666 @param aColor The fill colour. |
|
1667 @param aFillRule Bit flags for how self-crossing polygons are filled. */ |
|
1668 inline TGopFilledPolygon(TRgb aColor, CGraphicsContext::TFillRule aFillRule) |
|
1669 : TGraphicsOperation(EFilledPolygon,sizeof(*this)), iColor(aColor), iFillRule(aFillRule), iNumPoints(0) {} |
|
1670 inline void AddPoints(TInt aNumPoints, TPoint* aPoints); |
|
1671 public: |
|
1672 |
|
1673 /** The fill colour. */ |
|
1674 TRgb iColor; |
|
1675 |
|
1676 /** Bit flags for how self-crossing polygons are filled. |
|
1677 |
|
1678 @see CGraphicsContext::TFillRule */ |
|
1679 CGraphicsContext::TFillRule iFillRule; |
|
1680 |
|
1681 /** The number of points in the polygon. */ |
|
1682 TInt iNumPoints; |
|
1683 }; |
|
1684 |
|
1685 /** Specifies the polygon to be filled as a number of 2D point coordinates. |
|
1686 |
|
1687 AddPoints() should only be called once the TGopFilledPolygon object has been stored |
|
1688 into a buffer. There must be enough room in the buffer after the TGopFilledPolygon |
|
1689 object to hold aNumPoints TPoint sized structures. This is because the points are |
|
1690 copied into the memory space directly following the TGopFilledPolygon object. |
|
1691 |
|
1692 @param aNumPoints The number of points in the polygon. |
|
1693 @param aPoints Pointer to the first point in the polygon. */ |
|
1694 inline void TGopFilledPolygon::AddPoints(TInt aNumPoints, TPoint* aPoints) |
|
1695 { Append(aNumPoints*sizeof(TPoint),aPoints); iNumPoints += aNumPoints; } |
|
1696 |
|
1697 /** |
|
1698 An accelerated graphics operation that fills a polygon with a pattern held |
|
1699 in another bitmap. |
|
1700 |
|
1701 AddPoints() must be called to specify the polygon to be filled. Objects of |
|
1702 this class can be passed to a graphics accelerator's Operation() function |
|
1703 either individually, or in a buffer. |
|
1704 |
|
1705 @see TGraphicsAcceleratorCaps::iPolygon |
|
1706 @see TGopFillPattern |
|
1707 @publishedAll |
|
1708 @released |
|
1709 */ |
|
1710 class TGopFilledPolygonWithPattern : public TGraphicsOperation |
|
1711 { |
|
1712 public: |
|
1713 /** Constructor with a fill pattern and a fill rule. The number of points is initialised |
|
1714 to zero. |
|
1715 |
|
1716 @param aPattern The fill pattern. |
|
1717 @param aFillRule Bit flags for how self-crossing polygons are filled. */ |
|
1718 inline TGopFilledPolygonWithPattern(TGopFillPattern aPattern, CGraphicsContext::TFillRule aFillRule) |
|
1719 : TGraphicsOperation(EFilledPolygonWithPattern,sizeof(*this)), iPattern(aPattern), iFillRule(aFillRule), iNumPoints(0) {} |
|
1720 inline void AddPoints(TInt aNumPoints, TPoint* aPoints); |
|
1721 public: |
|
1722 |
|
1723 /** The pattern of bitmaps that is used to fill the polygon. */ |
|
1724 TGopFillPattern iPattern; |
|
1725 |
|
1726 /** Bit flags for how self-crossing polygons are filled. |
|
1727 |
|
1728 @see CGraphicsContext::TFillRule */ |
|
1729 CGraphicsContext::TFillRule iFillRule; |
|
1730 |
|
1731 /** The number of points in the polygon. */ |
|
1732 TInt iNumPoints; |
|
1733 }; |
|
1734 |
|
1735 /** Specifies the polygon to be filled as a number of 2D point coordinates. |
|
1736 |
|
1737 AddPoints() should only be called once the TGopFilledPolygonWithPattern object has been stored |
|
1738 into a buffer. There must be enough room in the buffer after the TGopFilledPolygonWithPattern |
|
1739 object to hold aNumPoints TPoint sized structures. This is because the points are |
|
1740 copied into the memory space directly following the TGopFilledPolygonWithPattern object. |
|
1741 |
|
1742 @param aNumPoints The number of points in the polygon. |
|
1743 @param aPoints Pointer to the first point in the polygon. */ |
|
1744 inline void TGopFilledPolygonWithPattern::AddPoints(TInt aNumPoints, TPoint* aPoints) |
|
1745 { Append(aNumPoints*sizeof(TPoint),aPoints); iNumPoints += aNumPoints; } |
|
1746 |
|
1747 |
|
1748 |
|
1749 #endif |