diff --git a/lib/brush.hpp b/lib/brush.hpp index dc1b17f56..f717a42df 100644 --- a/lib/brush.hpp +++ b/lib/brush.hpp @@ -69,6 +69,12 @@ class Brush { return mypaint_brush_stroke_to_2(c_brush, c_surface, x, y, pressure, xtilt, ytilt, dtime, viewzoom, viewrotation, barrel_rotation); } + bool stroke_to_linear (Surface * surface, float x, float y, float pressure, float xtilt, float ytilt, double dtime, float viewzoom, float viewrotation, float barrel_rotation) + { + MyPaintSurface2 *c_surface = surface->get_surface2_interface(); + return mypaint_brush_stroke_to_2_linearsRGB(c_brush, c_surface, x, y, pressure, xtilt, ytilt, dtime, viewzoom, viewrotation, barrel_rotation); + } + double get_total_stroke_painting_time() { return mypaint_brush_get_total_stroke_painting_time(c_brush); diff --git a/lib/brush.py b/lib/brush.py index 5908e342a..714305239 100644 --- a/lib/brush.py +++ b/lib/brush.py @@ -638,6 +638,17 @@ def __init__(self, brushinfo): brushinfo.observers.append(self._update_from_brushinfo) self._update_from_brushinfo(ALL_SETTINGS) + def stroke_to(self, *args): + """ Delegates to mypaintlib with information about color space + + Checks whether color transforms should be done in linear sRGB + so that HSV/HSL adjustments can be handled correctly. + """ + if eotf() == 1.0: + return super(Brush, self).stroke_to(*args) + else: + return super(Brush, self).stroke_to_linear(*args) + def _update_from_brushinfo(self, settings): """Updates changed low-level settings from the BrushInfo""" diff --git a/lib/python_brush.hpp b/lib/python_brush.hpp index 508bb55d6..90870763e 100644 --- a/lib/python_brush.hpp +++ b/lib/python_brush.hpp @@ -56,4 +56,13 @@ class PythonBrush : public Brush { return res; } + bool stroke_to_linear (Surface * surface, float x, float y, float pressure, float xtilt, float ytilt, double dtime, float viewzoom, float viewrotation, float barrel_rotation) + { + bool res = Brush::stroke_to_linear (surface, x, y, pressure, xtilt, ytilt, dtime, viewzoom, viewrotation, barrel_rotation); + if (PyErr_Occurred()) { + res = false; + } + return res; + } + };