00001 // PngScanlineEncoder.h 00002 // 00003 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 00004 // All rights reserved. 00005 // This component and the accompanying materials are made available 00006 // under the terms of "Eclipse Public License v1.0" 00007 // which accompanies this distribution, and is available 00008 // at the URL "http://www.eclipse.org/legal/epl-v10.html". 00009 // 00010 // Initial Contributors: 00011 // Nokia Corporation - initial contribution. 00012 // 00013 // Contributors: 00014 // 00015 // Description: 00016 // 00017 // 00018 00019 #ifndef __PNGSCANLINEENCODER_H__ 00020 #define __PNGSCANLINEENCODER_H__ 00021 00022 #include "PNGCodec.h" 00023 #include "ImageUtils.h" 00024 00025 // 00026 // These classes specialise the PNG writer to write 00027 // scanlines with different bitmap depths/colour types 00028 // 00029 00030 const TInt KPngScanlineFilterTypeLength = 1; 00031 00032 // 00033 // CBitDepth1Encoder: specialised writer for 1bpp 00034 // 00035 00036 const TInt KPngDepth1PixelsPerByte = 8; 00037 const TInt KPngDepth1RoundUpValue = 7; 00038 const TInt KPngDepth1ShiftValue = 1; 00039 00040 class CBitDepth1Encoder : public CPngWriteSubCodec 00041 { 00042 private: 00043 virtual void DoConstructL(); 00044 virtual TInt ScanlineBufferSize(TInt aPixelLength); 00045 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, 00046 TUint8* aDataPtr, const TUint8* aDataPtrLimit); 00047 }; 00048 00049 // 00050 // CBitDepth2Encoder: specialised writer for 2bpp 00051 // 00052 00053 const TInt KPngDepth2PixelsPerByte = 4; 00054 const TInt KPngDepth2RoundUpValue = 3; 00055 const TInt KPngDepth2ShiftValue = 2; 00056 class CBitDepth2Encoder : public CPngWriteSubCodec 00057 { 00058 private: 00059 virtual void DoConstructL(); 00060 virtual TInt ScanlineBufferSize(TInt aPixelLength); 00061 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, 00062 TUint8* aDataPtr, const TUint8* aDataPtrLimit); 00063 }; 00064 00065 // 00066 // CBitDepth4Encoder: specialised writer for 4bpp 00067 // 00068 00069 const TInt KPngDepth4PixelsPerByte = 2; 00070 const TInt KPngDepth4RoundUpValue = 1; 00071 const TInt KPngDepth4ShiftValue = 4; 00072 class CBitDepth4Encoder : public CPngWriteSubCodec 00073 { 00074 private: 00075 virtual void DoConstructL(); 00076 virtual TInt ScanlineBufferSize(TInt aPixelLength); 00077 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, 00078 TUint8* aDataPtr, const TUint8* aDataPtrLimit); 00079 }; 00080 00081 // 00082 // CBitDepth8ColorType2Encoder: specialised writer for 8bpp, RGB colour 00083 // 00084 const TInt KPngDepth8RgbBytesPerPixel = 3; 00085 class CBitDepth8ColorType2Encoder : public CPngWriteSubCodec 00086 { 00087 private: 00088 virtual TInt ScanlineBufferSize(TInt aPixelLength); 00089 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, 00090 TUint8* aDataPtr, const TUint8* aDataPtrLimit); 00091 }; 00092 00093 // 00094 // CBitDepth8Encoder: specialised writer for 8bpp 00095 // 00096 00097 const TInt KPngDepth8PixelsPerByte = 1; 00098 const TInt KPngDepth8ShiftValue = 0; 00099 class CBitDepth8Encoder : public CPngWriteSubCodec 00100 { 00101 private: 00102 virtual void DoConstructL(); 00103 virtual TInt ScanlineBufferSize(TInt aPixelLength); 00104 virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline, 00105 TUint8* aDataPtr, const TUint8* aDataPtrLimit); 00106 }; 00107 00108 #endif // __PNGSCANLINEENCODER_H__
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.