Sorry about the mistakes.. Barring an adjustment of the warmest and coolest hue values, that can be somewhat subjective, I think this last version should be ok.
Also, should I keep posting corrections if necessary, or would it be better if someone else fixes things? I'm not very experienced, and intended the original as an idea with a trivial proof of concept, rather than a ready to be included patch.
From fd311d5b50daf82b7628c29e848ddb60a34cf368 Mon Sep 17 00:00:00 2001 From: Vasilis Platanias <[email protected]> Date: Sun, 12 Sep 2010 17:07:31 +0300 Subject: [PATCH] More color menu actions and stop hue resetting to 0. --- gui/document.py | 48 +++++++++++++++++++++++++++++++++++++++++++++++- gui/menu.xml | 4 ++++ 2 files changed, 51 insertions(+), 1 deletions(-) diff --git a/gui/document.py b/gui/document.py index e46da0f..27589cf 100644 --- a/gui/document.py +++ b/gui/document.py @@ -73,6 +73,10 @@ class Document(object): ('PickContext', None, _('Pick Context (layer, brush and color)'), 'w', None, self.pick_context_cb), ('Darker', None, _('Darker'), None, None, self.darker_cb), + ('Warmer', None, _('Warmer'), None, None, self.warmer_cb), + ('Cooler', None, _('Cooler'), None, None, self.cooler_cb), + ('Purer', None, _('Purer'), None, None, self.purer_cb), + ('Grayer', None, _('Grayer'), None, None, self.grayer_cb), ('Bigger', None, _('Bigger'), 'f', None, self.brush_bigger_cb), # Context actions are also added in init_context_actions @@ -322,7 +326,49 @@ class Document(object): self.end_eraser_mode() h, s, v = self.app.brush.get_color_hsv() v -= 0.08 - if v < 0.0: v = 0.0 + # stop a little higher than 0.0, to avoid resetting hue to 0 + if v < 0.005: v = 0.005 + self.app.brush.set_color_hsv((h, s, v)) + + def warmer_cb(self,action): + self.end_eraser_mode() + h, s, v = self.app.brush.get_color_hsv() + # using about 40 degrees (0.111 +- e) as warmest and + # 130 deg (0.611 +- e) as coolest + e = 0.015 + if 0.111 + e < h < 0.611: + h -= 0.015 + elif 0.0 <= h < 0.111 - e or 0.611<= h <= 1.0: + h += 0.015 + if h > 1.0: h -= 1.0 + if h < 0.0: h += 1.0 + self.app.brush.set_color_hsv((h, s, v)) + + def cooler_cb(self,action): + self.end_eraser_mode() + h, s, v = self.app.brush.get_color_hsv() + e = 0.015 + if 0.111 < h < 0.611 - e: + h += 0.015 + elif 0.0 <= h <= 0.111 or 0.611 + e < h <= 1.0: + h -= 0.015 + if h > 1.0: h -= 1.0 + if h < 0.0: h += 1.0 + self.app.brush.set_color_hsv((h, s, v)) + + def purer_cb(self,action): + self.end_eraser_mode() + h, s, v = self.app.brush.get_color_hsv() + s += 0.08 + if s > 1.0: s = 1.0 + self.app.brush.set_color_hsv((h, s, v)) + + def grayer_cb(self,action): + self.end_eraser_mode() + h, s, v = self.app.brush.get_color_hsv() + s -= 0.08 + # stop a little higher than 0.0, to avoid resetting hue to 0 + if s < 0.005: s = 0.005 self.app.brush.set_color_hsv((h, s, v)) def context_cb(self, action): diff --git a/gui/menu.xml b/gui/menu.xml index 32bd8cc..e404b10 100644 --- a/gui/menu.xml +++ b/gui/menu.xml @@ -93,6 +93,10 @@ <separator/> <menuitem action='Brighter'/> <menuitem action='Darker'/> + <menuitem action='Warmer'/> + <menuitem action='Cooler'/> + <menuitem action='Purer'/> + <menuitem action='Grayer'/> </menu> <menu action='LayerMenu'> <menuitem action='LayersWindow'/> -- 1.7.0.4
_______________________________________________ Mypaint-discuss mailing list [email protected] https://mail.gna.org/listinfo/mypaint-discuss
