|
1 // Copyright (c) 2008-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 TESTSCREENCAPTURE_H_ |
|
17 #define TESTSCREENCAPTURE_H_ |
|
18 |
|
19 struct TWsScsComposeScreenCommand |
|
20 { |
|
21 struct TrivialPoint |
|
22 { |
|
23 /** |
|
24 The x co-ordinate. |
|
25 */ |
|
26 TInt iX; |
|
27 /** |
|
28 The y co-ordinate. |
|
29 */ |
|
30 TInt iY; |
|
31 }; |
|
32 struct TrivialRect |
|
33 { |
|
34 /** |
|
35 The x and y co-ordinates of the top left hand corner of the rectangle. |
|
36 */ |
|
37 TrivialPoint iTl; |
|
38 |
|
39 /** |
|
40 The x and y co-ordinates of the bottom right hand corner of the rectangle. |
|
41 */ |
|
42 TrivialPoint iBr; |
|
43 }; |
|
44 inline TWsScsComposeScreenCommand(TUint aCommand, const TInt aHandle); |
|
45 inline TWsScsComposeScreenCommand(TUint aCommand, const TRect iAttributes); |
|
46 inline void ConvertTrivialRect(TRect& aRect); |
|
47 |
|
48 TUint iCommand; |
|
49 union Parameters |
|
50 { |
|
51 TInt iBitmapHandle; |
|
52 TrivialRect iExtent; |
|
53 } iParameter; |
|
54 }; |
|
55 |
|
56 /** |
|
57 * Window Server client interface for screen capture. |
|
58 * |
|
59 * All functions in MTestScreenCapture will automatically flush the client-server |
|
60 * session buffer as part of their behavior. |
|
61 * |
|
62 * @publishedPartner |
|
63 * @prototype |
|
64 */ |
|
65 |
|
66 class MTestScreenCapture |
|
67 { |
|
68 public: |
|
69 enum TWsTestScreenCaptureOpcodes |
|
70 { |
|
71 EWsScsInvalid = 0x00000000, |
|
72 EWsScsScreenCompose = 0x00000001, |
|
73 EWsScsTranslateExtent = 0x00000002, |
|
74 }; |
|
75 |
|
76 enum |
|
77 { |
|
78 KUidTestScreenCaptureIf = 0x10286504, |
|
79 ETypeId = KUidTestScreenCaptureIf |
|
80 }; |
|
81 public: |
|
82 /** Retrieves the composited screen content. |
|
83 A new composition is initiated and the result is copied in |
|
84 the bitmap created by user. |
|
85 The only bitmap mode supported is EColor16MU. |
|
86 |
|
87 This function always causes a flush of the window server buffer. |
|
88 |
|
89 @param aBitmap retturns the composited screen content. |
|
90 @param aTarget target rectangle to be filled in |
|
91 @return KErrNone if successful |
|
92 KErrArgument if the size does not match the composition area size or |
|
93 the display mode is not supported |
|
94 */ |
|
95 virtual TInt ComposeScreen(const CFbsBitmap& aBitmap) const = 0; |
|
96 /** Maps the source rectangle from application coordinate space to a |
|
97 target coordinate space. Since there may be scaling involved, the |
|
98 target rectangle may be larger or smaller than the source one, or |
|
99 even become empty. |
|
100 |
|
101 This function always causes a flush of the window server buffer. |
|
102 |
|
103 @param aSource source rectangle |
|
104 @param aTarget target rectangle to be filled in |
|
105 @return KErrNone if successful, otherwise one of the system-wide error codes |
|
106 */ |
|
107 virtual TInt TranslateExtent(const TRect& aSource, TRect& aTarget) const = 0; |
|
108 |
|
109 /** Retrieves the size of the composition area in pixels. |
|
110 |
|
111 This function always causes a flush of the window server buffer. |
|
112 |
|
113 @param aSize returns the composition area size |
|
114 @return KErrNone if successful, otherwise one of the system-wide error codes |
|
115 */ |
|
116 virtual TInt GetCompositedSize(TSize& aSize) const = 0; |
|
117 }; |
|
118 |
|
119 inline TWsScsComposeScreenCommand::TWsScsComposeScreenCommand(TUint aCommand, const TInt aHandle): |
|
120 iCommand(aCommand) |
|
121 { iParameter.iBitmapHandle = aHandle; } |
|
122 |
|
123 inline TWsScsComposeScreenCommand::TWsScsComposeScreenCommand(TUint aCommand, const TRect iAttributes): |
|
124 iCommand(aCommand) |
|
125 { |
|
126 iParameter.iExtent.iTl.iX = iAttributes.iTl.iX; |
|
127 iParameter.iExtent.iTl.iY = iAttributes.iTl.iY; |
|
128 iParameter.iExtent.iBr.iX = iAttributes.iBr.iX; |
|
129 iParameter.iExtent.iBr.iY = iAttributes.iBr.iY; |
|
130 } |
|
131 inline void TWsScsComposeScreenCommand::ConvertTrivialRect(TRect& aRect) |
|
132 { |
|
133 aRect.iTl.iX = iParameter.iExtent.iTl.iX; |
|
134 aRect.iTl.iY = iParameter.iExtent.iTl.iY; |
|
135 aRect.iBr.iX = iParameter.iExtent.iBr.iX; |
|
136 aRect.iBr.iY = iParameter.iExtent.iBr.iY; |
|
137 } |
|
138 |
|
139 #endif /*TESTSCREENCAPTURE_H_*/ |