00001 /* libwpg 00002 * Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) 00003 * Copyright (C) 2005 Fridrich Strba (fridrich.strba@bluewin.ch) 00004 * Copyright (C) 2004 Marc Oude Kotte (marc@solcon.nl) 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Library General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Library General Public 00017 * License along with this library; if not, write to the 00018 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02111-1301 USA 00020 * 00021 * For further information visit http://libwpg.sourceforge.net 00022 */ 00023 00024 /* "This product is not manufactured, approved, or supported by 00025 * Corel Corporation or Corel Corporation Limited." 00026 */ 00027 00028 #ifndef __WPG1PARSER_H__ 00029 #define __WPG1PARSER_H__ 00030 00031 #include "WPGXParser.h" 00032 #include "WPGBrush.h" 00033 #include "WPGPen.h" 00034 #include <vector> 00035 00036 class WPG1Parser : public WPGXParser 00037 { 00038 public: 00039 WPG1Parser(WPXInputStream *input, libwpg::WPGPaintInterface* painter); 00040 bool parse(); 00041 00042 private: 00043 void handleStartWPG(); 00044 void handleEndWPG(); 00045 00046 void handleFillAttributes(); 00047 void handleLineAttributes(); 00048 void handleColormap(); 00049 00050 void handleLine(); 00051 void handlePolyline(); 00052 void handleRectangle(); 00053 void handlePolygon(); 00054 void handleEllipse(); 00055 00056 void handleCurvedPolyline(); 00057 00058 void decodeRLE(std::vector<unsigned char>& buffer, unsigned width, unsigned height, unsigned depth); 00059 void fillPixels(libwpg::WPGBitmap& bitmap, const unsigned char* buffer, unsigned width, unsigned height, unsigned depth); 00060 void handleBitmapTypeOne(); 00061 void handleBitmapTypeTwo(); 00062 void handlePostscriptTypeOne(); 00063 void handlePostscriptTypeTwo(); 00064 00065 void resetPalette(); 00066 00067 // parsing context 00068 int m_recordLength; 00069 long m_recordEnd; 00070 bool m_success; 00071 bool m_exit; 00072 bool m_graphicsStarted; 00073 int m_width; 00074 int m_height; 00075 libwpg::WPGPen m_pen; 00076 libwpg::WPGBrush m_brush; 00077 }; 00078 00079 #endif // __WPG1PARSER_H__