Debian Codegraph @

src/lib/BMIParser.h

raw symbols SCIP
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
34 /** Parse the bitmap and output it as a drawing doc with an inserted image.
35 */
36 bool parse();
37
38 /** Parse the bitmap and convert it to PNG.
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 // BMIPARSER_H_INCLUDED
62
63 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */