mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 13:55:38 +08:00
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?
This commit is contained in:
+3
-1
@@ -81,7 +81,9 @@ public:
|
||||
/** \brief Returns the graphics driver of this drawing surface. */
|
||||
inline Fl_Graphics_Driver *driver() {return pGraphicsDriver; };
|
||||
/** The current drawing surface.
|
||||
In other words, the Fl_Surface_Device object that currently receives all graphics requests */
|
||||
In other words, the Fl_Surface_Device object that currently receives all graphics requests
|
||||
\note It's possible to transiently remove the GUI scaling factor in force in the current
|
||||
drawing surface with \ref fl_remove_scale(). */
|
||||
static inline Fl_Surface_Device *surface() {
|
||||
return surface_ ? surface_ : default_surface();
|
||||
};
|
||||
|
||||
@@ -364,6 +364,8 @@ public:
|
||||
virtual void font_name(int num, const char *name);
|
||||
// Defaut implementation may be enough
|
||||
virtual void overlay_rect(int x, int y, int w , int h);
|
||||
virtual float remove_scale();
|
||||
virtual void restore_scale(float);
|
||||
};
|
||||
|
||||
#ifndef FL_DOXYGEN
|
||||
@@ -486,6 +488,8 @@ protected:
|
||||
void transformed_vertex(double xf, double yf);
|
||||
virtual void transformed_vertex0(float x, float y);
|
||||
void vertex(double x, double y);
|
||||
virtual float remove_scale();
|
||||
virtual void restore_scale(float);
|
||||
};
|
||||
#endif // FL_DOXYGEN
|
||||
|
||||
|
||||
@@ -687,6 +687,11 @@ FL_EXPORT const char *fl_local_to_mac_roman(const char *t, int n=-1);
|
||||
|
||||
/** \addtogroup fl_drawings
|
||||
@{ */
|
||||
|
||||
FL_EXPORT float fl_remove_scale();
|
||||
|
||||
FL_EXPORT void fl_restore_scale(float s);
|
||||
|
||||
/**
|
||||
Draws a nul-terminated UTF-8 string starting at the given \p x, \p y location.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user