![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * D e v i c e C o n t e x t F o r P r i n t i n g * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2009 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU Lesser General Public License as published by * 00010 * the Free Software Foundation; either version 3 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public License * 00019 * along with this program. If not, see <http://www.gnu.org/licenses/> * 00020 ********************************************************************************* 00021 * $Id: FXDCPrint.h,v 1.36 2009/01/06 13:07:22 fox Exp $ * 00022 ********************************************************************************/ 00023 #ifndef FXDCPRINT_H 00024 #define FXDCPRINT_H 00025 00026 #ifndef FXDC_H 00027 #include "FXDC.h" 00028 #endif 00029 00030 ////////////////////////////// UNDER DEVELOPMENT ////////////////////////////// 00031 00032 namespace FX { 00033 00034 class FXApp; 00035 class FXDrawable; 00036 class FXImage; 00037 class FXBitmap; 00038 class FXIcon; 00039 class FXFont; 00040 00041 00042 /// Printer flags 00043 enum FXPrintFlags { 00044 PRINT_DEST_PAPER = 0, /// Send print to paper 00045 PRINT_DEST_FILE = 1, /// Send print to file 00046 PRINT_PAGES_ALL = 0, /// Print all pages 00047 PRINT_PAGES_EVEN = 2, /// Print even pages only 00048 PRINT_PAGES_ODD = 4, /// Print odd pages only 00049 PRINT_PAGES_RANGE = 8, /// Print range of pages 00050 PRINT_COLLATE_NORMAL = 0, /// Normal collate order 00051 PRINT_COLLATE_REVERSED = 16, /// Reversed collate order 00052 PRINT_PORTRAIT = 0, /// Portrait orientation 00053 PRINT_LANDSCAPE = 32, /// Landscape orientation 00054 PRINT_BLACKANDWHITE = 0, /// Black and white output 00055 PRINT_COLOR = 64, /// Color output 00056 PRINT_NOBOUNDS = 128 /// Must determine bounding box 00057 }; 00058 00059 00060 /// Printer media size 00061 enum FXMediaSize { 00062 MEDIA_CUSTOM = 0, /// Custom paper size 00063 MEDIA_USLETTER = 1, /// US Letter size 00064 MEDIA_LEGAL = 2, /// US Legal size 00065 MEDIA_A4 = 3, /// A4 00066 MEDIA_ENVELOPE = 4 /// #10 Envelope 00067 }; 00068 00069 00070 /// Bounding box 00071 struct FXPSBounds { 00072 FXdouble xmin; 00073 FXdouble xmax; 00074 FXdouble ymin; 00075 FXdouble ymax; 00076 }; 00077 00078 00079 /// Describes printer 00080 struct FXAPI FXPrinter { 00081 FXString name; /// Printer name 00082 FXuint firstpage; /// First page that can be printed 00083 FXuint lastpage; /// Last page that can be printed 00084 FXuint currentpage; /// Current page to print 00085 FXuint frompage; /// On output, this is the first page to print 00086 FXuint topage; /// On output, last page to print 00087 FXuint mediasize; /// Media size index 00088 FXdouble mediawidth; /// Width of paper in points [1/72 of an inch] 00089 FXdouble mediaheight; /// Height of paper in points 00090 FXdouble leftmargin; /// Left margin 00091 FXdouble rightmargin; /// Right margin 00092 FXdouble topmargin; /// Top margin 00093 FXdouble bottommargin; /// Bottom margin 00094 FXuint numcopies; /// Number of copies 00095 FXuint flags; /// Flags 00096 }; 00097 00098 00099 /// Postscript Printer Device Context 00100 class FXAPI FXDCPrint : public FXDC { 00101 // friend class FXGLViewer; // This is TEMPORARY!!! 00102 protected: 00103 void *psout; // File Stream for PS output 00104 FXFont *font; 00105 FXuint flags; 00106 FXint Xr,Yr; 00107 FXdouble mediawidth; // Media width 00108 FXdouble mediaheight; // Media height 00109 FXPSBounds mediabb; // Media bounding box 00110 FXPSBounds docbb; // Document bounding box 00111 FXPSBounds pagebb; // Page bounding box 00112 FXint pagecount; // Number of pages printed 00113 FXint nchars; // Number of characters on a line 00114 FXint pxmin; // min X coord in content 00115 FXint pymin; // min Y coord in content 00116 FXint pxmax; // max X coord in content 00117 FXint pymax; // max Y coord in content 00118 protected: 00119 void bbox(FXfloat x,FXfloat y); 00120 void tfm(FXfloat& xo,FXfloat& yo,FXfloat xi,FXfloat yi); 00121 private: 00122 FXDCPrint(); 00123 FXDCPrint(const FXDCPrint&); 00124 FXDCPrint &operator=(const FXDCPrint&); 00125 public: 00126 00127 /// Construct 00128 FXDCPrint(FXApp* a); 00129 00130 /// Generate print job prolog 00131 FXbool beginPrint(FXPrinter& job); 00132 00133 /// Generate print job epilog 00134 FXbool endPrint(); 00135 00136 /// Generate begin of page 00137 FXbool beginPage(FXuint page=1); 00138 00139 /// Generate end of page 00140 FXbool endPage(); 00141 00142 FXbool setContentRange(FXint pxmin,FXint pymin,FXint pxmax,FXint pymax); 00143 00144 /// Draw points 00145 virtual void drawPoint(FXint x,FXint y); 00146 virtual void drawPoints(const FXPoint* points,FXuint npoints); 00147 virtual void drawPointsRel(const FXPoint* points,FXuint npoints); 00148 00149 /// Draw lines 00150 virtual void drawLine(FXint x1,FXint y1,FXint x2,FXint y2); 00151 virtual void drawLines(const FXPoint* points,FXuint npoints); 00152 virtual void drawLinesRel(const FXPoint* points,FXuint npoints); 00153 virtual void drawLineSegments(const FXSegment* segments,FXuint nsegments); 00154 00155 /// Draw rectangles 00156 virtual void drawRectangle(FXint x,FXint y,FXint w,FXint h); 00157 virtual void drawRectangles(const FXRectangle* rectangles,FXuint nrectangles); 00158 00159 /// Draw rounded rectangle with ellipse with ew and ellips height eh 00160 virtual void drawRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh); 00161 00162 /// Draw arcs 00163 virtual void drawArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2); 00164 virtual void drawArcs(const FXArc* arcs,FXuint narcs); 00165 00166 /// Draw ellipse 00167 virtual void drawEllipse(FXint x,FXint y,FXint w,FXint h); 00168 00169 /// Filled rectangles 00170 virtual void fillRectangle(FXint x,FXint y,FXint w,FXint h); 00171 virtual void fillRectangles(const FXRectangle* rectangles,FXuint nrectangles); 00172 00173 /// Filled rounded rectangle with ellipse with ew and ellips height eh 00174 virtual void fillRoundRectangle(FXint x,FXint y,FXint w,FXint h,FXint ew,FXint eh); 00175 00176 /// Fill chord 00177 virtual void fillChord(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2); 00178 virtual void fillChords(const FXArc* chords,FXuint nchords); 00179 00180 /// Draw arcs 00181 virtual void fillArc(FXint x,FXint y,FXint w,FXint h,FXint ang1,FXint ang2); 00182 virtual void fillArcs(const FXArc* arcs,FXuint narcs); 00183 00184 /// Fill ellipse 00185 virtual void fillEllipse(FXint x,FXint y,FXint w,FXint h); 00186 00187 /// Filled polygon 00188 virtual void fillPolygon(const FXPoint* points,FXuint npoints); 00189 virtual void fillConcavePolygon(const FXPoint* points,FXuint npoints); 00190 virtual void fillComplexPolygon(const FXPoint* points,FXuint npoints); 00191 00192 /// Filled polygon with relative points 00193 virtual void fillPolygonRel(const FXPoint* points,FXuint npoints); 00194 virtual void fillConcavePolygonRel(const FXPoint* points,FXuint npoints); 00195 virtual void fillComplexPolygonRel(const FXPoint* points,FXuint npoints); 00196 00197 /// Draw hashed box 00198 virtual void drawHashBox(FXint x,FXint y,FXint w,FXint h,FXint b=1); 00199 00200 /// Draw area from source 00201 virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy); 00202 00203 /// Draw area stretched area from source 00204 virtual void drawArea(const FXDrawable* source,FXint sx,FXint sy,FXint sw,FXint sh,FXint dx,FXint dy,FXint dw,FXint dh); 00205 00206 /// Draw image 00207 virtual void drawImage(const FXImage* image,FXint dx,FXint dy); 00208 00209 /// Draw bitmap 00210 virtual void drawBitmap(const FXBitmap* bitmap,FXint dx,FXint dy); 00211 00212 /// Draw icon 00213 virtual void drawIcon(const FXIcon* icon,FXint dx,FXint dy); 00214 virtual void drawIconShaded(const FXIcon* icon,FXint dx,FXint dy); 00215 virtual void drawIconSunken(const FXIcon* icon,FXint dx,FXint dy); 00216 00217 /// Draw string with base line starting at x, y 00218 virtual void drawText(FXint x,FXint y,const FXString& string); 00219 virtual void drawText(FXint x,FXint y,const FXchar* string,FXuint length); 00220 00221 /// Draw text starting at x, y over filled background 00222 virtual void drawImageText(FXint x,FXint y,const FXString& string); 00223 virtual void drawImageText(FXint x,FXint y,const FXchar* string,FXuint length); 00224 00225 /// Set foreground/background drawing color 00226 virtual void setForeground(FXColor clr); 00227 virtual void setBackground(FXColor clr); 00228 00229 /// Set dash pattern 00230 virtual void setDashes(FXuint dashoffset,const FXchar *dashlist,FXuint n); 00231 00232 /// Set line width 00233 virtual void setLineWidth(FXuint linewidth=0); 00234 00235 /// Set line cap style 00236 virtual void setLineCap(FXCapStyle capstyle=CAP_BUTT); 00237 00238 /// Set line join style 00239 virtual void setLineJoin(FXJoinStyle joinstyle=JOIN_MITER); 00240 00241 /// Set line style 00242 virtual void setLineStyle(FXLineStyle linestyle=LINE_SOLID); 00243 00244 /// Set fill style 00245 virtual void setFillStyle(FXFillStyle fillstyle=FILL_SOLID); 00246 00247 /// Set fill rule 00248 virtual void setFillRule(FXFillRule fillrule=RULE_EVEN_ODD); 00249 00250 /// Set blit function 00251 virtual void setFunction(FXFunction func=BLT_SRC); 00252 00253 /// Set the tile 00254 virtual void setTile(FXImage* tile,FXint dx=0,FXint dy=0); 00255 00256 /// Set the stipple pattern 00257 virtual void setStipple(FXBitmap *stipple,FXint dx=0,FXint dy=0); 00258 00259 /// Set the stipple pattern 00260 virtual void setStipple(FXStipplePattern stipple,FXint dx=0,FXint dy=0); 00261 00262 /// Set clip rectangle 00263 virtual void setClipRectangle(FXint x,FXint y,FXint w,FXint h); 00264 00265 /// Set clip rectangle 00266 virtual void setClipRectangle(const FXRectangle& rectangle); 00267 00268 /// Clear clipping 00269 virtual void clearClipRectangle(); 00270 00271 /// Set clip mask 00272 virtual void setClipMask(FXBitmap* mask,FXint dx=0,FXint dy=0); 00273 00274 /// Clear clip mask 00275 virtual void clearClipMask(); 00276 00277 /// Set font to draw text with 00278 virtual void setFont(FXFont *fnt); 00279 00280 /// Clip drawing by child windows 00281 virtual void clipChildren(FXbool yes); 00282 00283 /// Temporarily public; do not rely on this!! 00284 void outhex(FXuint hex); 00285 void outf(const char* format,...); 00286 00287 /// Cleanup 00288 virtual ~FXDCPrint(); 00289 }; 00290 00291 } 00292 00293 #endif
![]() |