BMIParser.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is a part of the libzmf project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef BMIPARSER_H_INCLUDED
00011 #define BMIPARSER_H_INCLUDED
00012 
00013 #include <librevenge/librevenge.h>
00014 
00015 #include "libzmf_utils.h"
00016 
00017 #include "BMIHeader.h"
00018 #include "ZMFTypes.h"
00019 
00020 namespace libzmf
00021 {
00022 
00023 class BMIParser
00024 {
00025   // disable copying
00026   BMIParser(const BMIParser &other);
00027   BMIParser &operator=(const BMIParser &other);
00028 
00029 public:
00030   explicit BMIParser(const RVNGInputStreamPtr &input, librevenge::RVNGDrawingInterface *painter = 0);
00031 
00034   bool parse();
00035 
00038   Image readImage();
00039 
00040   const BMIHeader &header() const;
00041 
00042 private:
00043   ColorBitmap readColorBitmap(BMIOffset offset);
00044 
00045   std::vector<uint8_t> readData(unsigned endOffset);
00046 
00047   std::vector<Color> readColorPalette(unsigned colorDepth);
00048 
00049   const RVNGInputStreamPtr m_input;
00050   librevenge::RVNGDrawingInterface *m_painter;
00051 
00052   BMIHeader m_header;
00053 };
00054 
00055 }
00056 
00057 #endif // BMIPARSER_H_INCLUDED
00058 
00059 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */