| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
#ifndef BMIPARSER_H_INCLUDED |
| 11 |
#define BMIPARSER_H_INCLUDED |
| 12 |
|
| 13 |
#include <librevenge/librevenge.h> |
| 14 |
|
| 15 |
#include "libzmf_utils.h" |
| 16 |
|
| 17 |
#include "BMIHeader.h" |
| 18 |
#include "ZMFTypes.h" |
| 19 |
|
| 20 |
namespace libzmf |
| 21 |
{ |
| 22 |
|
| 23 |
class BMIParser |
| 24 |
{ |
| 25 |
|
| 26 |
BMIParser(const BMIParser &other) = delete; |
| 27 |
BMIParser &operator=(const BMIParser &other) = delete; |
| 28 |
|
| 29 |
struct ColorBitmapHeader; |
| 30 |
|
| 31 |
public: |
| 32 |
explicit BMIParser(const RVNGInputStreamPtr &input, librevenge::RVNGDrawingInterface *painter = 0); |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
bool parse(); |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
Image readImage(); |
| 41 |
|
| 42 |
const BMIHeader &header() const; |
| 43 |
|
| 44 |
private: |
| 45 |
ColorBitmap readColorBitmap(const ColorBitmapHeader &header); |
| 46 |
|
| 47 |
std::vector<uint8_t> readData(unsigned endOffset); |
| 48 |
|
| 49 |
std::vector<Color> readColorPalette(unsigned colorDepth); |
| 50 |
|
| 51 |
bool reconcileDimensions(ColorBitmapHeader &colorHeader, ColorBitmapHeader &transparencyHeader); |
| 52 |
|
| 53 |
const RVNGInputStreamPtr m_input; |
| 54 |
librevenge::RVNGDrawingInterface *m_painter; |
| 55 |
|
| 56 |
BMIHeader m_header; |
| 57 |
}; |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
#endif |
| 62 |
|
| 63 |
|