"Fossies" - the Fresh Open Source Software archive

Member "fltk-1.3.2/documentation/html/Fl__PostScript_8H_source.html" (9 Dec 2012, 47764 Bytes) of archive /linux/misc/fltk-1.3.2-docs-html.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. Alternatively you can here view or download the uninterpreted source code. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.

FLTK 1.3.2
Fl_PostScript.H
Go to the documentation of this file.
00001 //
00002 // "$Id: Fl_PostScript.H 9683 2012-09-20 11:23:38Z manolo $"
00003 //
00004 // Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK).
00005 //
00006 // Copyright 2010-2011 by Bill Spitzak and others.
00007 //
00008 // This library is free software. Distribution and use rights are outlined in
00009 // the file "COPYING" which should have been included with this file.  If this
00010 // file is missing or damaged, see the license at:
00011 //
00012 //     http://www.fltk.org/COPYING.php
00013 //
00014 // Please report all bugs and problems on the following page:
00015 //
00016 //     http://www.fltk.org/str.php
00017 //
00018 
00023 #ifndef Fl_PostScript_H
00024 #define Fl_PostScript_H
00025 
00026 #include <FL/Fl_Paged_Device.H>
00027 #include <FL/fl_draw.H>
00028 
00055 class FL_EXPORT Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver {
00056 public: 
00057   static const char *class_id;
00058   const char *class_name() {return class_id;};
00059   Fl_PostScript_Graphics_Driver();
00060 #ifndef FL_DOXYGEN
00061   enum SHAPE{NONE=0, LINE, LOOP, POLYGON, POINTS};
00062   
00063 class Clip {
00064   public:
00065     int x, y, w, h;
00066     Clip *prev;
00067   };
00068   Clip * clip_;
00069   
00070   int lang_level_;
00071   int gap_;
00072   int pages_;
00073   
00074   double width_;
00075   double height_;
00076   
00077   int shape_;
00078   int linewidth_;// need for clipping, lang level 1-2
00079   int linestyle_;//
00080   int interpolate_; //interpolation of images
00081   unsigned char cr_,cg_,cb_;
00082   char  linedash_[256];//should be enough
00083   void concat();  // transform ror scalable dradings...
00084   void reconcat(); //invert
00085   void recover(); //recovers the state after grestore (such as line styles...)
00086   void reset();
00087   
00088   uchar * mask;
00089   int mx; // width of mask;
00090   int my; // mask lines
00091   //Fl_Color bg_;
00092   int (*close_cmd_)(FILE *);
00093   int page_policy_;
00094   int nPages;
00095   int orientation_;
00096   
00097   float scale_x;
00098   float scale_y;
00099   float angle;
00100   int left_margin;
00101   int top_margin;
00102  
00103   FILE *output;
00104   double pw_, ph_;
00105   
00106   uchar bg_r, bg_g, bg_b;
00107   int start_postscript (int pagecount, enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout);
00108   /*  int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
00109    */
00110   void transformed_draw(const char* s, int n, double x, double y); //precise text placing
00111   void transformed_draw(const char* s, double x, double y);
00112   int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
00113   
00114   enum Fl_Paged_Device::Page_Format page_format_;
00115   char *ps_filename_;
00116  
00117   void page_policy(int p);
00118   int page_policy(){return page_policy_;};
00119   void close_command( int (*cmd)(FILE *)){close_cmd_=cmd;};
00120   FILE * file() {return output;};
00121   //void orientation (int o);
00122   //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor
00123   //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int x, int y, int w, int h); //eps constructor
00124   void interpolate(int i){interpolate_=i;};
00125   int interpolate(){return interpolate_;}
00126   
00127   void page(double pw, double ph, int media = 0);
00128   void page(int format);
00129 #endif // FL_DOXYGEN
00130   
00131   // implementation of drawing methods
00132   void color(Fl_Color c);
00133   void color(uchar r, uchar g, uchar b);
00134   
00135   void push_clip(int x, int y, int w, int h);
00136   int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
00137   int not_clipped(int x, int y, int w, int h);
00138   void push_no_clip();
00139   void pop_clip();
00140   
00141   void line_style(int style, int width=0, char* dashes=0);
00142   
00143   void rect(int x, int y, int w, int h);
00144   void rectf(int x, int y, int w, int h);
00145   
00146   void xyline(int x, int y, int x1);
00147   void xyline(int x, int y, int x1, int y2);
00148   void xyline(int x, int y, int x1, int y2, int x3);
00149   
00150   void yxline(int x, int y, int y1);
00151   void yxline(int x, int y, int y1, int x2);
00152   void yxline(int x, int y, int y1, int x2, int y3);
00153   
00154   void line(int x1, int y1, int x2, int y2);
00155   void line(int x1, int y1, int x2, int y2, int x3, int y3);  
00156   
00157   void loop(int x0, int y0, int x1, int y1, int x2, int y2);
00158   void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
00159   void polygon(int x0, int y0, int x1, int y1, int x2, int y2);
00160   void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3);
00161   void point(int x, int y);
00162   
00163   void begin_points();
00164   void begin_line();
00165   void begin_loop();
00166   void begin_polygon();
00167   void vertex(double x, double y);
00168   void curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3);
00169   void circle(double x, double y, double r);
00170   void arc(double x, double y, double r, double start, double a);
00171   void arc(int x, int y, int w, int h, double a1, double a2);
00172   void pie(int x, int y, int w, int h, double a1, double a2);
00173   void end_points();
00174   void end_line();
00175   void end_loop();
00176   void end_polygon();
00177   void begin_complex_polygon(){begin_polygon();};
00178   void gap(){gap_=1;};
00179   void end_complex_polygon(){end_polygon();};
00180   void transformed_vertex(double x, double y);
00181     
00182   void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0);
00183   void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0);
00184   void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3);
00185   void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1);
00186       
00187   void draw(const char* s, int nBytes, int x, int y) {transformed_draw(s,nBytes,x,y); };
00188 #ifdef __APPLE__
00189   void draw(const char* s, int nBytes, float x, float y) {transformed_draw(s,nBytes,x,y); };
00190 #endif
00191   void draw(int angle, const char *str, int n, int x, int y);
00192   void rtl_draw(const char* s, int n, int x, int y);
00193   void font(int face, int size);
00194   double width(const char *, int);
00195   void text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h);
00196   int height();
00197   int descent();
00198   void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
00199   void draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy);
00200   void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
00201   ~Fl_PostScript_Graphics_Driver();
00202 };
00203 
00207 class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device {
00208 #ifdef __APPLE__
00209   CGContextRef gc;
00210 #endif
00211 protected:
00212   Fl_PostScript_Graphics_Driver *driver();
00213 public:
00214   static const char *class_id;
00215   const char *class_name() {return class_id;};
00216   Fl_PostScript_File_Device();
00217   ~Fl_PostScript_File_Device();
00218   int start_job(int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4, 
00219                 enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
00220   int start_job(FILE *ps_output, int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4, 
00221                 enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
00222   int start_page (void);
00223   int printable_rect(int *w, int *h);
00224   void margins(int *left, int *top, int *right, int *bottom);
00225   void origin(int *x, int *y);
00226   void origin(int x, int y);
00227   void scale (float scale_x, float scale_y = 0.);
00228   void rotate(float angle);
00229   void translate(int x, int y);
00230   void untranslate(void);
00231   int end_page (void);    
00232   void end_job(void);
00233 #ifdef __APPLE__
00234   void set_current() { fl_gc = gc; Fl_Paged_Device::set_current(); }
00235 #endif
00236   
00237   static const char *file_chooser_title; 
00238 };
00239 
00240 #endif // Fl_PostScript_H
00241 
00242 //
00243 // End of "$Id: Fl_PostScript.H 9683 2012-09-20 11:23:38Z manolo $"
00244 //