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 00035 class WPG1Parser : public WPGXParser 00036 { 00037 public: 00038 WPG1Parser(WPXInputStream *input, libwpg::WPGPaintInterface* painter); 00039 bool parse(); 00040 00041 private: 00042 void handleStartWPG(); 00043 void handleEndWPG(); 00044 00045 void handleFillAttributes(); 00046 void handleLineAttributes(); 00047 void handleColormap(); 00048 00049 void handleLine(); 00050 void handlePolyline(); 00051 void handleRectangle(); 00052 void handlePolygon(); 00053 void handleEllipse(); 00054 00055 unsigned char* decodeRLE(int width, int height, int depth); 00056 void fillPixels(libwpg::WPGBitmap& bitmap, unsigned char* buffer, int width, int height, int depth); 00057 void handleBitmapTypeOne(); 00058 void handleBitmapTypeTwo(); 00059 00060 void resetPalette(); 00061 00062 // parsing context 00063 int m_recordLength; 00064 long m_recordEnd; 00065 bool m_success; 00066 bool m_exit; 00067 bool m_graphicsStarted; 00068 int m_width; 00069 int m_height; 00070 libwpg::WPGPen m_pen; 00071 libwpg::WPGBrush m_brush; 00072 }; 00073 00074 #endif // __WPG1PARSER_H__