|
1 /* |
|
2 * Copyright (c) 2002 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: Synchronous Image Operations |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "SyncImageOperations.h" |
|
20 |
|
21 // ------------------------------------------------------------------------------------------------ |
|
22 // CSyncDither* CSyncDither::NewL() |
|
23 // ------------------------------------------------------------------------------------------------ |
|
24 CSyncDither* CSyncDither::NewL() |
|
25 { |
|
26 CSyncDither* self = NewLC(); |
|
27 CleanupStack::Pop(); |
|
28 return self; |
|
29 } |
|
30 |
|
31 // ------------------------------------------------------------------------------------------------ |
|
32 // CSyncDither* CSyncDither::NewLC() |
|
33 // ------------------------------------------------------------------------------------------------ |
|
34 CSyncDither* CSyncDither::NewLC() |
|
35 { |
|
36 CSyncDither* self = new (ELeave) CSyncDither(); |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(); |
|
39 return self; |
|
40 } |
|
41 |
|
42 |
|
43 // ------------------------------------------------------------------------------------------------ |
|
44 // CSyncDither::CSyncDither() |
|
45 // ------------------------------------------------------------------------------------------------ |
|
46 CSyncDither::CSyncDither( ) |
|
47 : iDitherer( 0 ) |
|
48 , iScheduler() |
|
49 , iError( KErrNone ) |
|
50 { |
|
51 } |
|
52 |
|
53 // ------------------------------------------------------------------------------------------------ |
|
54 // CSyncDither::ConstructL() |
|
55 // ------------------------------------------------------------------------------------------------ |
|
56 void CSyncDither::ConstructL() |
|
57 { |
|
58 iDitherer = CMdaImageBitmapToBitmapUtility::NewL( *this ); |
|
59 } |
|
60 |
|
61 // ------------------------------------------------------------------------------------------------ |
|
62 // CSyncDither::~CSyncDither() |
|
63 // ------------------------------------------------------------------------------------------------ |
|
64 CSyncDither::~CSyncDither() |
|
65 { |
|
66 delete iDitherer; |
|
67 } |
|
68 |
|
69 // ------------------------------------------------------------------------------------------------ |
|
70 // CSyncDither:: |
|
71 // ------------------------------------------------------------------------------------------------ |
|
72 TInt CSyncDither::DitherL( CFbsBitmap& aBitmap, TDisplayMode aDisplayMode ) |
|
73 { |
|
74 TInt err = KErrNone; |
|
75 |
|
76 |
|
77 CSyncDither* obj = CSyncDither::NewLC(); |
|
78 err = obj->DoDitherL( aBitmap, aDisplayMode ); |
|
79 |
|
80 CleanupStack::PopAndDestroy( obj ); |
|
81 return err; |
|
82 } |
|
83 |
|
84 |
|
85 /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
86 // |
|
87 // Internal methods |
|
88 // |
|
89 /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
90 |
|
91 TInt CSyncDither::DoDitherL( CFbsBitmap& aBitmap, TDisplayMode aDisplayMode ) |
|
92 { |
|
93 iError = KErrNone; |
|
94 |
|
95 CFbsBitmap* tmpBitmap = new (ELeave) CFbsBitmap(); |
|
96 CleanupStack::PushL( tmpBitmap ); |
|
97 |
|
98 TSize bmpSize = aBitmap.SizeInPixels(); |
|
99 User::LeaveIfError( tmpBitmap->Create( bmpSize, aDisplayMode ) ); |
|
100 |
|
101 if(iError == KErrNone) |
|
102 { |
|
103 // Open original bitmap |
|
104 iDitherer->OpenL( aBitmap ); |
|
105 iScheduler.Start(); |
|
106 } |
|
107 |
|
108 if(iError == KErrNone) |
|
109 { |
|
110 // Dither bitmap |
|
111 iDitherer->ConvertL( *tmpBitmap ); |
|
112 iScheduler.Start(); |
|
113 } |
|
114 |
|
115 // Replace original bitmap with the new one. |
|
116 if(iError == KErrNone) |
|
117 { |
|
118 aBitmap.Reset(); |
|
119 aBitmap.Duplicate( tmpBitmap->Handle() ); |
|
120 } |
|
121 |
|
122 // Cleanup |
|
123 CleanupStack::PopAndDestroy( tmpBitmap ); |
|
124 |
|
125 return iError; |
|
126 } |
|
127 |
|
128 // ------------------------------------------------------------------------------------------------ |
|
129 // CSyncDither:: |
|
130 // ------------------------------------------------------------------------------------------------ |
|
131 void CSyncDither::MiuoCreateComplete(TInt aError) |
|
132 { |
|
133 iError = aError; |
|
134 iScheduler.AsyncStop(); |
|
135 } |
|
136 void CSyncDither::MiuoOpenComplete(TInt aError) |
|
137 { |
|
138 iError = aError; |
|
139 iScheduler.AsyncStop(); |
|
140 } |
|
141 void CSyncDither::MiuoConvertComplete(TInt aError) |
|
142 { |
|
143 iError = aError; |
|
144 iScheduler.AsyncStop(); |
|
145 } |
|
146 |
|
147 |
|
148 |
|
149 #if 0 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // RAknsSrvSession::EnumerateSkinPackages |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 EXPORT_C CArrayPtr<CAknsSrvSkinInformationPkg>* |
|
155 RAknsSrvSession::EnumerateSkinPackagesL( |
|
156 TAknSkinSrvSkinPackageLocation aLocation ) |
|
157 { |
|
158 AKNS_TRACE1("RAknsSrvSession::EnumerateSkinPackagesL %i", aLocation); |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 CArrayPtrFlat<CAknsSrvSkinInformationPkg>* array = |
|
164 new (ELeave) CArrayPtrFlat<CAknsSrvSkinInformationPkg>(5); |
|
165 CleanupStack::PushL( TCleanupItem( |
|
166 AknsSrvCArrayPtrCAknsSrvSkinInformationPkgCleanup, array ) ); |
|
167 |
|
168 CDesC16ArrayFlat* skinfiles = new (ELeave) CDesC16ArrayFlat(5); |
|
169 CleanupStack::PushL(skinfiles); |
|
170 |
|
171 switch (aLocation) |
|
172 { |
|
173 // Drives z and c |
|
174 case EAknsSrvPhone: |
|
175 AknsSrvUtils::SearchDirectoriesL(KAknSkinSrvSystemSkinPath, |
|
176 skinfiles ); |
|
177 AknsSrvUtils::SearchDirectoriesL(KAknSkinSrvSkinPathLFFS, |
|
178 skinfiles ); |
|
179 break; |
|
180 // drive e |
|
181 case EAknsSrvMMC: |
|
182 AknsSrvUtils::SearchDirectoriesL(KAknSkinSrvSkinPathMMC, |
|
183 skinfiles ); |
|
184 break; |
|
185 // all drives |
|
186 case EAknsSrvAll: |
|
187 #endif |
|
188 |
|
189 |
|
190 // ------------------------------------------------------------------------------------------------ |
|
191 // EOF |
|
192 // ------------------------------------------------------------------------------------------------ |