diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2022-01-27 08:14:34 +0000 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2022-01-27 08:14:34 +0000 |
commit | 62850589ee36ccae52e87173e21a1eff510ecac5 (patch) | |
tree | c15656c263856e8110c489025af73a2537731e6e /cairomm/surface.h | |
parent | 393cd568894d1f07858ed9945022b7964635f9f8 (diff) | |
parent | e6343ede2f0b9d9663fd25c8fc156cd03a033fdf (diff) |
Merge branch 'device-scale' into 'master'
Wrapping surface device scale functions
See merge request cairo/cairomm!22
Diffstat (limited to 'cairomm/surface.h')
-rw-r--r-- | cairomm/surface.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cairomm/surface.h b/cairomm/surface.h index 663bd57..65d7cea 100644 --- a/cairomm/surface.h +++ b/cairomm/surface.h @@ -431,6 +431,37 @@ public: */ void get_device_offset(double& x_offset, double& y_offset) const; + /** Sets a scale that is multiplied to the device coordinates determined by + * the CTM when drawing to surface. One common use for this is to render to + * very high resolution display devices at a scale factor, so that code that + * assumes 1 pixel will be a certain size will still work. Setting a + * transformation via cairo_translate() isn't sufficient to do this, since + * functions like Cairo::Context::device_to_user() will expose the hidden scale. + * + * Note that the scale affects drawing to the surface as well as using the + * surface in a source pattern. + * + * @param x_scale a scale factor in the X direction + * @param y_scale a scale factor in the Y direction + */ + void set_device_scale(double x_scale, double y_scale); + + /** Sets x and y scale to the same value. + * See set_device_scale(double, double) for details. + * + * @param scale a scale factor in the X and Y direction + */ + inline void set_device_scale(double scale) { set_device_scale(scale, scale); } + + /** Returns a previous device scale set by set_device_scale(). + */ + void get_device_scale(double& x_scale, double& y_scale) const; + + /** Returns the x and y average of a previous device scale set by + * set_device_scale(). + */ + double get_device_scale() const; + /** * Set the horizontal and vertical resolution for image fallbacks. * |