1 /** 2 * Yudit Unicode Editor Source File 3 * 4 * GNU Copyright (C) 1997-2006 Gaspar Sinai <gaspar@yudit.org> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License, version 2, 8 * dated June 1991. See file COPYYING for details. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 #ifndef SPrinter_h 21 #define SPrinter_h 22 23 #include "swindow/SCanvas.h" 24 #include "swindow/SPrinter.h" 25 26 #include "stoolkit/SExcept.h" 27 #include "stoolkit/SString.h" 28 #include "stoolkit/SProperties.h" 29 #include "stoolkit/SIOStream.h" 30 #include "stoolkit/SMatrix.h" 31 32 /** 33 * @author: Gaspar Sinai <gaspar@yudit.org> 34 * @version: 2000-07-06 35 * This is a postscript renderer for yudit. 36 */ 37 class SPrinter : public SCanvas 38 { 39 public: 40 enum SMedia { A3, A4, A5, B4, B5, Executive, Folio, Ledger, 41 Legal, Letter, Quarto, Statement, Tabloid }; 42 enum SOrientation { PORTRAIT, LANDSCAPE }; 43 enum SType { POSTSCRIPT, PCL, WIN32 }; 44 45 SPrinter (const SWriter& writer, 46 SType=POSTSCRIPT, SMedia m=A4, SOrientation o=PORTRAIT); 47 SPrinter (const SPrinter& printer); 48 virtual ~SPrinter(); 49 50 unsigned int getWidth() const; 51 unsigned int getHeight() const; 52 int getX() const; 53 int getY() const; 54 SString getCreationDate() const; 55 56 bool open (bool background=false); 57 void newPage(); 58 bool cacheOn (bool on=true); 59 bool close (); 60 bool hasNative() const; 61 62 /* From SCanvas */ 63 virtual bool beginImage (double x, double y, const SString& id, const SColor& background); 64 virtual void newpath (); 65 virtual void endImage (); 66 virtual void fill (const SPen& pen); 67 virtual void stroke (const SPen& pen); 68 virtual void fill (); 69 virtual void stroke (); 70 71 virtual void moveto (double x, double y); 72 virtual void lineto (double x, double y); 73 virtual void curveto (double x0, double y0, double x1, 74 double y1, double x3, double y3); 75 virtual void closepath(); 76 virtual void pushmatrix(); 77 virtual void popmatrix(); 78 virtual void scale (double x, double y); 79 virtual void translate (double x, double y); 80 virtual void rotate (double angle); 81 virtual void bitfont (const SPen& pen, double x, double y, 82 void* native, char* data, unsigned int len); 83 84 virtual void bitfill (const SColor& bg, int x, int y, 85 unsigned int width, unsigned int height); 86 virtual void bitline (const SColor& fg, int x, int y, int tox, int toy); 87 virtual void bitpoint (const SColor& fg, int x, int y); 88 virtual void bitpoints (const SColor& fg, const int* x, const int* y, 89 unsigned int size); 90 private: 91 SType type; 92 SCanvas* delegate; 93 }; 94 95 #endif /* SPrinter_h */ 96