|
1 // Copyright (c) 1999-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 __PPM2CONVERT_H__ |
|
17 #define __PPM2CONVERT_H__ |
|
18 |
|
19 #include <icl/imageplugin.h> |
|
20 #include "PPM2Codec.h" |
|
21 |
|
22 // Decoder. |
|
23 class CPpmReadCodec; |
|
24 class CPpmDecoder : public CImageDecoderPlugin |
|
25 { |
|
26 friend class CPpmReadCodec; |
|
27 |
|
28 public: |
|
29 static CPpmDecoder* NewL(); |
|
30 virtual ~CPpmDecoder(); |
|
31 |
|
32 virtual void ImageType(TInt aFrameNumber, TUid& aImageType, TUid& aImageSubType) const; |
|
33 CFrameInfoStrings* FrameInfoStringsL(RFs& aFs, TInt aFrameNumber); |
|
34 |
|
35 private: |
|
36 CPpmDecoder(); |
|
37 |
|
38 void InternalizeHeaderL(); |
|
39 |
|
40 TBool Compressed() const; |
|
41 void SetCompressed(TBool aCompressed); |
|
42 TBool BytesValid() const; |
|
43 void SetBytesValid(TBool aBytesValid); |
|
44 TInt DataShift() const; |
|
45 |
|
46 void SkipCommentAndWhiteSpaceL(); |
|
47 |
|
48 TUint PeekByteL(); |
|
49 void IncByte(); |
|
50 TUint GetByteL(); |
|
51 TInt ReadIntL(); |
|
52 void ResetPosition(TInt aPosition); |
|
53 |
|
54 // From CImageDecoderPlugin |
|
55 void ScanDataL(); |
|
56 // Called by ScanDataL. |
|
57 // Opens file, scans header and validates format. |
|
58 void ReadFormatL(); |
|
59 void DoConvert(); |
|
60 |
|
61 private: |
|
62 TInt iDataShift; |
|
63 TInt iMaxValue; |
|
64 TUint iFlags; |
|
65 TPtrC8 iSourceBuffer; |
|
66 TInt iBase; |
|
67 enum TFlags |
|
68 { |
|
69 EFlagCompressed=0x01, |
|
70 EFlagBytesValid=0x02 |
|
71 }; |
|
72 }; |
|
73 |
|
74 // CPpmEncoder |
|
75 class CPpmEncoder : public CImageEncoderPlugin |
|
76 { |
|
77 friend class CPpm2WriteCodec; |
|
78 |
|
79 public: |
|
80 static CPpmEncoder* NewL(); |
|
81 virtual ~CPpmEncoder(); |
|
82 |
|
83 protected: |
|
84 void AppendDataL(const TDesC8& aData); |
|
85 // from CImageEncoderPlugin |
|
86 void PrepareEncoderL(const CFrameImageData* aFrameImageData); |
|
87 void UpdateHeaderL(); |
|
88 void DoConvert(); |
|
89 |
|
90 private: |
|
91 CPpmEncoder(); |
|
92 void DoConvertL(); |
|
93 |
|
94 }; |
|
95 |
|
96 #include "Ppm2Convert.inl" |
|
97 |
|
98 #endif // __PPM2CONVERT_H__ |
|
99 |