BMIParser.h Source File documentation

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
20namespace 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
31public:
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
44private:
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: */
BMIHeader.h
ZMFTypes.h
libzmf::BMIHeader
Definition BMIHeader.h:21
libzmf::BMIParser
Definition BMIParser.h:24
libzmf::BMIParser::readImage
Image readImage()
Parse the bitmap and convert it to PNG.
Definition BMIParser.cpp:379
libzmf::BMIParser::BMIParser
BMIParser(const BMIParser &other)=delete
libzmf::BMIParser::m_header
BMIHeader m_header
Definition BMIParser.h:56
libzmf::BMIParser::reconcileDimensions
bool reconcileDimensions(ColorBitmapHeader &colorHeader, ColorBitmapHeader &transparencyHeader)
Definition BMIParser.cpp:555
libzmf::BMIParser::readColorPalette
std::vector< Color > readColorPalette(unsigned colorDepth)
Definition BMIParser.cpp:539
libzmf::BMIParser::readColorBitmap
ColorBitmap readColorBitmap(const ColorBitmapHeader &header)
Definition BMIParser.cpp:437
libzmf::BMIParser::operator=
BMIParser & operator=(const BMIParser &other)=delete
libzmf::BMIParser::header
const BMIHeader & header() const
Definition BMIParser.cpp:432
libzmf::BMIParser::m_painter
librevenge::RVNGDrawingInterface * m_painter
Definition BMIParser.h:54
libzmf::BMIParser::parse
bool parse()
Parse the bitmap and output it as a drawing doc with an inserted image.
Definition BMIParser.cpp:357
libzmf::BMIParser::m_input
const RVNGInputStreamPtr m_input
Definition BMIParser.h:53
libzmf::BMIParser::readData
std::vector< uint8_t > readData(unsigned endOffset)
Definition BMIParser.cpp:517
libzmf_utils.h
libzmf
Definition BMIHeader.cpp:14
libzmf::RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
Definition libzmf_utils.h:80
libzmf::BMIParser::ColorBitmapHeader
Definition BMIParser.cpp:308
libzmf::ColorBitmap
Definition BMITypes.h:42
libzmf::Image
Definition ZMFTypes.h:204