|
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 __PPMCONVERT_H__ |
|
17 #define __PPMCONVERT_H__ |
|
18 |
|
19 #include "icl/imageplugin.h" |
|
20 #include "PPM1Codec.h" |
|
21 #include "icl/imageconversionextension.h" |
|
22 #include "pluginextensionmanager.h" |
|
23 |
|
24 // Decoder. |
|
25 class CPpmReadCodec; |
|
26 class CPpmDecoder : public CImageDecoderPlugin |
|
27 { |
|
28 friend class CPpmReadCodec; |
|
29 |
|
30 public: |
|
31 static CPpmDecoder* NewL(); |
|
32 virtual ~CPpmDecoder(); |
|
33 |
|
34 virtual void ImageType(TInt aFrameNumber, TUid& aImageType, TUid& aImageSubType) const; |
|
35 CFrameInfoStrings* FrameInfoStringsL(RFs& aFs, TInt aFrameNumber); |
|
36 virtual void GetExtensionL(TUid aExtUid, MImageConvExtension*& aExtPtr); |
|
37 virtual void SetClippingRectL(const TRect* aClipRect); |
|
38 virtual TInt GetDestinationSize(TSize& aSize, TInt aFrameNumber); |
|
39 |
|
40 private: |
|
41 CPpmDecoder(); |
|
42 |
|
43 void InternalizeHeaderL(TLex8& aLex); |
|
44 void SkipCommentAndWhiteSpaceL(TLex8& aLex); |
|
45 void DoSkipCommentL(TLex8& aLex); |
|
46 |
|
47 TBool Compressed() const; |
|
48 void SetCompressed(TBool aCompressed); |
|
49 TBool InComment() const; |
|
50 void SetInComment(TBool aInComment); |
|
51 TInt DataShift() const; |
|
52 |
|
53 // From CImageDecoderPlugin |
|
54 void ScanDataL(); |
|
55 // Called by ScanDataL. |
|
56 // Opens file, scans header and validates format. |
|
57 void ReadFormatL(); |
|
58 |
|
59 private: |
|
60 TInt iDataShift; |
|
61 TInt iMaxValue; |
|
62 TUint iFlags; |
|
63 enum TFlags |
|
64 { |
|
65 EFlagCompressed=0x01, |
|
66 EFlagInComment=0x02 |
|
67 }; |
|
68 CPluginExtensionManager* iExtensionManager; // owned |
|
69 }; |
|
70 |
|
71 // CPpmEncoder |
|
72 class CPpmEncoder : public CImageEncoderPlugin |
|
73 { |
|
74 public: |
|
75 static CPpmEncoder* NewL(); |
|
76 virtual ~CPpmEncoder(); |
|
77 protected: |
|
78 // from CImageEncoderPlugin |
|
79 void PrepareEncoderL(const CFrameImageData* aFrameImageData); |
|
80 void UpdateHeaderL(); |
|
81 private: |
|
82 CPpmEncoder(); |
|
83 }; |
|
84 |
|
85 #include "Ppm1Convert.inl" |
|
86 |
|
87 #endif // __PPMCONVERT_H__ |
|
88 |