Blender
V3.3
|
#include <Python.h>
#include "mathutils.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
#include "IMB_colormanagement.h"
#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 int | Color_len (ColorObject *UNUSED(self)) |
static PyObject * | Color_item (ColorObject *self, int i) |
static int | Color_ass_item (ColorObject *self, int 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 *UNUSED(closure)) |
static int | Color_hsv_set (ColorObject *self, PyObject *value, void *UNUSED(closure)) |
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 struct 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" " :param rgb: (r, g, b) color values\n" " :type rgb: 3d vector\n") | |
#define COLOR_SIZE 3 |
Definition at line 23 of file mathutils_Color.c.
|
static |
Addition: object + object
.
Definition at line 551 of file mathutils_Color.c.
References add_vn_vnvn(), BaseMath_ReadCallback, col, Color_CreatePyObject(), COLOR_SIZE, ColorObject_Check, NULL, v1, and v2.
|
static |
Sequence accessor (set): object[i] = x
.
Definition at line 376 of file mathutils_Color.c.
References BaseMath_Prepare_ForWrite, BaseMath_WriteIndexCallback, and COLOR_SIZE.
Referenced by Color_ass_subscript(), and Color_channel_set().
|
static |
Sequence slice accessor (set): object[i:j] = x
.
Definition at line 438 of file mathutils_Color.c.
References BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, CLAMP, col, COLOR_SIZE, mathutils_array_parse(), MIN2, size(), and void.
Referenced by Color_ass_subscript().
|
static |
Sequence generic subscript (set): object[...] = x
.
Definition at line 512 of file mathutils_Color.c.
References Color_ass_item(), Color_ass_slice(), and COLOR_SIZE.
|
static |
Definition at line 890 of file mathutils_Color.c.
References Color_item(), POINTER_AS_INT, and type.
|
static |
Definition at line 906 of file mathutils_Color.c.
References BaseMath_ReadCallback, NULL, POINTER_AS_INT, rgb_to_hsv(), self, and type.
|
static |
Definition at line 920 of file mathutils_Color.c.
References BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, CLAMP, hsv_to_rgb_v(), POINTER_AS_INT, rgb_to_hsv_v(), self, and type.
|
static |
Definition at line 895 of file mathutils_Color.c.
References Color_ass_item(), POINTER_AS_INT, and type.
|
static |
Definition at line 223 of file mathutils_Color.c.
References BaseMath_ReadCallback, Color_CreatePyObject(), NULL, and self.
Referenced by Color_deepcopy().
PyObject* Color_CreatePyObject | ( | const float | col[3], |
PyTypeObject * | base_type | ||
) |
Definition at line 1165 of file mathutils_Color.c.
References BASE_MATH_FLAG_DEFAULT, BASE_MATH_NEW, col, COLOR_SIZE, color_Type, copy_v3_v3(), NULL, 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 1221 of file mathutils_Color.c.
References Color_CreatePyObject(), and NULL.
Referenced by pyrna_math_object_from_array(), and StrokeAttribute_color_get().
PyObject* Color_CreatePyObject_wrap | ( | float | col[3], |
PyTypeObject * | base_type | ||
) |
Definition at line 1203 of file mathutils_Color.c.
References BASE_MATH_FLAG_DEFAULT, BASE_MATH_FLAG_IS_WRAP, BASE_MATH_NEW, col, color_Type, and NULL.
|
static |
Definition at line 231 of file mathutils_Color.c.
References Color_copy(), NULL, and PyC_CheckArgs_DeepCopy().
|
static |
Division: object / object
.
Definition at line 709 of file mathutils_Color.c.
References BaseMath_ReadCallback, color_mul_float(), ColorObject_Check, NULL, v1, and v2.
|
static |
Definition at line 172 of file mathutils_Color.c.
References col, Color_CreatePyObject(), IMB_colormanagement_aces_to_scene_linear(), and self.
|
static |
Definition at line 200 of file mathutils_Color.c.
References col, Color_CreatePyObject(), IMB_colormanagement_rec709_to_scene_linear(), and self.
|
static |
Definition at line 158 of file mathutils_Color.c.
References col, Color_CreatePyObject(), IMB_colormanagement_scene_linear_to_aces(), and self.
|
static |
Definition at line 186 of file mathutils_Color.c.
References col, Color_CreatePyObject(), IMB_colormanagement_scene_linear_to_rec709(), and self.
|
static |
Definition at line 102 of file mathutils_Color.c.
References col, Color_CreatePyObject(), IMB_colormanagement_scene_linear_to_srgb_v3(), and self.
|
static |
Definition at line 130 of file mathutils_Color.c.
References col, Color_CreatePyObject(), IMB_colormanagement_scene_linear_to_xyz(), and self.
|
static |
Definition at line 116 of file mathutils_Color.c.
References col, Color_CreatePyObject(), IMB_colormanagement_srgb_to_scene_linear_v3(), and self.
|
static |
Definition at line 144 of file mathutils_Color.c.
References col, Color_CreatePyObject(), IMB_colormanagement_xyz_to_scene_linear(), and self.
|
static |
Definition at line 329 of file mathutils_Color.c.
References BaseMath_ReadCallback, BaseMathObject_Prepare_ForHash, COLOR_SIZE, mathutils_array_hash(), and self.
|
static |
Color channel HSV (get): x = color.hsv
.
Definition at line 951 of file mathutils_Color.c.
References BaseMath_ReadCallback, NULL, PyTuple_SET_ITEMS, ret, rgb_to_hsv(), and self.
|
static |
Color channel HSV (set): color.hsv = x
.
Definition at line 969 of file mathutils_Color.c.
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 577 of file mathutils_Color.c.
References add_vn_vn(), BaseMath_ReadCallback, BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, COLOR_SIZE, ColorObject_Check, NULL, v1, v2, and void.
|
static |
Division in-place: object *= object
.
Definition at line 771 of file mathutils_Color.c.
References BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, color, COLOR_SIZE, mul_vn_fl(), NULL, v1, v2, and void.
|
static |
Multiplication in-place: object *= object
.
Definition at line 743 of file mathutils_Color.c.
References BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, color, COLOR_SIZE, mul_vn_fl(), NULL, v1, v2, and void.
|
static |
Subtraction in-place: object -= object
.
Definition at line 630 of file mathutils_Color.c.
References BaseMath_ReadCallback, BaseMath_ReadCallback_ForWrite, BaseMath_WriteCallback, COLOR_SIZE, ColorObject_Check, NULL, sub_vn_vn(), v1, v2, and void.
|
static |
Sequence accessor (get): x = object[i]
.
Definition at line 355 of file mathutils_Color.c.
References BaseMath_ReadIndexCallback, COLOR_SIZE, NULL, and self.
Referenced by Color_channel_get(), and Color_subscript().
|
static |
Sequence length: len(object)
.
Definition at line 349 of file mathutils_Color.c.
References COLOR_SIZE.
|
static |
Multiplication: object * object
.
Definition at line 664 of file mathutils_Color.c.
References BaseMath_ReadCallback, BLI_assert_msg, color_mul_float(), ColorObject_Check, NULL, v1, and v2.
|
static |
Definition at line 656 of file mathutils_Color.c.
References color, 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 804 of file mathutils_Color.c.
References BaseMath_ReadCallback, Color_CreatePyObject(), COLOR_SIZE, negate_vn_vn(), NULL, and self.
|
static |
Definition at line 59 of file mathutils_Color.c.
References col, Color_CreatePyObject(), COLOR_SIZE, mathutils_array_parse(), NULL, and type.
|
static |
Definition at line 245 of file mathutils_Color.c.
References BaseMath_ReadCallback, Color_to_tuple_ex(), NULL, and ret.
|
static |
Definition at line 285 of file mathutils_Color.c.
References Freestyle::a, ATTR_FALLTHROUGH, usdtokens::b(), BaseMath_ReadCallback, COLOR_SIZE, ColorObject_Check, EXPP_VectorsAreEqual(), and NULL.
|
static |
Sequence slice accessor (get): x = object[i:j]
.
Definition at line 413 of file mathutils_Color.c.
References BaseMath_ReadCallback, CLAMP, COLOR_SIZE, count, MIN2, NULL, and self.
Referenced by Color_subscript().
|
static |
Definition at line 262 of file mathutils_Color.c.
References BaseMath_ReadCallback, BLI_dynstr_appendf(), BLI_dynstr_new(), mathutils_dynstr_to_py(), NULL, and self.
|
static |
Subtraction: object - object
.
Definition at line 604 of file mathutils_Color.c.
References BaseMath_ReadCallback, col, Color_CreatePyObject(), COLOR_SIZE, ColorObject_Check, NULL, sub_vn_vnvn(), v1, and v2.
|
static |
Sequence generic subscript (get): x = object[...]
.
Definition at line 475 of file mathutils_Color.c.
References Color_item(), COLOR_SIZE, Color_slice(), and NULL.
|
static |
Definition at line 32 of file mathutils_Color.c.
References COLOR_SIZE, double_round(), ret, and self.
Referenced by Color_repr().
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" " :param rgb:(r, g, b) color values\n" " :type rgb:3d vector\n" | |||
) |
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 835 of file mathutils_Color.c.
|
static |
Definition at line 997 of file mathutils_Color.c.
|
static |
Definition at line 997 of file mathutils_Color.c.
|
static |
Definition at line 841 of file mathutils_Color.c.
|
static |
Definition at line 822 of file mathutils_Color.c.
PyTypeObject color_Type |
Definition at line 1107 of file mathutils_Color.c.
Referenced by Color_CreatePyObject(), Color_CreatePyObject_wrap(), and PyInit_mathutils().