BMIParser.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3  * This file is a part of the libzmf project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
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  // disable copying
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 
36  bool parse();
37 
40  Image readImage();
41 
42  const BMIHeader &header() const;
43 
44 private:
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 
54  librevenge::RVNGDrawingInterface *m_painter;
55 
57 };
58 
59 }
60 
61 #endif // BMIPARSER_H_INCLUDED
62 
63 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
bool reconcileDimensions(ColorBitmapHeader &colorHeader, ColorBitmapHeader &transparencyHeader)
Definition: BMIParser.cpp:555
Definition: BMIParser.cpp:307
ColorBitmap readColorBitmap(const ColorBitmapHeader &header)
Definition: BMIParser.cpp:437
std::vector< uint8_t > readData(unsigned endOffset)
Definition: BMIParser.cpp:517
BMIHeader m_header
Definition: BMIParser.h:56
librevenge::RVNGDrawingInterface * m_painter
Definition: BMIParser.h:54
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
Definition: libzmf_utils.h:80
Definition: BMITypes.h:41
BMIParser & operator=(const BMIParser &other)=delete
Definition: BMIHeader.cpp:13
BMIParser(const BMIParser &other)=delete
bool parse()
Parse the bitmap and output it as a drawing doc with an inserted image.
Definition: BMIParser.cpp:357
std::vector< Color > readColorPalette(unsigned colorDepth)
Definition: BMIParser.cpp:539
const BMIHeader & header() const
Definition: BMIParser.cpp:432
const RVNGInputStreamPtr m_input
Definition: BMIParser.h:53
Definition: BMIHeader.h:20
Definition: ZMFTypes.h:203
Image readImage()
Parse the bitmap and convert it to PNG.
Definition: BMIParser.cpp:379
Definition: BMIParser.h:23

Generated for libzmf by doxygen 1.8.14