1 /* 2 * pbmimage.h (C) 2006, Aurélien Croc (AP²C) 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; version 2 of the License. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program; if not, write to the 15 * Free Software Foundation, Inc., 16 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 * 18 * $Id$ 19 * 20 */ 21 #ifndef PBMIMAGE_H_ 22 #define PBMIMAGE_H_ 23 24 #include <inttypes.h> 25 #include <stdio.h> 26 #include "printer.h" 27 #include "document.h" 28 29 class PbmImage : public Document 30 { 31 protected: 32 const char* _blackFile; 33 const char* _cyanFile; 34 const char* _magentaFile; 35 const char* _yellowFile; 36 FILE* _black; 37 FILE* _cyan; 38 FILE* _magenta; 39 FILE* _yellow; 40 41 uint32_t _width; 42 uint32_t _height; 43 uint32_t _lineSize; 44 uint32_t _line; 45 unsigned char* _lineBuffer; 46 47 bool _color; 48 uint8_t _currentColor; 49 50 public: 51 PbmImage(const char *black, const char *cyan, 52 const char *magenta, const char *yellow); 53 virtual ~PbmImage(); 54 55 public: 56 virtual void unload(); 57 virtual int load(); 58 virtual int loadPage(Printer *printer); 59 virtual int readLine(); 60 61 public: width()62 virtual unsigned long width() const {return _width;} height()63 virtual unsigned long height() const {return _height;} lineSize()64 virtual unsigned long lineSize() const {return _lineSize;} lineBuffer()65 virtual unsigned char* lineBuffer() const {return _lineBuffer;} page()66 virtual unsigned long page() const {return 1;} 67 68 public: isColor()69 virtual bool isColor() const {return _color;} 70 }; 71 72 #endif /* DOCUMENT_H_ */ 73 74 /* vim: set expandtab tabstop=4 shiftwidth=4 smarttab tw=80 cin enc=utf8: */ 75 76