examples/Multimedia/ICL/ICLCodec/PngScanlineEncoder.h

00001 /*
00002 Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions are met:
00006 
00007 * Redistributions of source code must retain the above copyright notice, this
00008   list of conditions and the following disclaimer.
00009 * Redistributions in binary form must reproduce the above copyright notice,
00010   this list of conditions and the following disclaimer in the documentation
00011   and/or other materials provided with the distribution.
00012 * Neither the name of Nokia Corporation nor the names of its contributors
00013   may be used to endorse or promote products derived from this software
00014   without specific prior written permission.
00015 
00016 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026 
00027 Description:  
00028 */
00029 
00030 
00031 
00032 #ifndef __PNGSCANLINEENCODER_H__
00033 #define __PNGSCANLINEENCODER_H__
00034 
00035 #include "PNGCodec.h"
00036 #include "ImageUtils.h"
00037 
00038 //
00039 // These classes specialise the PNG writer to write
00040 // scanlines with different bitmap depths/colour types
00041 //
00042 
00043 const TInt KPngScanlineFilterTypeLength = 1;
00044 
00045 //
00046 // CBitDepth1Encoder: specialised writer for 1bpp
00047 //
00048 
00049 const TInt KPngDepth1PixelsPerByte = 8;
00050 const TInt KPngDepth1RoundUpValue = 7;
00051 const TInt KPngDepth1ShiftValue = 1;
00052 
00053 class CBitDepth1Encoder : public CPngWriteSubCodec
00054         {
00055 private:
00056         virtual void DoConstructL();
00057         virtual TInt ScanlineBufferSize(TInt aPixelLength);
00058         virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline,
00059                                         TUint8* aDataPtr, const TUint8* aDataPtrLimit);
00060         };
00061 
00062 //
00063 // CBitDepth2Encoder: specialised writer for 2bpp
00064 //
00065 
00066 const TInt KPngDepth2PixelsPerByte = 4;
00067 const TInt KPngDepth2RoundUpValue = 3;
00068 const TInt KPngDepth2ShiftValue = 2;
00069 class CBitDepth2Encoder : public CPngWriteSubCodec
00070         {
00071 private:
00072         virtual void DoConstructL();
00073         virtual TInt ScanlineBufferSize(TInt aPixelLength);
00074         virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline,
00075                                         TUint8* aDataPtr, const TUint8* aDataPtrLimit);
00076         };
00077 
00078 //
00079 // CBitDepth4Encoder: specialised writer for 4bpp
00080 //
00081 
00082 const TInt KPngDepth4PixelsPerByte = 2;
00083 const TInt KPngDepth4RoundUpValue = 1;
00084 const TInt KPngDepth4ShiftValue = 4;
00085 class CBitDepth4Encoder : public CPngWriteSubCodec
00086         {
00087 private:
00088         virtual void DoConstructL();
00089         virtual TInt ScanlineBufferSize(TInt aPixelLength);
00090         virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline,
00091                                         TUint8* aDataPtr, const TUint8* aDataPtrLimit);
00092         };
00093 
00094 //
00095 // CBitDepth8ColorType2Encoder: specialised writer for 8bpp, RGB colour
00096 //
00097 const TInt KPngDepth8RgbBytesPerPixel = 3;
00098 class CBitDepth8ColorType2Encoder : public CPngWriteSubCodec
00099         {
00100 private:
00101         virtual TInt ScanlineBufferSize(TInt aPixelLength);
00102         virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline,
00103                                         TUint8* aDataPtr, const TUint8* aDataPtrLimit);
00104         };
00105 
00106 //
00107 // CBitDepth8Encoder: specialised writer for 8bpp
00108 //
00109 
00110 const TInt KPngDepth8PixelsPerByte = 1;
00111 const TInt KPngDepth8ShiftValue = 0;
00112 class CBitDepth8Encoder : public CPngWriteSubCodec
00113         {
00114 private:
00115         virtual void DoConstructL();
00116         virtual TInt ScanlineBufferSize(TInt aPixelLength);
00117         virtual void DoEncode(const CFbsBitmap* aSource, const TInt aScanline,
00118                                         TUint8* aDataPtr, const TUint8* aDataPtrLimit);
00119         };
00120 
00121 #endif // __PNGSCANLINEENCODER_H__

Generated by  doxygen 1.6.2