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