|
Blender V4.3
|
#include <algorithm>#include <Python.h>#include "mathutils.hh"#include "BLI_utildefines.h"#include "../generic/py_capi_utils.hh"#include "../generic/python_utildefines.hh"#include "IMB_colormanagement.hh"#include "BLI_dynstr.h"Go to the source code of this file.
Macros | |
| #define | COLOR_SIZE 3 |
Functions | |
Utilities | |
| static PyObject * | Color_to_tuple_ex (ColorObject *self, int ndigits) |
Color Type: <tt>__new__</tt> / <tt>mathutils.Color()</tt> | |
| static PyObject * | Color_new (PyTypeObject *type, PyObject *args, PyObject *kwds) |
Color Methods: Color Space Conversion | |
| PyDoc_STRVAR (Color_from_scene_linear_to_srgb_doc, ".. function:: from_scene_linear_to_srgb()\n" "\n" " Convert from scene linear to sRGB color space.\n" "\n" " :return: A color in sRGB color space.\n" " :rtype: :class:`Color`\n") | |
| static PyObject * | Color_from_scene_linear_to_srgb (ColorObject *self) |
| PyDoc_STRVAR (Color_from_srgb_to_scene_linear_doc, ".. function:: from_srgb_to_scene_linear()\n" "\n" " Convert from sRGB to scene linear color space.\n" "\n" " :return: A color in scene linear color space.\n" " :rtype: :class:`Color`\n") | |
| static PyObject * | Color_from_srgb_to_scene_linear (ColorObject *self) |
| PyDoc_STRVAR (Color_from_scene_linear_to_xyz_d65_doc, ".. function:: from_scene_linear_to_xyz_d65()\n" "\n" " Convert from scene linear to CIE XYZ (Illuminant D65) color space.\n" "\n" " :return: A color in XYZ color space.\n" " :rtype: :class:`Color`\n") | |
| static PyObject * | Color_from_scene_linear_to_xyz_d65 (ColorObject *self) |
| PyDoc_STRVAR (Color_from_xyz_d65_to_scene_linear_doc, ".. function:: from_xyz_d65_to_scene_linear()\n" "\n" " Convert from CIE XYZ (Illuminant D65) to scene linear color space.\n" "\n" " :return: A color in scene linear color space.\n" " :rtype: :class:`Color`\n") | |
| static PyObject * | Color_from_xyz_d65_to_scene_linear (ColorObject *self) |
| PyDoc_STRVAR (Color_from_scene_linear_to_aces_doc, ".. function:: from_scene_linear_to_aces()\n" "\n" " Convert from scene linear to ACES2065-1 linear color space.\n" "\n" " :return: A color in ACES2065-1 linear color space.\n" " :rtype: :class:`Color`\n") | |
| static PyObject * | Color_from_scene_linear_to_aces (ColorObject *self) |
| PyDoc_STRVAR (Color_from_aces_to_scene_linear_doc, ".. function:: from_aces_to_scene_linear()\n" "\n" " Convert from ACES2065-1 linear to scene linear color space.\n" "\n" " :return: A color in scene linear color space.\n" " :rtype: :class:`Color`\n") | |
| static PyObject * | Color_from_aces_to_scene_linear (ColorObject *self) |
| PyDoc_STRVAR (Color_from_scene_linear_to_rec709_linear_doc, ".. function:: from_scene_linear_to_rec709_linear()\n" "\n" " Convert from scene linear to Rec.709 linear color space.\n" "\n" " :return: A color in Rec.709 linear color space.\n" " :rtype: :class:`Color`\n") | |
| static PyObject * | Color_from_scene_linear_to_rec709_linear (ColorObject *self) |
| PyDoc_STRVAR (Color_from_rec709_linear_to_scene_linear_doc, ".. function:: from_rec709_linear_to_scene_linear()\n" "\n" " Convert from Rec.709 linear color space to scene linear color space.\n" "\n" " :return: A color in scene linear color space.\n" " :rtype: :class:`Color`\n") | |
| static PyObject * | Color_from_rec709_linear_to_scene_linear (ColorObject *self) |
Color Methods: Color Copy/Deep-Copy | |
| PyDoc_STRVAR (Color_copy_doc, ".. function:: copy()\n" "\n" " Returns a copy of this color.\n" "\n" " :return: A copy of the color.\n" " :rtype: :class:`Color`\n" "\n" " .. note:: use this to get a copy of a wrapped color with\n" " no reference to the original data.\n") | |
| static PyObject * | Color_copy (ColorObject *self) |
| static PyObject * | Color_deepcopy (ColorObject *self, PyObject *args) |
Color Type: <tt>__repr__</tt> & <tt>__str__</tt> | |
| static PyObject * | Color_repr (ColorObject *self) |
| static PyObject * | Color_str (ColorObject *self) |
Color Type: Rich Compare | |
| static PyObject * | Color_richcmpr (PyObject *a, PyObject *b, int op) |
Color Type: Hash (<tt>__hash__</tt>) | |
| static Py_hash_t | Color_hash (ColorObject *self) |
Color Type: Sequence & Mapping Protocols Implementation | |
| static Py_ssize_t | Color_len (ColorObject *) |
| static PyObject * | Color_item (ColorObject *self, Py_ssize_t i) |
| static int | Color_ass_item (ColorObject *self, Py_ssize_t i, PyObject *value) |
| static PyObject * | Color_slice (ColorObject *self, int begin, int end) |
| static int | Color_ass_slice (ColorObject *self, int begin, int end, PyObject *seq) |
| static PyObject * | Color_subscript (ColorObject *self, PyObject *item) |
| static int | Color_ass_subscript (ColorObject *self, PyObject *item, PyObject *value) |
Color Type: Numeric Protocol Implementation | |
| static PyObject * | Color_add (PyObject *v1, PyObject *v2) |
| static PyObject * | Color_iadd (PyObject *v1, PyObject *v2) |
| static PyObject * | Color_sub (PyObject *v1, PyObject *v2) |
| static PyObject * | Color_isub (PyObject *v1, PyObject *v2) |
| static PyObject * | color_mul_float (ColorObject *color, const float scalar) |
| static PyObject * | Color_mul (PyObject *v1, PyObject *v2) |
| static PyObject * | Color_div (PyObject *v1, PyObject *v2) |
| static PyObject * | Color_imul (PyObject *v1, PyObject *v2) |
| static PyObject * | Color_idiv (PyObject *v1, PyObject *v2) |
| static PyObject * | Color_neg (ColorObject *self) |
Color Type: Get/Set Item Implementation | |
| PyDoc_STRVAR (Color_channel_r_doc, "Red color channel.\n" "\n" ":type: float") | |
| PyDoc_STRVAR (Color_channel_g_doc, "Green color channel.\n" "\n" ":type: float") | |
| PyDoc_STRVAR (Color_channel_b_doc, "Blue color channel.\n" "\n" ":type: float") | |
| static PyObject * | Color_channel_get (ColorObject *self, void *type) |
| static int | Color_channel_set (ColorObject *self, PyObject *value, void *type) |
| PyDoc_STRVAR (Color_channel_hsv_h_doc, "HSV Hue component in [0, 1].\n" "\n" ":type: float") | |
| PyDoc_STRVAR (Color_channel_hsv_s_doc, "HSV Saturation component in [0, 1].\n" "\n" ":type: float") | |
| PyDoc_STRVAR (Color_channel_hsv_v_doc, "HSV Value component in [0, 1].\n" "\n" ":type: float") | |
| static PyObject * | Color_channel_hsv_get (ColorObject *self, void *type) |
| static int | Color_channel_hsv_set (ColorObject *self, PyObject *value, void *type) |
| PyDoc_STRVAR (Color_hsv_doc, "HSV Values in [0, 1].\n" "\n" ":type: float triplet") | |
| static PyObject * | Color_hsv_get (ColorObject *self, void *) |
| static int | Color_hsv_set (ColorObject *self, PyObject *value, void *) |
Color Type: C/API Constructors | |
| PyObject * | Color_CreatePyObject (const float col[3], PyTypeObject *base_type) |
| PyObject * | Color_CreatePyObject_wrap (float col[3], PyTypeObject *base_type) |
| PyObject * | Color_CreatePyObject_cb (PyObject *cb_user, uchar cb_type, uchar cb_subtype) |
Variables | |
Color Type: Protocol Declarations | |
| static PySequenceMethods | Color_SeqMethods |
| static PyMappingMethods | Color_AsMapping |
| static PyNumberMethods | Color_NumMethods |
Color Type: Get/Set Item Definitions | |
| static PyGetSetDef | Color_getseters [] |
Color Type: Method Definitions | |
| static PyMethodDef | Color_methods [] |
Color Type: Python Object Definition | |
| PyTypeObject | color_Type |
| PyDoc_STRVAR (color_doc, ".. class:: Color(rgb)\n" "\n" " This object gives access to Colors in Blender.\n" "\n" " Most colors returned by Blender APIs are in scene linear color space, as defined by " " the OpenColorIO configuration. The notable exception is user interface theming colors, " " which are in sRGB color space.\n" "\n" " :arg rgb: (red, green, blue) color values where (0, 0, 0) is black & (1, 1, 1) is white.\n" " :type rgb: Sequence[float]\n") | |
| #define COLOR_SIZE 3 |
Definition at line 28 of file mathutils_Color.cc.
Referenced by Color_add(), Color_ass_item(), Color_ass_slice(), Color_ass_subscript(), Color_CreatePyObject(), Color_hash(), Color_iadd(), Color_idiv(), Color_imul(), Color_isub(), Color_item(), Color_len(), color_mul_float(), Color_neg(), Color_new(), Color_richcmpr(), Color_slice(), Color_sub(), Color_subscript(), and Color_to_tuple_ex().
|
static |
Addition: object + object.
Definition at line 579 of file mathutils_Color.cc.
References add_vn_vnvn(), BaseMath_ReadCallback, col, Color_CreatePyObject(), COLOR_SIZE, ColorObject_Check, and v2.
|
static |
Sequence accessor (set): object[i] = x.
Definition at line 403 of file mathutils_Color.cc.
References BaseMath_Prepare_ForWrite, BaseMath_WriteIndexCallback, COLOR_SIZE, and self.
Referenced by Color_ass_subscript(), and Color_channel_set().
|
static |
Sequence slice accessor (set): object[i:j] = x.
Definition at line 465 of file mathutils_Color.cc.
References BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, CLAMP, col, COLOR_SIZE, mathutils_array_parse(), self, and size().
Referenced by Color_ass_subscript().
|
static |
Sequence generic subscript (set): object[...] = x.
Definition at line 540 of file mathutils_Color.cc.
References Color_ass_item(), Color_ass_slice(), COLOR_SIZE, and self.
|
static |
Definition at line 935 of file mathutils_Color.cc.
References Color_item(), POINTER_AS_INT, and self.
|
static |
Definition at line 966 of file mathutils_Color.cc.
References BaseMath_ReadCallback, POINTER_AS_INT, rgb_to_hsv(), and self.
|
static |
Definition at line 980 of file mathutils_Color.cc.
References BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, CLAMP, hsv_to_rgb_v(), POINTER_AS_INT, rgb_to_hsv_v(), and self.
|
static |
Definition at line 940 of file mathutils_Color.cc.
References Color_ass_item(), POINTER_AS_INT, and self.
|
static |
Definition at line 250 of file mathutils_Color.cc.
References BaseMath_ReadCallback, Color_CreatePyObject(), and self.
Referenced by Color_deepcopy().
| PyObject * Color_CreatePyObject | ( | const float | col[3], |
| PyTypeObject * | base_type ) |
Definition at line 1267 of file mathutils_Color.cc.
References BASE_MATH_FLAG_DEFAULT, BASE_MATH_NEW, col, COLOR_SIZE, color_Type, copy_v3_v3(), self, UNLIKELY, and zero_v3().
Referenced by Color_add(), Color_copy(), Color_CreatePyObject_cb(), Color_from_aces_to_scene_linear(), Color_from_rec709_linear_to_scene_linear(), Color_from_scene_linear_to_aces(), Color_from_scene_linear_to_rec709_linear(), Color_from_scene_linear_to_srgb(), Color_from_scene_linear_to_xyz_d65(), Color_from_srgb_to_scene_linear(), Color_from_xyz_d65_to_scene_linear(), color_mul_float(), Color_neg(), Color_new(), Color_sub(), and pyrna_math_object_from_array().
Definition at line 1323 of file mathutils_Color.cc.
References BLI_assert, Color_CreatePyObject(), and self.
Referenced by pyrna_math_object_from_array(), and StrokeAttribute_color_get().
| PyObject * Color_CreatePyObject_wrap | ( | float | col[3], |
| PyTypeObject * | base_type ) |
Definition at line 1305 of file mathutils_Color.cc.
References BASE_MATH_FLAG_DEFAULT, BASE_MATH_FLAG_IS_WRAP, BASE_MATH_NEW, col, color_Type, and self.
|
static |
Definition at line 258 of file mathutils_Color.cc.
References Color_copy(), PyC_CheckArgs_DeepCopy(), and self.
|
static |
Division: object / object.
Definition at line 737 of file mathutils_Color.cc.
References BaseMath_ReadCallback, color_mul_float(), ColorObject_Check, and v2.
|
static |
Definition at line 191 of file mathutils_Color.cc.
References col, Color_CreatePyObject(), IMB_colormanagement_aces_to_scene_linear(), and self.
|
static |
Definition at line 223 of file mathutils_Color.cc.
References col, Color_CreatePyObject(), IMB_colormanagement_rec709_to_scene_linear(), and self.
|
static |
Definition at line 175 of file mathutils_Color.cc.
References col, Color_CreatePyObject(), IMB_colormanagement_scene_linear_to_aces(), and self.
|
static |
Definition at line 207 of file mathutils_Color.cc.
References col, Color_CreatePyObject(), IMB_colormanagement_scene_linear_to_rec709(), and self.
|
static |
Definition at line 111 of file mathutils_Color.cc.
References col, Color_CreatePyObject(), IMB_colormanagement_scene_linear_to_srgb_v3(), and self.
|
static |
Definition at line 143 of file mathutils_Color.cc.
References col, Color_CreatePyObject(), IMB_colormanagement_scene_linear_to_xyz(), and self.
|
static |
Definition at line 127 of file mathutils_Color.cc.
References col, Color_CreatePyObject(), IMB_colormanagement_srgb_to_scene_linear_v3(), and self.
|
static |
Definition at line 159 of file mathutils_Color.cc.
References col, Color_CreatePyObject(), IMB_colormanagement_xyz_to_scene_linear(), and self.
|
static |
Definition at line 356 of file mathutils_Color.cc.
References BaseMath_ReadCallback, BaseMathObject_Prepare_ForHash, COLOR_SIZE, mathutils_array_hash(), and self.
|
static |
Color channel HSV (get): x = color.hsv.
Definition at line 1016 of file mathutils_Color.cc.
References BaseMath_ReadCallback, PyTuple_SET_ITEMS, ret, rgb_to_hsv(), and self.
|
static |
Color channel HSV (set): color.hsv = x.
Definition at line 1034 of file mathutils_Color.cc.
References BaseMath_Prepare_ForWrite, BaseMath_WriteCallback, clamp_v3(), hsv_to_rgb_v(), mathutils_array_parse(), and self.
|
static |
Addition in-place: object += object.
Definition at line 605 of file mathutils_Color.cc.
References add_vn_vn(), BaseMath_ReadCallback, BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, COLOR_SIZE, ColorObject_Check, and v2.
|
static |
Division in-place: object *= object.
Definition at line 799 of file mathutils_Color.cc.
References BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, COLOR_SIZE, mul_vn_fl(), and v2.
|
static |
Multiplication in-place: object *= object.
Definition at line 771 of file mathutils_Color.cc.
References BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, COLOR_SIZE, mul_vn_fl(), and v2.
|
static |
Subtraction in-place: object -= object.
Definition at line 658 of file mathutils_Color.cc.
References BaseMath_ReadCallback, BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, COLOR_SIZE, ColorObject_Check, sub_vn_vn(), and v2.
|
static |
Sequence accessor (get): x = object[i].
Definition at line 382 of file mathutils_Color.cc.
References BaseMath_ReadIndexCallback, COLOR_SIZE, and self.
Referenced by Color_channel_get(), and Color_subscript().
|
static |
Sequence length: len(object).
Definition at line 376 of file mathutils_Color.cc.
References COLOR_SIZE.
|
static |
Multiplication: object * object.
Definition at line 692 of file mathutils_Color.cc.
References BaseMath_ReadCallback, BLI_assert_msg, color_mul_float(), ColorObject_Check, and v2.
|
static |
Definition at line 684 of file mathutils_Color.cc.
References Color_CreatePyObject(), COLOR_SIZE, and mul_vn_vn_fl().
Referenced by Color_div(), and Color_mul().
|
static |
Negative (returns the negative of this object): -object.
Definition at line 832 of file mathutils_Color.cc.
References BaseMath_ReadCallback, Color_CreatePyObject(), COLOR_SIZE, negate_vn_vn(), and self.
|
static |
Definition at line 64 of file mathutils_Color.cc.
References col, Color_CreatePyObject(), COLOR_SIZE, and mathutils_array_parse().
|
static |
Definition at line 272 of file mathutils_Color.cc.
References BaseMath_ReadCallback, Color_to_tuple_ex(), ret, and self.
|
static |
Definition at line 312 of file mathutils_Color.cc.
References ATTR_FALLTHROUGH, b, BaseMath_ReadCallback, COLOR_SIZE, ColorObject_Check, and EXPP_VectorsAreEqual().
|
static |
Sequence slice accessor (get): x = object[i:j].
Definition at line 440 of file mathutils_Color.cc.
References BaseMath_ReadCallback, CLAMP, COLOR_SIZE, count, and self.
Referenced by Color_subscript().
|
static |
Definition at line 289 of file mathutils_Color.cc.
References BaseMath_ReadCallback, BLI_dynstr_appendf(), BLI_dynstr_new(), mathutils_dynstr_to_py(), and self.
|
static |
Subtraction: object - object.
Definition at line 632 of file mathutils_Color.cc.
References BaseMath_ReadCallback, col, Color_CreatePyObject(), COLOR_SIZE, ColorObject_Check, sub_vn_vnvn(), and v2.
|
static |
Sequence generic subscript (get): x = object[...].
Definition at line 503 of file mathutils_Color.cc.
References Color_item(), COLOR_SIZE, Color_slice(), and self.
|
static |
Definition at line 37 of file mathutils_Color.cc.
References COLOR_SIZE, double_round(), ret, and self.
Referenced by Color_repr().
| PyDoc_STRVAR | ( | Color_channel_b_doc | , |
| "Blue color channel.\n" "\n" ":type: float" | ) |
| PyDoc_STRVAR | ( | Color_channel_g_doc | , |
| "Green color channel.\n" "\n" ":type: float" | ) |
| PyDoc_STRVAR | ( | Color_channel_hsv_h_doc | , |
| "HSV Hue component in .\n" "\n" ":type: float" | [0, 1] ) |
| PyDoc_STRVAR | ( | Color_channel_hsv_s_doc | , |
| "HSV Saturation component in .\n" "\n" ":type: float" | [0, 1] ) |
| PyDoc_STRVAR | ( | Color_channel_hsv_v_doc | , |
| "HSV Value component in .\n" "\n" ":type: float" | [0, 1] ) |
| PyDoc_STRVAR | ( | Color_channel_r_doc | , |
| "Red color channel.\n" "\n" ":type: float" | ) |
| PyDoc_STRVAR | ( | Color_copy_doc | , |
| ".. function:: copy()\n" "\n" " Returns a copy of this color.\n" "\n" " :return: A copy of the color.\n" " :rtype: :class:`Color`\n" "\n" " .. note:: use this to get a copy of a wrapped color with\n" " no reference to the original data.\n" | ) |
| PyDoc_STRVAR | ( | color_doc | , |
| ".. class:: Color(rgb)\n" "\n" " This object gives access to Colors in Blender.\n" "\n" " Most colors returned by Blender APIs are in scene linear color | space, | ||
| as defined by " " the OpenColorIO configuration. The notable exception is user interface theming | colors, | ||
| " " which are in sRGB color space.\n" "\n" " :arg rgb:(red, green, blue) color values where(0, 0, 0) is black &(1, 1, 1) is white.\n" " :type rgb:Sequence\n" | [float] ) |
| PyDoc_STRVAR | ( | Color_from_aces_to_scene_linear_doc | , |
| ".. function:: from_aces_to_scene_linear()\n" "\n" " Convert from ACES2065-1 linear to scene linear color space.\n" "\n" " :return: A color in scene linear color space.\n" " :rtype: :class:`Color`\n" | ) |
| PyDoc_STRVAR | ( | Color_from_rec709_linear_to_scene_linear_doc | , |
| ".. function:: from_rec709_linear_to_scene_linear()\n" "\n" " Convert from Rec.709 linear color space to scene linear color space.\n" "\n" " :return: A color in scene linear color space.\n" " :rtype: :class:`Color`\n" | ) |
| PyDoc_STRVAR | ( | Color_from_scene_linear_to_aces_doc | , |
| ".. function:: from_scene_linear_to_aces()\n" "\n" " Convert from scene linear to ACES2065-1 linear color space.\n" "\n" " :return: A color in ACES2065-1 linear color space.\n" " :rtype: :class:`Color`\n" | ) |
| PyDoc_STRVAR | ( | Color_from_scene_linear_to_rec709_linear_doc | , |
| ".. function:: from_scene_linear_to_rec709_linear()\n" "\n" " Convert from scene linear to Rec.709 linear color space.\n" "\n" " :return: A color in Rec.709 linear color space.\n" " :rtype: :class:`Color`\n" | ) |
| PyDoc_STRVAR | ( | Color_from_scene_linear_to_srgb_doc | , |
| ".. function:: from_scene_linear_to_srgb()\n" "\n" " Convert from scene linear to sRGB color space.\n" "\n" " :return: A color in sRGB color space.\n" " :rtype: :class:`Color`\n" | ) |
| PyDoc_STRVAR | ( | Color_from_scene_linear_to_xyz_d65_doc | , |
| ".. function:: from_scene_linear_to_xyz_d65()\n" "\n" " Convert from scene linear to CIE XYZ (Illuminant D65) color space.\n" "\n" " :return: A color in XYZ color space.\n" " :rtype: :class:`Color`\n" | ) |
| PyDoc_STRVAR | ( | Color_from_srgb_to_scene_linear_doc | , |
| ".. function:: from_srgb_to_scene_linear()\n" "\n" " Convert from sRGB to scene linear color space.\n" "\n" " :return: A color in scene linear color space.\n" " :rtype: :class:`Color`\n" | ) |
| PyDoc_STRVAR | ( | Color_from_xyz_d65_to_scene_linear_doc | , |
| ".. function:: from_xyz_d65_to_scene_linear()\n" "\n" " Convert from CIE XYZ (Illuminant D65) to scene linear color space.\n" "\n" " :return: A color in scene linear color space.\n" " :rtype: :class:`Color`\n" | ) |
| PyDoc_STRVAR | ( | Color_hsv_doc | , |
| "HSV Values in .\n" "\n" ":type: float triplet" | [0, 1] ) |
|
static |
Definition at line 863 of file mathutils_Color.cc.
|
static |
Definition at line 1062 of file mathutils_Color.cc.
|
static |
Definition at line 1131 of file mathutils_Color.cc.
|
static |
Definition at line 869 of file mathutils_Color.cc.
|
static |
Definition at line 850 of file mathutils_Color.cc.
| PyTypeObject color_Type |
Definition at line 1205 of file mathutils_Color.cc.
Referenced by Color_CreatePyObject(), Color_CreatePyObject_wrap(), and PyInit_mathutils().