diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-02-25 11:06:54 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2021-02-25 11:07:07 +0100 |
| commit | 5bd467fa17be55397f433dddc065b57cbb7a0615 (patch) | |
| tree | 6698febfde050bf76f84873ea749b031467d7cbb /src/fl_draw.cxx | |
| parent | bef46b5cb82464713a117b9bdb920735d1b7de37 (diff) | |
Add fl_remove_scale()/fl_restore_scale() to transiently draw without scaling factor.
This new API is a response to this message in fltk.general :
Can custom box type functions handle their own high-DPI screen scaling?
Diffstat (limited to 'src/fl_draw.cxx')
| -rw-r--r-- | src/fl_draw.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/fl_draw.cxx b/src/fl_draw.cxx index 72a117df0..538e63f2a 100644 --- a/src/fl_draw.cxx +++ b/src/fl_draw.cxx @@ -458,3 +458,20 @@ int fl_height(int font, int size) { fl_font(tf,ts); // restore return(height); } + +/** Removes any GUI scaling factor in subsequent drawing operations. + This must be matched by a later call to fl_restore_scale(). + This function can be used to transiently perform drawing operations + that are not rescaled by the current value of the GUI scaling factor. + The resulting drawing context has no clipping region. + \return The GUI scaling factor value that was applied when the function started. + */ +float fl_remove_scale() { + return fl_graphics_driver->remove_scale(); +} + +/** Restores the GUI scaling factor and the clipping region in subsequent drawing operations. + \param s Value returned by a previous call to fl_remove_scale(). */ +void fl_restore_scale(float s) { + fl_graphics_driver->restore_scale(s); +} |
