|
1 /* |
|
2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef FBSLCDGRAPHICS_H |
|
19 #define FBSLCDGRAPHICS_H |
|
20 |
|
21 #include <e32std.h> |
|
22 #include <gdi.h> |
|
23 #include <lcdgdrv.h> |
|
24 |
|
25 /** |
|
26 * Structure containing sufficient information to construct |
|
27 * a transform for the DrawRegion primitive. |
|
28 */ |
|
29 struct TDrawRegion |
|
30 { |
|
31 TRect iSrcRect; |
|
32 TPoint iDstPoint; |
|
33 TInt iAnchor; |
|
34 TInt iTransform; |
|
35 }; |
|
36 |
|
37 /** |
|
38 * Utility function to compute the destination rectangle given a source rectangle, an identifier for the |
|
39 * anchor point to translate to the destination point and a transform to apply to the source rectangle. |
|
40 */ |
|
41 TRect CalcDstRect(const TPoint& aDstPoint, const TSize& aSrcSize, TTransformType aSrcTransform, TAnchor aSrcAnchor); |
|
42 |
|
43 // |
|
44 // FBSERV bitmap support, may be withdrawn later. |
|
45 // |
|
46 #define _LCDGDRV_FBSBITMAP_SUPPORT_ |
|
47 |
|
48 #ifdef _LCDGDRV_FBSBITMAP_SUPPORT_ |
|
49 |
|
50 class CFbsBitmap; |
|
51 |
|
52 NONSHARABLE_CLASS(TFbsLcdGraphics) |
|
53 { |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Copy region of image represented by <aSrcColorBitmap, aSrcAlphaBitmap> pair |
|
58 * onto destination image represented by <aDstColorBitmap, aDstAlphaBitmap> pair. |
|
59 * The region to be drawn, the destination position and the transformation to |
|
60 * apply are supplied by aDrawRegion. |
|
61 */ |
|
62 static TInt CopyRegion |
|
63 ( |
|
64 CLcdGraphicsDriver& aDriver, |
|
65 CFbsBitmap* aDstColorBitmap, |
|
66 CFbsBitmap* aDstAlphaBitmap, |
|
67 TTransparency aDstTransparency, |
|
68 CFbsBitmap* aSrcColorBitmap, |
|
69 CFbsBitmap* aSrcAlphaBitmap, |
|
70 TTransparency aSrcTransparency, |
|
71 const TDrawRegion& aRegion, |
|
72 const TRect& aClipRect |
|
73 ); |
|
74 |
|
75 /** |
|
76 * Copies ARGB8888 pixels into image represented by <aDstColorBitmap, aDstAlphaBitmap> |
|
77 */ |
|
78 static TInt SetPixels |
|
79 ( |
|
80 CLcdGraphicsDriver& aDriver, |
|
81 CFbsBitmap* aDstColorBitmap, |
|
82 CFbsBitmap* aDstAlphaBitmap, |
|
83 TTransparency aDstTransparency, |
|
84 const TRect& aDstRect, |
|
85 const TUint32* aSrcARGB32Pixels, |
|
86 TInt aSrcLength, |
|
87 TInt aSrcOffset, |
|
88 TInt aSrcLinePitch, |
|
89 const TSize& aSrcSize, |
|
90 TBool aAlpha |
|
91 ); |
|
92 |
|
93 /** |
|
94 * Copies pixels from image represented by <aDstColorBitmap, aDstAlphaBitmap> |
|
95 * into an array in ARGB8888 format. |
|
96 */ |
|
97 static TInt GetPixels |
|
98 ( |
|
99 CLcdGraphicsDriver& aDriver, |
|
100 CFbsBitmap* aSrcColorBitmap, |
|
101 CFbsBitmap* aSrcAlphaBitmap, |
|
102 TTransparency aSrcTransparency, |
|
103 const TRect& aSrcRect, |
|
104 TUint32* aARGB32Pixels, |
|
105 TInt aLength, |
|
106 TInt aOffset, |
|
107 TInt aLinePitch, |
|
108 const TSize& aSize |
|
109 ); |
|
110 |
|
111 /** |
|
112 Check for pixel level collision in area of overlap in two images. |
|
113 Locks bitmap. |
|
114 @param aMask1 image1 mask |
|
115 @param aTransparency1 image1 transparency type |
|
116 @param aSize1 image1 size |
|
117 @param aRect1 image1 collison rect in image1 co-ordinates |
|
118 @param aTransform1 image1 transform |
|
119 @param aPoint1 position of image1 collison rect in painter's co-ordinates. |
|
120 |
|
121 @param aMask2 image2 mask |
|
122 @param aTransparency1 image2 transparency type |
|
123 @param aSize2 image2 size |
|
124 @param aRect2 image2 collison rect in image2 co-ordinates |
|
125 @param aTransform2 image2 transform |
|
126 @param aPoint2 position of image2 collison rect in painter's co-ordinates. |
|
127 */ |
|
128 static TBool DetectCollision |
|
129 ( |
|
130 CLcdGraphicsDriver& aDriver, |
|
131 |
|
132 CFbsBitmap* aMask1, |
|
133 TTransparency aTransparency1, |
|
134 const TSize& aSize1, |
|
135 const TRect& aRect1, |
|
136 TInt aTransform1, |
|
137 const TPoint& aPoint1, |
|
138 |
|
139 CFbsBitmap* aMask2, |
|
140 TTransparency aTransparency2, |
|
141 const TSize& aSize2, |
|
142 const TRect& aRect2, |
|
143 TInt aTransform2, |
|
144 const TPoint& aPoint2 |
|
145 ); |
|
146 }; |
|
147 |
|
148 #endif |
|
149 |
|
150 #endif // FBSLCDGRAPHICS_H |