diff options
| author | Manolo Gouy <Manolo> | 2018-06-27 09:27:04 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-06-27 09:27:04 +0000 |
| commit | 51389ca460d8533cad790e48aba05648df592360 (patch) | |
| tree | f84dfaa327c40acc8d5abd8c568102c12684a031 /FL | |
| parent | f6a7602cfc337a668d803692c3f1bf8b0a75aee8 (diff) | |
Add examples/SVG_File_Surface.cxx and refer to it in the doc of class Fl_Surface_Device
This example code shows how to subclass Fl_Surface_Device and Fl_Graphics_Driver to
endow FLTK with a new kind of graphics output.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12980 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Device.H | 11 | ||||
| -rw-r--r-- | FL/Fl_Graphics_Driver.H | 8 |
2 files changed, 11 insertions, 8 deletions
diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H index 9162d13b1..5378293f3 100644 --- a/FL/Fl_Device.H +++ b/FL/Fl_Device.H @@ -51,6 +51,17 @@ class Fl_Widget; </ol> For back-compatibility, it is also possible to use the Fl_Surface_Device::set_current() member function to change the current drawing surface, once to the new surface, once to the previous one. + + Class Fl_Surface_Device can also be derived to define new kinds of graphical output + usable with FLTK drawing functions. + An example would be to draw to an SVG file. This would require to create a new class, + say SVG_Surface, derived from class Fl_Surface_Device, and another new class, + say SVG_Graphics_Driver, derived from class Fl_Graphics_Driver. + Class SVG_Graphics_Driver should implement all virtual methods of the Fl_Graphics_Driver class + to support all FLTK drawing functions and have them draw into SVG files. Alternatively, + class SVG_Graphics_Driver could implement only some virtual methods, and only part of + the FLTK drawing API would be usable when drawing to SVG files + (see examples/SVG_File_Surface.cxx for a small, working implementation of this procedure). */ class FL_EXPORT Fl_Surface_Device { /** The graphics driver in use by this surface. */ diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H index 0255ae24f..01646b446 100644 --- a/FL/Fl_Graphics_Driver.H +++ b/FL/Fl_Graphics_Driver.H @@ -72,14 +72,6 @@ struct Fl_Fontdesc; drawing operations are directed to another drawing surface by Fl_Surface_Device::push_current() / Fl_Surface_Device::pop_current() / Fl_Surface_Device::set_current(). - The Fl_Graphics_Driver class is of interest if one wants to perform new kinds of drawing operations. - An example would be to draw to an SVG file. This would require to create a new class, - say SVG_Graphics_Driver, derived from class Fl_Graphics_Driver, and another new class, - say SVG_Surface, derived from class Fl_Surface_Device. The new SVG_Graphics_Driver class should - implement all virtual methods of the Fl_Graphics_Driver class to support all FLTK drawing functions - and have them draw into SVG files. Alternatively, class SVG_Graphics_Driver could implement only some - virtual methods, and only part of FLTK drawing functions would be usable when drawing to SVG files. - The Fl_Graphics_Driver class is essential for developers of the FLTK library. Each platform supported by FLTK requires to create a derived class of Fl_Graphics_Driver that implements all its virtual member functions according to the platform. |
