|
1 // Copyright (c) 1997-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 "JpegYuvDecoder.h" |
|
17 |
|
18 /** |
|
19 Start decoding an image frame asynchronously. Pixels will be decoded in |
|
20 YUV format. |
|
21 |
|
22 @pre |
|
23 The destination bitmap that receives the decoded data must be created before |
|
24 using this function. The bitmap must be large enough to hold the frame and the display |
|
25 mode must be set to EColor16M. Use CImageDecoder::FrameInfo() to determine the |
|
26 size of the frame. |
|
27 |
|
28 @post |
|
29 On completion, aRequestStatus contains an error code. If the frame was decoded successfully it |
|
30 will contain KErrNone. If frame was only partially decoded it will contain KErrUnderflow |
|
31 or another of the system-wide error codes. |
|
32 |
|
33 @param aRequestStatus |
|
34 The request status. |
|
35 @param aDestination |
|
36 A bitmap that will contain the decoded frame. |
|
37 @param aFrameNumber |
|
38 The frame in multi-frame image to decode (optional, in which case defaults to zero). |
|
39 */ |
|
40 EXPORT_C void CJpegYuvDecoder::ConvertYuv(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, TInt aFrameNumber) |
|
41 { |
|
42 ASSERT(aDestination.DisplayMode() == EColor16M); |
|
43 |
|
44 if(aDestination.Handle()!=0 && aDestination.ExtendedBitmapType()!=KNullUid) |
|
45 { |
|
46 TRequestStatus* status = aRequestStatus; |
|
47 User::RequestComplete(status,KErrNotSupported); |
|
48 } |
|
49 |
|
50 TRAPD(error,CustomSyncL(EOptionYuvDecode)); |
|
51 if (error!=KErrNone) |
|
52 { |
|
53 TRequestStatus* status = aRequestStatus; |
|
54 User::RequestComplete(status, error); |
|
55 } |
|
56 |
|
57 CImageDecoder::Convert(aRequestStatus, aDestination, aFrameNumber); |
|
58 } |
|
59 |
|
60 /** |
|
61 Start decoding an image frame and mask asynchronously. Pixels will be decoded in |
|
62 YUV format. |
|
63 |
|
64 @pre |
|
65 The destination bitmap, aDestination must be created before the call and must be large enough |
|
66 for the frame and the display mode must be EColor16M. FrameInfo() can be used to obtain the |
|
67 size and display mode of the frame. The mask bitmap, aDestinationMask must also be created before |
|
68 the call and must be large enough for the mask. The display mode must be EGray2 or EGray256 |
|
69 and must be EGray256 if the image contains alpha-blending information. This information can |
|
70 be obtained from the iFlags property of TFrameInfo obtained from a FrameInfo() call. |
|
71 |
|
72 @param aRequestStatus |
|
73 The request status. On completion contains an error code. |
|
74 KErrNone if frame was decoded successfully, |
|
75 KErrUnderflow if the frame was partially decoded |
|
76 otherwise another of the system-wide error codes. |
|
77 @param aDestination |
|
78 A bitmap that will contain the decoded frame. |
|
79 @param aDestinationMask |
|
80 A bitmap that will contain the decoded frame mask. |
|
81 @param aFrameNumber |
|
82 The frame in multi-frame image to decode (optional, in which case defaults to zero). |
|
83 |
|
84 @see TFrameInfo |
|
85 */ |
|
86 EXPORT_C void CJpegYuvDecoder::ConvertYuv(TRequestStatus* aRequestStatus, CFbsBitmap& aDestination, CFbsBitmap& aDestinationMask, TInt aFrameNumber) |
|
87 { |
|
88 ASSERT(aDestination.DisplayMode() == EColor16M); |
|
89 |
|
90 if(aDestination.Handle()!=0 && aDestination.ExtendedBitmapType()!=KNullUid) |
|
91 { |
|
92 TRequestStatus* status = aRequestStatus; |
|
93 User::RequestComplete(status,KErrNotSupported); |
|
94 } |
|
95 |
|
96 if(aDestinationMask.Handle()!=0 && aDestinationMask.ExtendedBitmapType()!=KNullUid) |
|
97 { |
|
98 TRequestStatus* status = aRequestStatus; |
|
99 User::RequestComplete(status,KErrNotSupported); |
|
100 } |
|
101 |
|
102 TRAPD(error, CustomSyncL(EOptionYuvDecode)); |
|
103 if (error!=KErrNone) |
|
104 { |
|
105 TRequestStatus* status = aRequestStatus; |
|
106 User::RequestComplete(status, error); |
|
107 } |
|
108 |
|
109 CImageDecoder::Convert(aRequestStatus, aDestination, aDestinationMask, aFrameNumber); |
|
110 } |
|
111 |