60 def color(self, color: Union[Color, ColorConstant, ColorPalette, ColorPaletteConstant]) ->
None:
63 Set the color for painting an object into the image.
65 If the draw method is called several times, there are two options:
66 - the same color is used for each call,
67 - the color changes with each call.
69 For the first option a Color or a ColorConstant must be passed, for the second a ColorPalette or a
72 @param color: The color to set.
74 @exception NotSupportedException: If color is not a Color or ColorConstant.
76 @since ids_peak_icv 1.1
78 num_bits_per_pixel = self.
_image._pixel_format.storage_bits_per_channel
79 if isinstance(color, ColorConstant):
80 self.
_drawing_options.color = Color.create_from_constant(color, num_bits_per_pixel)
81 elif isinstance(color, ColorPaletteConstant):
82 self.
_drawing_options.color = ColorPalette.create_from_palette_constant(color, num_bits_per_pixel)
83 elif isinstance(color, Color)
or isinstance(color, ColorPalette):