|
1 // Copyright (c) 2001-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 "icl/ImageCodec.h" |
|
17 #include "ImageClientMain.h" |
|
18 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
19 #include <icl/imagecodecdef.h> |
|
20 #endif |
|
21 |
|
22 _LIT(KIclPanicCategory, "ImageConversion"); |
|
23 |
|
24 // Global panic function |
|
25 GLDEF_C void Panic(TIclPanic aError) |
|
26 { |
|
27 User::Panic(KIclPanicCategory, aError); |
|
28 } |
|
29 |
|
30 TImageParameterData::TImageParameterData() |
|
31 : iImageParameterDataFlag(ENull) |
|
32 { |
|
33 } |
|
34 |
|
35 void TImageParameterData::SetFilenamePtr(const TDesC* aSourceFilenamePtr) |
|
36 { |
|
37 iImageParameterDataFlag = EFilename; |
|
38 iSourceFilenamePtr = aSourceFilenamePtr; |
|
39 } |
|
40 |
|
41 void TImageParameterData::SetDataPtr(const TDesC8* aSourceDataPtr) |
|
42 { |
|
43 iImageParameterDataFlag = EData; |
|
44 iSourceDataPtr = aSourceDataPtr; |
|
45 } |
|
46 |
|
47 /** |
|
48 Indicates whether the data source desciptor contains data or a filename. |
|
49 |
|
50 @return A boolean indicating if the source descriptor contains a filename. ETrue if it does contain |
|
51 a filename, otherwise EFalse. |
|
52 |
|
53 @panic EUndefinedSourceType |
|
54 The source type has not been defined. |
|
55 */ |
|
56 EXPORT_C TBool TImageParameterData::IsFilename() const |
|
57 { |
|
58 if (iImageParameterDataFlag == ENull) |
|
59 Panic(EUndefinedSourceType); |
|
60 return iImageParameterDataFlag == EFilename; |
|
61 } |
|
62 |
|
63 /** |
|
64 Returns a pointer to the filename from the source descriptor. |
|
65 |
|
66 @return A pointer to the filename source descriptor. |
|
67 |
|
68 @panic EUndefinedSourceType |
|
69 The source has not been defined as a file source. |
|
70 */ |
|
71 EXPORT_C const TDesC* TImageParameterData::SourceFilenamePtr() const |
|
72 { |
|
73 if (iImageParameterDataFlag != EFilename) |
|
74 Panic(EUndefinedSourceType); |
|
75 return iSourceFilenamePtr; |
|
76 } |
|
77 |
|
78 /** |
|
79 Returns a pointer to the data from the source descriptor. |
|
80 |
|
81 @return A pointer to the data source descriptor. |
|
82 |
|
83 @panic EUndefinedSourceType |
|
84 The source has not been defined as a data source. |
|
85 */ |
|
86 EXPORT_C const TDesC8* TImageParameterData::SourceDataPtr() const |
|
87 { |
|
88 if (iImageParameterDataFlag != EData) |
|
89 Panic(EUndefinedSourceType); |
|
90 return iSourceDataPtr; |
|
91 } |
|
92 |
|
93 TBool TImageParameterData::IsDataTypeDefined() const |
|
94 { |
|
95 return (iImageParameterDataFlag == ENull)?EFalse:ETrue; |
|
96 } |