|
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 __PPM2CODEC_H__ |
|
17 #define __PPM2CODEC_H__ |
|
18 |
|
19 #include <bitdev.h> |
|
20 #include <icl/imageprocessor.h> |
|
21 #include <icl/imagecodec.h> |
|
22 |
|
23 #include "PPM2Convert.h" |
|
24 |
|
25 class CPpmDecoder; |
|
26 |
|
27 // PPM Read codec. |
|
28 class CPpmReadCodec : public CImageProcessorReadCodec |
|
29 { |
|
30 public: |
|
31 static CPpmReadCodec* NewL(CPpmDecoder& aDecoder); |
|
32 void ProcessFrameL(); |
|
33 void ResetFrameL(TFrameInfo& aFrameInfo, CFbsBitmap& aFrame); |
|
34 // From CImageReadCodec |
|
35 virtual void InitFrameL(TFrameInfo& aFrameInfo, CFrameImageData& aFrameImageData, TBool aDisableErrorDiffusion, CFbsBitmap& aDestination, CFbsBitmap* aDestinationMask); |
|
36 virtual void InitFrameHeader(TFrameInfo& aFrameInfo, CFrameImageData& aFrameData); |
|
37 virtual TFrameState ProcessFrameHeaderL(TBufPtr8& aData); |
|
38 void Complete(); |
|
39 |
|
40 virtual ~CPpmReadCodec(); |
|
41 protected: |
|
42 CPpmReadCodec(CPpmDecoder& aDecoder); |
|
43 void DoProcessCompressedL(); |
|
44 void DoProcessUncompressedL(); |
|
45 TBool ShouldAbort() const; |
|
46 |
|
47 private: |
|
48 // from CImageProcessorReadCodec |
|
49 TFrameState ProcessFrameL(TBufPtr8& aSrc); |
|
50 protected: |
|
51 CPpmDecoder *const iDecoder; |
|
52 TSize iFrameSize; |
|
53 const TUint8* iDataPtr; // Not owned |
|
54 const TUint8* iDataPtrLimit; // Not owned |
|
55 TInt iPixelsExpected; |
|
56 #if defined(__CONTINUE_CONVERT) |
|
57 TInt iMarkedPosition; |
|
58 TInt iPixelsProcessed; |
|
59 #endif // defined(__CONTINUE_CONVERT) |
|
60 TFrameInfo* iFrameInfo; // Not owned |
|
61 }; |
|
62 |
|
63 // Write codec |
|
64 class CPpm2WriteCodec : public CImageWriteCodec |
|
65 { |
|
66 public: |
|
67 static CPpm2WriteCodec* NewL(CPpmEncoder* aEncoder); |
|
68 virtual ~CPpm2WriteCodec(); |
|
69 |
|
70 void DoProcessL(const CFbsBitmap& aSource); |
|
71 |
|
72 // from CImageWriteCodec |
|
73 virtual void InitFrameL(TBufPtr8& aDst, const CFbsBitmap& aSource); |
|
74 virtual TFrameState ProcessFrameL(TBufPtr8& aDst); |
|
75 private: |
|
76 CPpm2WriteCodec(CPpmEncoder* aEncoder); |
|
77 void ConstructL (); |
|
78 |
|
79 TBool ShouldAbort() const; |
|
80 void AppendDataL(const TDesC8& aData); |
|
81 void SwitchRGB(TDes8 &aBuf); |
|
82 private: |
|
83 TRect iSourceRect; |
|
84 TPoint iPos; |
|
85 |
|
86 CPpmEncoder* iEncoder; // not linked |
|
87 }; |
|
88 |
|
89 #include "PPM2Codec.inl" |
|
90 |
|
91 #endif // __PPM2CODEC_H__ |
|
92 |