20 |
#define BITMAP_H |
#define BITMAP_H |
21 |
|
|
22 |
#include "VecUtils.h" |
#include "VecUtils.h" |
|
#include "OxydVersion.h" |
|
23 |
#include <string> |
#include <string> |
24 |
|
|
25 |
|
namespace OxydLib { |
26 |
|
|
27 |
|
using std::string; |
28 |
|
|
29 |
class Palette |
class Palette |
30 |
{ |
{ |
31 |
public: |
public: |
36 |
void setNumColors(int numColors); |
void setNumColors(int numColors); |
37 |
|
|
38 |
void getColor(int nColor, |
void getColor(int nColor, |
39 |
unsigned int *pRed, |
unsigned int *pRed, |
40 |
unsigned int *pGreen, |
unsigned int *pGreen, |
41 |
unsigned int *pBlue) const; |
unsigned int *pBlue) const; |
42 |
void setColor(int nColor, |
void setColor(int nColor, |
43 |
unsigned int red, |
unsigned int red, |
44 |
unsigned int green, |
unsigned int green, |
45 |
unsigned int blue); |
unsigned int blue); |
46 |
|
|
47 |
private: |
private: |
48 |
std::vector<unsigned int> m_colors; |
std::vector<unsigned int> m_colors; |
74 |
// regardless of the bit depth of the bitmap. |
// regardless of the bit depth of the bitmap. |
75 |
|
|
76 |
bool parseBitmap(const ByteVec &in, |
bool parseBitmap(const ByteVec &in, |
77 |
OxydVersion ver, |
Bitmap *pBitmap, |
78 |
Bitmap *pBitmap, |
Palette *pPalette, |
79 |
Palette *pPalette, |
string *pMsg = 0); |
|
std::string *pMsg = 0); |
|
80 |
bool unparseBitmap(const Bitmap &bitmap, |
bool unparseBitmap(const Bitmap &bitmap, |
81 |
const Palette &palette, |
const Palette &palette, |
82 |
OxydVersion ver, |
ByteVec *pOut, |
83 |
ByteVec *pOut, |
string *pMsg = 0); |
|
std::string *pMsg = 0); |
|
84 |
|
|
85 |
// The palette passed to bitmapToPPM should have 2^(bit depth of bitmap) |
// The palette passed to bitmapToPPM should have 2^(bit depth of bitmap) |
86 |
// colors. |
// colors. |
87 |
|
|
88 |
void bitmapToPPM(const Bitmap &bitmap, |
void bitmapToPPM(const Bitmap &bitmap, |
89 |
const Palette &palette, |
const Palette &palette, |
90 |
ByteVec *pOut); |
ByteVec *pOut); |
91 |
void bitPlaneToPPM(const Bitmap &bitmap, |
void bitPlaneToPPM(const Bitmap &bitmap, |
92 |
int nBitPlane, |
int nBitPlane, |
93 |
ByteVec *pOut); |
ByteVec *pOut); |
94 |
|
|
95 |
|
} |
96 |
|
|
97 |
#endif |
#endif |