From b027d2ba57a8e0d6f0862e0a891ddd5dee4b02e2 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Fri, 26 Feb 2021 18:00:07 +0100 Subject: Windows platform: use GDI+ to antialias oblique lines and curves. --- src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/drivers/GDI/Fl_GDI_Graphics_Driver.H') diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index 76d9c5c01..824ad2fa7 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -26,6 +26,16 @@ #include #include #include +#include + +#if USE_GDIPLUS +# if defined(_MSC_VER) +# include +# else +# include // for PROPID needed with gcc 4.9.0 but not with 4.9.3 +# endif +# include +#endif /** \brief The Windows-specific graphics driver class. @@ -164,5 +174,42 @@ public: void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen bitmap, int srcx, int srcy); }; +#if USE_GDIPLUS + +class Fl_GDIplus_Graphics_Driver : public Fl_GDI_Graphics_Driver { +private: + Gdiplus::Color gdiplus_color_; + Gdiplus::Pen *pen_; + Gdiplus::SolidBrush *brush_; +public: + Fl_GDIplus_Graphics_Driver(); + virtual ~Fl_GDIplus_Graphics_Driver(); + bool active; + static void shutdown(void); +virtual void color(Fl_Color c); +virtual Fl_Color color() { return color_; } +virtual void color(uchar r, uchar g, uchar b); + virtual void line(int x, int y, int x1, int y1); + virtual void line(int x, int y, int x1, int y1, int x2, int y2); + void loop(int x0, int y0, int x1, int y1, int x2, int y2); + void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); + void polygon(int x0, int y0, int x1, int y1, int x2, int y2); + void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3); + virtual void line_style(int style, int width, char* dashes); + virtual void arc_unscaled(int x, int y, int w, int h, double a1, double a2); + virtual void pie_unscaled(int x, int y, int w, int h, double a1, double a2); + virtual void transformed_vertex(double xf, double yf); + virtual void vertex(double x,double y); + virtual void end_points(); + virtual void end_line(); + virtual void end_loop(); + virtual void end_polygon(); + virtual void end_complex_polygon(); + virtual void circle(double x, double y, double r); + virtual void antialias(int state); + virtual int antialias(); +}; + +#endif // USE_GDIPLUS #endif // FL_GDI_GRAPHICS_DRIVER_H -- cgit v1.2.3