|
1 // Copyright (c) 1998-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 #include <mdaimageconverter.h> |
|
17 #include "MdaImageConverterPriv.h" |
|
18 |
|
19 // |
|
20 // CMdaBitmapScaler for Image Utility |
|
21 // |
|
22 |
|
23 /** |
|
24 Constructs and initialises a new instance of the image scaler. |
|
25 |
|
26 The function leaves if the image scaler object cannot be created. |
|
27 |
|
28 @return A pointer to the new image scaler object. |
|
29 */ |
|
30 EXPORT_C CMdaBitmapScaler* CMdaBitmapScaler::NewL() |
|
31 { |
|
32 CMdaBitmapScaler* self = new(ELeave) CMdaBitmapScaler; |
|
33 CleanupStack::PushL(self); |
|
34 self->iProperties = CMdaBitmapScalerPriv::NewL(); |
|
35 CleanupStack::Pop(); // self |
|
36 return self; |
|
37 } |
|
38 |
|
39 /** |
|
40 Default destructor. |
|
41 |
|
42 Frees all associated resources. |
|
43 */ |
|
44 EXPORT_C CMdaBitmapScaler::~CMdaBitmapScaler() |
|
45 { |
|
46 delete iProperties; |
|
47 } |
|
48 |
|
49 /** |
|
50 Begins the bitmap re-scaling operation. |
|
51 |
|
52 The scaling factor is based on the relative sizes of the source |
|
53 and target bitmaps. The operation is asynchronous. |
|
54 |
|
55 When it is completed, successfully or otherwise, the callback function |
|
56 MMdaImageUtilObserver::MiuoConvertComplete() is called, |
|
57 passing the state of the operation. |
|
58 |
|
59 @param aObserver |
|
60 The image utility observer interface. |
|
61 @param aSrcBitmap |
|
62 The bitmap to be re-scaled. |
|
63 @param aTgtBitmap |
|
64 The target location for the re-scaled bitmap. |
|
65 @param aMaintainAspectRatio |
|
66 ETrue - the aspect ratio is retained; |
|
67 this is the default. The same scaling factor is |
|
68 applied in both the horizontal and vertical |
|
69 directions. This is the smaller of the horizontal |
|
70 scaling factor and the vertical scaling factor. |
|
71 EFalse - the aspect ratio need not be |
|
72 retained. |
|
73 */ |
|
74 EXPORT_C void CMdaBitmapScaler::ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aSrcBitmap,CFbsBitmap& aTgtBitmap,TBool aMaintainAspectRatio) |
|
75 { |
|
76 iProperties->ScaleL(aObserver, aSrcBitmap, aTgtBitmap, aMaintainAspectRatio); |
|
77 } |
|
78 |
|
79 /** |
|
80 Begins the bitmap re-scaling operation. |
|
81 |
|
82 The scaling factor is based on the relative value of the source bitmap |
|
83 size and the explicitly supplied size. The operation is asynchronous. |
|
84 When it is complete, successfully or otherwise, the callback function |
|
85 MMdaImageUtilObserver::MiuoConvertComplete() is called, |
|
86 passing the state of the operation. |
|
87 |
|
88 @param aObserver |
|
89 The image utility observer interface. |
|
90 @param aBitmap |
|
91 The bitmap to be re-scaled. This reference is also the |
|
92 target location for the re-scaled bitmap. |
|
93 @param aDestSize |
|
94 The requested target size for the re-scaled bitmap. |
|
95 @param aMaintainAspectRatio |
|
96 ETrue - the aspect ratio is retained; |
|
97 this is the default. The same scaling factor is |
|
98 applied in both the horizontal and vertical |
|
99 directions. This is the smaller of the horizontal |
|
100 scaling factor and the vertical scaling factor. |
|
101 EFalse - the aspect ratio need not be |
|
102 retained. |
|
103 */ |
|
104 EXPORT_C void CMdaBitmapScaler::ScaleL(MMdaImageUtilObserver& aObserver,CFbsBitmap& aBitmap,TSize aDestSize,TBool aMaintainAspectRatio) |
|
105 { |
|
106 iProperties->ScaleL(aObserver, aBitmap, aDestSize, aMaintainAspectRatio); |
|
107 } |
|
108 |
|
109 /** |
|
110 Cancels the bitmap re-scaling operation. |
|
111 |
|
112 The observer callback function |
|
113 MMdaImageUtilObserver::MiuoConvertComplete() is not |
|
114 called. |
|
115 */ |
|
116 EXPORT_C void CMdaBitmapScaler::CancelScaling() |
|
117 { |
|
118 iProperties->CancelScaling(); |
|
119 } |