コード例 #1
0
ファイル: libmypaint.py プロジェクト: urw7rs/spiral-envs
    def _update_brush_params(self, **kwargs):
        rgb_keys = ["red", "green", "blue"]

        if any(k in kwargs for k in rgb_keys):
            assert all(k in kwargs for k in rgb_keys)
            red, green, blue = [kwargs[k] for k in rgb_keys]
            for k in rgb_keys:
                del kwargs[k]
            if self._use_color:
                hue, saturation, value = utils.rgb_to_hsv(red, green, blue)
                kwargs.update(dict(hue=hue, saturation=saturation,
                                   value=value))

        self._prev_brush_params = copy.copy(self._brush_params)
        self._brush_params.update(kwargs)

        if not self._prev_brush_params["is_painting"]:
            # If we were not painting before we should pretend that the appearence
            # of the brush didn't change.
            self._prev_brush_params.update({
                k: self._brush_params[k]
                for k in self.BRUSH_APPEARANCE_PARAMS
            })

        # Update the libmypaint brush object.
        self._update_libmypaint_brush(**kwargs)
コード例 #2
0
    def _update_brush_params(self, **kwargs):
        rgb_keys = ["red", "green", "blue"]

        if any(k in kwargs for k in rgb_keys):
            assert all(k in kwargs for k in rgb_keys)
            red, green, blue = [kwargs[k] for k in rgb_keys]
            for k in rgb_keys:
                del kwargs[k]
            hue, saturation, value = utils.rgb_to_hsv(red, green, blue)
            kwargs.update(dict(hue=hue, saturation=saturation, value=value))

        self._prev_brush_params = copy.copy(self._brush_params)
        self._brush_params.update(kwargs)
コード例 #3
0
 def _reset_brush_params(self):
     hue, saturation, value = utils.rgb_to_hsv(
         self.R_VALUES[0], self.G_VALUES[0], self.B_VALUES[0]
     )
     self._brush_params = collections.OrderedDict(
         [
             ("y", 0.0),
             ("x", 0.0),
             ("size", self._brush_sizes[0]),
             ("hue", hue),
             ("saturation", saturation),
             ("value", value),
             ("alpha", self.A_VALUES[0]),
             ("is_painting", False),
         ]
     )
     self._prev_brush_params = None
コード例 #4
0
ファイル: libmypaint.py プロジェクト: urw7rs/spiral-envs
    def _update_brush_params(self, **kwargs):
        rgb_keys = ["red", "green", "blue"]

        if any(k in kwargs for k in rgb_keys):
            assert all(k in kwargs for k in rgb_keys)
            red, green, blue = [kwargs[k] for k in rgb_keys]
            for k in rgb_keys:
                del kwargs[k]
            if self._use_color:
                hue, saturation, value = utils.rgb_to_hsv(red, green, blue)
                kwargs.update(dict(hue=hue, saturation=saturation,
                                   value=value))

        self._prev_brush_params = copy.copy(self._brush_params)
        self._brush_params.update(kwargs)

        # Update the libmypaint brush object.
        self._update_libmypaint_brush(**kwargs)
コード例 #5
0
ファイル: libmypaint.py プロジェクト: urw7rs/spiral-envs
    def _reset_brush_params(self):
        hue, saturation, value = utils.rgb_to_hsv(self.R_VALUES[0],
                                                  self.G_VALUES[0],
                                                  self.B_VALUES[0])
        pressure = 0.0 if self._use_pressure else 1.0
        self._brush_params = collections.OrderedDict([
            ("y", 0.0),
            ("x", 0.0),
            ("pressure", pressure),
            ("log_size", self._log_brush_sizes[0]),
            ("hue", hue),
            ("saturation", saturation),
            ("value", value),
            ("is_painting", False),
        ])
        self._prev_brush_params = None

        # Reset the libmypaint brush object.
        self._move_to(0.0, 0.0, update_brush_params=False)
        self._update_libmypaint_brush(**self._brush_params)