diff --git a/FL/Fl_SVG_File_Surface.H b/FL/Fl_SVG_File_Surface.H index 67d0aa4db..3599199d5 100644 --- a/FL/Fl_SVG_File_Surface.H +++ b/FL/Fl_SVG_File_Surface.H @@ -66,6 +66,7 @@ public: /** Returns the underlying FILE pointer */ FILE *file(); virtual void origin(int x, int y); + virtual void origin(int *x, int *y); virtual void translate(int x, int y); virtual void untranslate(); virtual int printable_rect(int *w, int *h); diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index 43e754130..547526ed3 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -575,7 +575,10 @@ Fl_Fontsize Fl_Graphics_Driver::size() {return size_; } double Fl_Graphics_Driver::width(const char *str, int nChars) { return 0; } /** Compute the width of Unicode character \p c if drawn with current font */ -double Fl_Graphics_Driver::width(unsigned int c) { char ch = (char)c; return width(&ch, 1); } +double Fl_Graphics_Driver::width(unsigned int c) { + char buf[4]; + return width(buf, fl_utf8encode (c, buf)); +} /** Return the current line height */ int Fl_Graphics_Driver::height() { return size(); } diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H index f5de05333..46dba5388 100644 --- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H +++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H @@ -50,8 +50,6 @@ public: int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); int not_clipped(int x, int y, int w, int h); void restore_clip(); - // --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx - //void transformed_vertex0(double x, double y); void transformed_vertex(double xf, double yf); void vertex(double x, double y); void begin_points(); @@ -67,21 +65,21 @@ public: void end_complex_polygon(); void fixloop(); void circle(double x, double y, double r); - // --- implementation is in src/fl_arc.cxx which includes src/cfg_gfx/xxx_arc.cxx if needed - // using void Fl_Graphics_Driver::arc(double x, double y, double r, double start, double end); - // --- implementation is in src/fl_arci.cxx which includes src/cfg_gfx/xxx_arci.cxx void arc(int x, int y, int w, int h, double a1, double a2); + void arc(double x, double y, double r, double start, double end); void pie(int x, int y, int w, int h, double a1, double a2); - // --- implementation is in src/fl_line_style.cxx which includes src/cfg_gfx/xxx_line_style.cxx void line_style(int style, int width=0, char* dashes=0); - // --- implementation is in src/fl_color.cxx which includes src/cfg_gfx/xxx_color.cxx void color(Fl_Color c); Fl_Color color() { return color_; } void color(uchar r, uchar g, uchar b); // --- implementation is in Fl_OpenGL_Graphics_Driver_font.cxx void font(Fl_Font face, Fl_Fontsize fsize); + Fl_Font font(); void draw(const char *str, int n, int x, int y); + void draw(const char *str, int n, float x, float y); + void draw(int angle, const char *str, int n, int x, int y); double width(const char *str, int n); + double width(unsigned int c); void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); int height(); int descent(); diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_arci.cxx b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_arci.cxx index ba5a7e7d7..f933d10e2 100644 --- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_arci.cxx +++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_arci.cxx @@ -46,6 +46,10 @@ void Fl_OpenGL_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2) glEnd(); } +void Fl_OpenGL_Graphics_Driver::arc(double x, double y, double r, double start, double end) { + Fl_Graphics_Driver::arc(x, y, r, start, end); +} + void Fl_OpenGL_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) { if (w <= 0 || h <= 0) return; while (a2draw(str, n, int(x), int(y)); +} + +void Fl_OpenGL_Graphics_Driver::draw(int angle, const char *str, int n, int x, int y) {} + void Fl_OpenGL_Graphics_Driver::draw(const char* str, int n, int x, int y) { Fl_Surface_Device::push_current(Fl_Display_Device::display_device()); gl_draw(str, n, x, y); @@ -190,6 +201,8 @@ double Fl_OpenGL_Graphics_Driver::width(const char *str, int n) { return w; } +double Fl_OpenGL_Graphics_Driver::width(unsigned int c) { return Fl_Graphics_Driver::width(c); } + int Fl_OpenGL_Graphics_Driver::descent() { Fl_Surface_Device::push_current(Fl_Display_Device::display_device()); int d = fl_descent(); diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx index a2d17ff3e..4ddd1f449 100644 --- a/src/drivers/PostScript/Fl_PostScript.cxx +++ b/src/drivers/PostScript/Fl_PostScript.cxx @@ -174,6 +174,8 @@ void Fl_PostScript_Graphics_Driver::font(int f, int s) { #endif } +Fl_Font Fl_PostScript_Graphics_Driver::font() { return Fl_Graphics_Driver:: font(); } + double Fl_PostScript_Graphics_Driver::width(const char *s, int n) { return Fl_Graphics_Driver::default_driver().width(s, n); } @@ -200,6 +202,8 @@ void Fl_PostScript_Graphics_Driver::color(Fl_Color c) { color(cr_, cg_, cb_); } +Fl_Color Fl_PostScript_Graphics_Driver::color() { return Fl_Graphics_Driver::color(); } + void Fl_PostScript_Graphics_Driver::point(int x, int y){ rectf(x,y,1,1); } diff --git a/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H b/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H index d41a0a55e..829e09d4a 100644 --- a/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H +++ b/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H @@ -133,6 +133,7 @@ public: // implementation of drawing methods void color(Fl_Color c); void color(uchar r, uchar g, uchar b); + Fl_Color color(); void push_clip(int x, int y, int w, int h); int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); @@ -191,6 +192,7 @@ public: void draw(int angle, const char *str, int n, int x, int y); void rtl_draw(const char* s, int n, int x, int y); void font(int face, int size); + Fl_Font font(); double width(const char *, int); double width(unsigned int u); void text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h); diff --git a/src/drivers/SVG/Fl_SVG_File_Surface.cxx b/src/drivers/SVG/Fl_SVG_File_Surface.cxx index c3aa3cea9..af63f221d 100644 --- a/src/drivers/SVG/Fl_SVG_File_Surface.cxx +++ b/src/drivers/SVG/Fl_SVG_File_Surface.cxx @@ -78,15 +78,19 @@ protected: void compute_dasharray(float s, char *dashes=0); void line_style(int style, int width, char *dashes=0); void line(int x1, int y1, int x2, int y2); + void line(int x1, int y1, int x2, int y2, int x3, int y3); void font_(int f, int s); void font(int f, int s); + Fl_Font font(); void draw(const char *str, int n, int x, int y); void draw(const char*, int, float, float) ; void draw(int, const char*, int, int, int) ; void rtl_draw(const char *str, int n, int x, int y); void color(uchar r, uchar g, uchar b); void color(Fl_Color c); - double width(const char*, int) ; + Fl_Color color(); + double width(const char*, int); + double width(unsigned int c); void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); int height() ; int descent() ; @@ -122,6 +126,7 @@ protected: void end_complex_polygon(); void circle(double x, double y,double r); void arc(int x,int y,int w,int h,double a1,double a2); + void arc(double x, double y, double r, double start, double end); void pie(int x,int y,int w,int h,double a1,double a2); void arc_pie(char AorP, int x, int y, int w, int h, double a1, double a2); }; @@ -179,6 +184,13 @@ void Fl_SVG_Graphics_Driver::line(int x1, int y1, int x2, int y2) { x1,y1,x2,y2, red_, green_, blue_, width_, linecap_, linejoin_, dasharray_); } +void Fl_SVG_Graphics_Driver::line(int x1, int y1, int x2, int y2, int x3, int y3) { + fprintf(out_, + "\n", + x1, y1, x2, y2, x3, y3, red_, green_, blue_, width_, linecap_, linejoin_, dasharray_); +} + void Fl_SVG_Graphics_Driver::font_(int ft, int s) { Fl_Graphics_Driver::font(ft, s); int famnum = ft/4; @@ -198,6 +210,8 @@ void Fl_SVG_Graphics_Driver::font(int ft, int s) { font_(ft, s); } +Fl_Font Fl_SVG_Graphics_Driver::font() { return Fl_Graphics_Driver::font(); } + void Fl_SVG_Graphics_Driver::compute_dasharray(float s, char *dashes) { if (user_dash_array_ && user_dash_array_ != dashes) {free(user_dash_array_); user_dash_array_ = NULL;} if (dashes && *dashes) { @@ -288,10 +302,16 @@ void Fl_SVG_Graphics_Driver::color(uchar r, uchar g, uchar b) { blue_ = b; } +Fl_Color Fl_SVG_Graphics_Driver::color() { return Fl_Graphics_Driver::color(); } + double Fl_SVG_Graphics_Driver::width(const char* str, int l) { return Fl_Display_Device::display_device()->driver()->width(str, l); } +double Fl_SVG_Graphics_Driver::width(unsigned int c) { + return Fl_Display_Device::display_device()->driver()->width(c); +} + void Fl_SVG_Graphics_Driver::text_extents(const char *c, int n, int& dx, int& dy, int& w, int& h) { Fl::first_window()->make_current(); // to get a valid drawing gc Fl_Display_Device::display_device()->driver()->text_extents(c, n, dx, dy, w, h); @@ -950,6 +970,10 @@ void Fl_SVG_Graphics_Driver::end_complex_polygon() { fprintf(out_, " z\" fill=\"rgb(%u,%u,%u)\" />\n", red_, green_, blue_); } +void Fl_SVG_Graphics_Driver::arc(double x, double y, double r, double start, double end) { + Fl_Graphics_Driver::arc(x, y, r, start, end); +} + void Fl_SVG_Graphics_Driver::arc(int x, int y, int w, int h, double a1, double a2) { arc_pie('A', x, y, w, h, a1, a2); } @@ -1018,3 +1042,5 @@ void Fl_SVG_File_Surface::untranslate() {} int Fl_SVG_File_Surface::printable_rect(int *w, int *h) {return 0;} #endif // FLTK_USE_SVG + +void Fl_SVG_File_Surface::origin(int *x, int *y) { Fl_Widget_Surface::origin(x, y);}