Class Fl_PostScript_Graphics_Driver: better separation of what varies with USE_PANGO

This commit is contained in:
ManoloFLTK 2021-03-15 08:13:09 +01:00
parent ce142e80df
commit a3cb4af739
3 changed files with 33 additions and 31 deletions

View File

@ -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 */

View File

@ -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; }

View File

@ -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)
{