Scribus
Open source desktop publishing at your fingertips
WPG1Parser.h
1 /* libwpg
2  * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
3  * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch)
4  * Copyright (C) 2004 Marc Oude Kotte (marc@solcon.nl)
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02111-1301 USA
20  *
21  * For further information visit http://libwpg.sourceforge.net
22  */
23 
24 /* "This product is not manufactured, approved, or supported by
25  * Corel Corporation or Corel Corporation Limited."
26  */
27 
28 #ifndef __WPG1PARSER_H__
29 #define __WPG1PARSER_H__
30 
31 #include "WPGXParser.h"
32 #include "WPGBrush.h"
33 #include "WPGPen.h"
34 #include <vector>
35 
36 class WPG1Parser : public WPGXParser
37 {
38 public:
40  bool parse();
41 
42 private:
43  void handleStartWPG();
44  void handleEndWPG();
45 
46  void handleFillAttributes();
47  void handleLineAttributes();
48  void handleColormap();
49 
50  void handleLine();
51  void handlePolyline();
52  void handleRectangle();
53  void handlePolygon();
54  void handleEllipse();
55 
56  void handleCurvedPolyline();
57 
58  void decodeRLE(std::vector<unsigned char>& buffer, unsigned width, unsigned height, unsigned depth);
59  void fillPixels(libwpg::WPGBitmap& bitmap, const unsigned char* buffer, unsigned width, unsigned height, unsigned depth);
60  void handleBitmapTypeOne();
61  void handleBitmapTypeTwo();
62  void handlePostscriptTypeOne();
63  void handlePostscriptTypeTwo();
64 
65  void resetPalette();
66 
67  // parsing context
68  int m_recordLength;
69  long m_recordEnd;
70  bool m_success;
71  bool m_exit;
72  bool m_graphicsStarted;
73  int m_width;
74  int m_height;
75  libwpg::WPGPen m_pen;
76  libwpg::WPGBrush m_brush;
77 };
78 
79 #endif // __WPG1PARSER_H__
Definition: WPGXParser.h:37
Definition: WPGBitmap.h:37
Definition: WPXStream.h:36
Definition: WPGPaintInterface.h:41
Definition: WPG1Parser.h:36
Definition: WPGBrush.h:35
Definition: WPGPen.h:51
Binary buffer.
Definition: pdbim.h:93