[master] a3cb4af - Class Fl_PostScript_Graphics_Driver: better separation of what varies with USE_PANGO

GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] a3cb4af - Class Fl_PostScript_Graphics_Driver: better separation of what varies with USE_PANGO "ManoloFLTK" 00:17 Mar 15 top right image
 
commit a3cb4af739f88e8470fe5d201ba6ddcebafe7657
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Mon Mar 15 08:13:09 2021 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Mon Mar 15 08:13:21 2021 +0100

    Class Fl_PostScript_Graphics_Driver: better separation of what varies with USE_PANGO

 src/drivers/PostScript/Fl_PostScript.cxx           |  4 +-
 .../PostScript/Fl_PostScript_Graphics_Driver.H     | 58 +++++++++++-----------
 src/drivers/PostScript/Fl_PostScript_image.cxx     |  2 +-
 3 files changed, 33 insertions(+), 31 deletions(-)

diff --git src/drivers/PostScript/Fl_PostScript.cxx src/drivers/PostScript/Fl_PostScript.cxx
index 4ddd1f4..53811d6 100644
--- src/drivers/PostScript/Fl_PostScript.cxx
+++ src/drivers/PostScript/Fl_PostScript.cxx
@@ -125,7 +125,9 @@ Fl_PostScript_Graphics_Driver::Fl_PostScript_Graphics_Driver(void)
   close_cmd_ = 0;
   //lang_level_ = 3;
   lang_level_ = 2;
+#if ! USE_PANGO
   mask = 0;
+#endif
   ps_filename_ = NULL;
   scale_x = scale_y = 1.;
   bg_r = bg_g = bg_b = 255;
@@ -1441,7 +1443,7 @@ void Fl_PostScript_Graphics_Driver::ps_untranslate(void)
   fprintf(output, "GR GR\n");
 }
 
-# else
+# else // USE_PANGO
 
 /* Cairo-based implementation of the PostScript graphics driver */
 
diff --git src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H
index 829e09d..80019fd 100644
--- src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H
+++ src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H
@@ -60,11 +60,13 @@ private:
   int scale_for_image_(Fl_Image *img, int XP, int YP, int WP, int HP,int cx, int cy);
 #endif
 protected:
+#if ! USE_PANGO
   uchar **mask_bitmap() {return &mask;}
+#endif
 public:
   Fl_PostScript_Graphics_Driver();
 #ifndef FL_DOXYGEN
-  enum SHAPE{NONE=0, LINE, LOOP, POLYGON, POINTS};
+  enum SHAPE {NONE=0, LINE, LOOP, POLYGON, POINTS};
 
   class Clip {
   public:
@@ -76,11 +78,31 @@ public:
   int lang_level_;
   int gap_;
   int pages_;
+#if USE_PANGO
+  cairo_t *cr() { return cairo_; }
+  PangoLayout *pango_layout() {return pango_layout_;};
+  void check_status(void);
+#else
+  int interpolate_; //interpolation of images
+  uchar * mask;
+  int mx; // width of mask;
+  int my; // mask lines
+  int page_policy_;
+  void page_policy(int p);
+  int page_policy(){return page_policy_;};
+  int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
+  /** Shields output PostScript data from modifications of the current locale.
+   It typically avoids PostScript errors caused if the current locale uses comma instead of dot
+   as "decimal point".
+   \param format  directives controlling output PostScript data
+   \return value returned by vfprintf() call
+   */
+  int clocale_printf(const char *format, ...);
+#endif // USE_PANGO
 
-  int shape_;
+  enum SHAPE shape_;
   int linewidth_;// need for clipping, lang level 1-2
   int linestyle_;//
-  int interpolate_; //interpolation of images
   unsigned char cr_,cg_,cb_;
   char  linedash_[256];//should be enough
   void concat();  // transform ror scalable dradings...
@@ -88,13 +110,9 @@ public:
   void recover(); //recovers the state after grestore (such as line styles...)
   void reset();
 
-  uchar * mask;
-  int mx; // width of mask;
-  int my; // mask lines
   Fl_PostScript_Close_Command close_cmd_;
-  int page_policy_;
   int nPages;
-  int orientation_;
+  //int orientation_;
 
   float scale_x;
   float scale_y;
@@ -108,23 +126,18 @@ public:
   uchar bg_r, bg_g, bg_b;
   int start_postscript (int pagecount, enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout);
   int start_eps(int width, int height);
-  /*  int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
-   */
   void transformed_draw(const char* s, int n, double x, double y); //precise text placing
-  void transformed_draw(const char* s, double x, double y);
-  int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
+  //void transformed_draw(const char* s, double x, double y);
 
   enum Fl_Paged_Device::Page_Format page_format_;
   char *ps_filename_;
 
-  void page_policy(int p);
-  int page_policy(){return page_policy_;};
   void close_command(Fl_PostScript_Close_Command cmd){close_cmd_=cmd;};
   FILE * file() {return output;};
   //void orientation (int o);
   //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor
-  void interpolate(int i){interpolate_=i;};
-  int interpolate(){return interpolate_;}
+  //void interpolate(int i){interpolate_=i;};
+  //int interpolate(){return interpolate_;}
 
   void page(double pw, double ph, int media = 0);
   void page(int format);
@@ -201,19 +214,6 @@ public:
   void draw_pixmap(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
   void draw_bitmap(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy);
   void draw_rgb(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
-#if USE_PANGO
-  cairo_t *cr() { return cairo_; }
-  PangoLayout *pango_layout() {return pango_layout_;};
-  void check_status(void);
-#else
-  /** Shields output PostScript data from modifications of the current locale.
-   It typically avoids PostScript errors caused if the current locale uses comma instead of dot
-   as "decimal point".
-   \param format  directives controlling output PostScript data
-   \return value returned by vfprintf() call
-   */
-  int clocale_printf(const char *format, ...);
-#endif
   ~Fl_PostScript_Graphics_Driver();
   // ---
   Fl_Bitmask create_bitmask(int w, int h, const uchar *array) { return 0L; }
diff --git src/drivers/PostScript/Fl_PostScript_image.cxx src/drivers/PostScript/Fl_PostScript_image.cxx
index 13976b2..102c1d4 100644
--- src/drivers/PostScript/Fl_PostScript_image.cxx
+++ src/drivers/PostScript/Fl_PostScript_image.cxx
@@ -635,7 +635,7 @@ int Fl_PostScript_Graphics_Driver::scale_for_image_(Fl_Image *img, int XP, int Y
   return 0;
 }
 
-#else
+#else // USE_PANGO
 
 void Fl_PostScript_Graphics_Driver::draw_image(Fl_Draw_Image_Cb call, void *data, int ix, int iy, int iw, int ih, int D)
 {
Direct Link to Message ]
 
bottom left image   bottom right image
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2021 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.