|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MIFCONVMBMGENERATORPBMCOMP_H__ |
|
20 #define __MIFCONVMBMGENERATORPBMCOMP_H__ |
|
21 |
|
22 #include "mifconv_mbmgenerator.h" |
|
23 #include "mifconv_util.h" |
|
24 |
|
25 class BitmapCompiler |
|
26 /** |
|
27 Historical note - Pbm is an abbreviation for "Symbian Bitmap" |
|
28 */ |
|
29 { |
|
30 public: |
|
31 BitmapCompiler(MifConvSourceFileList aSourcefilenames); |
|
32 ~BitmapCompiler(); |
|
33 int Compile(const MifConvString& aDestfilename, const MifConvString& aPaletteFilename); |
|
34 private: |
|
35 int AllocatePbmSourcesArray(); |
|
36 int LoadSourcefiles(); |
|
37 int FileImage(); |
|
38 int WriteFileheader(); |
|
39 int WriteFilebitmap(SEpocBitmapHeader* aPbm); |
|
40 int WriteHeadStream(); |
|
41 int LoadPalette(const char* aPaletteFilename); |
|
42 void CalculateInversePalette(); |
|
43 int CompressBitmap(SEpocBitmapHeader*& aPbm); |
|
44 int CompressByteData(char*& aDest,char* aSrce,int aSize); |
|
45 int WriteCompressedByteData(char*& aDest,char* aData,int aLength, const char* aDestEnd); |
|
46 int WriteCompressedByteValues(char*& aDest,char aValue,int aLength, const char* aDestEnd); |
|
47 int CompressTwelveBitData(char*& aDest,char* aSrce,int aSizeInBytes); |
|
48 int WriteCompressedTwelveBitData(unsigned short*& aDest,unsigned short aData,int aLength); |
|
49 int CompressSixteenBitData(char*& aDest,char* aSrce,int aSize); |
|
50 int WriteCompressedSixteenBitData(char*& aDest,unsigned short* aData,int aLength, const char* aDestEnd); |
|
51 int WriteCompressedSixteenBitValues(char*& aDest,unsigned short aValue,int aLength, const char* aDestEnd); |
|
52 int CompressTwentyFourBitData(char*& aDest,char* aSrce,int aSizeInBytes); |
|
53 int WriteCompressedTwentyFourBitData(char*& aDest,char* aData,int aLength, const char* aDestEnd); |
|
54 int WriteCompressedTwentyFourBitValues(char*& aDest,char aComponent1,char aComponent2,char aComponent3,int aLength, const char* aDestEnd); |
|
55 int CompressThirtyTwoUBitData(char*& aDest,char* aSrce,int aSizeInBytes); |
|
56 int WriteCompressedThirtyTwoUBitData(char*& aDest,char* aData, int aLength, const char* aDestEnd); |
|
57 int WriteCompressedThirtyTwoUBitValues(char*& aDest,char aComponent1, char aComponent2,char aComponent3, int aLength, const char* aDestEnd); |
|
58 int TrueColorPointerCompare(char* aColorPointer,char aComponent1,char aComponent2,char aComponent3); |
|
59 int CompressThirtyTwoABitData(char*& aDest,char* aSrce,int aSizeInBytes); |
|
60 int WriteCompressedThirtyTwoABitData(char*& aDest,char* aData,int aLength,const char* aDestEnd); |
|
61 int WriteCompressedThirtyTwoABitValues(char*& aDest,char aComponent1,char aComponent2,char aComponent3,char aComponent4,int aLength,const char* aDestEnd); |
|
62 int ColorAlphaPointerCompare(char* aColorPointer,char aComponent1,char aComponent2,char aComponent3,char aComponent4); |
|
63 int ReadHexString(char aHexBuf[10],char*& aDataPtr,char* aDataPtrLimit); |
|
64 int HexToInt(char aHighNibble,char aLowNibble); |
|
65 int HexToInt(char aNibble); |
|
66 private: |
|
67 fstream iDestFile; |
|
68 MifConvSourceFileList iSourcefilenames; |
|
69 SEpocBitmapHeader** iPbmSources; |
|
70 int iNumSources; |
|
71 int iDefaultPalette; |
|
72 TRgb iPalette[256]; |
|
73 char iInversePalette[4096]; |
|
74 }; |
|
75 |
|
76 #endif |