|
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 #ifndef __PNGSCANLINEENCODER_H__ |
|
17 #define __PNGSCANLINEENCODER_H__ |
|
18 |
|
19 #include "PNGCodec.h" |
|
20 #include "ImageUtils.h" |
|
21 |
|
22 const TInt KPngScanlineFilterTypeLength = 1; |
|
23 |
|
24 // CBitDepth1Encoder |
|
25 const TInt KPngDepth1PixelsPerByte = 8; |
|
26 const TInt KPngDepth1RoundUpValue = 7; |
|
27 const TInt KPngDepth1ShiftValue = 1; |
|
28 class CBitDepth1Encoder : public CPngWriteSubCodec |
|
29 { |
|
30 private: |
|
31 virtual void DoConstructL(); |
|
32 virtual TInt ScanlineBufferSize(TInt aPixelLength); |
|
33 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, |
|
34 TUint8* aDataPtr, const TUint8* aDataPtrLimit); |
|
35 }; |
|
36 |
|
37 // CBitDepth2Encoder |
|
38 const TInt KPngDepth2PixelsPerByte = 4; |
|
39 const TInt KPngDepth2RoundUpValue = 3; |
|
40 const TInt KPngDepth2ShiftValue = 2; |
|
41 class CBitDepth2Encoder : public CPngWriteSubCodec |
|
42 { |
|
43 private: |
|
44 virtual void DoConstructL(); |
|
45 virtual TInt ScanlineBufferSize(TInt aPixelLength); |
|
46 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, |
|
47 TUint8* aDataPtr, const TUint8* aDataPtrLimit); |
|
48 }; |
|
49 |
|
50 // CBitDepth4Encoder |
|
51 const TInt KPngDepth4PixelsPerByte = 2; |
|
52 const TInt KPngDepth4RoundUpValue = 1; |
|
53 const TInt KPngDepth4ShiftValue = 4; |
|
54 class CBitDepth4Encoder : public CPngWriteSubCodec |
|
55 { |
|
56 private: |
|
57 virtual void DoConstructL(); |
|
58 virtual TInt ScanlineBufferSize(TInt aPixelLength); |
|
59 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, |
|
60 TUint8* aDataPtr, const TUint8* aDataPtrLimit); |
|
61 }; |
|
62 |
|
63 // CBitDepth8ColorType2Encoder |
|
64 const TInt KPngDepth8RgbBytesPerPixel = 3; |
|
65 class CBitDepth8ColorType2Encoder : public CPngWriteSubCodec |
|
66 { |
|
67 private: |
|
68 virtual TInt ScanlineBufferSize(TInt aPixelLength); |
|
69 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, |
|
70 TUint8* aDataPtr, const TUint8* aDataPtrLimit); |
|
71 }; |
|
72 |
|
73 // CBitDepth8Encoder |
|
74 const TInt KPngDepth8PixelsPerByte = 1; |
|
75 const TInt KPngDepth8ShiftValue = 0; |
|
76 class CBitDepth8Encoder : public CPngWriteSubCodec |
|
77 { |
|
78 private: |
|
79 virtual void DoConstructL(); |
|
80 virtual TInt ScanlineBufferSize(TInt aPixelLength); |
|
81 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, |
|
82 TUint8* aDataPtr, const TUint8* aDataPtrLimit); |
|
83 }; |
|
84 |
|
85 #endif // __PNGSCANLINEENCODER_H__ |