Blender V5.3
mathutils_Color.cc File Reference
#include <algorithm>
#include <Python.h>
#include "mathutils.hh"
#include "BLI_utildefines.hh"
#include "../generic/py_capi_utils.hh"
#include "../generic/python_utildefines.hh"
#include "IMB_colormanagement.hh"
#include "BLI_dynstr.hh"

Go to the source code of this file.

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define COLOR_SIZE   3

Functions

Utilities
static PyObject * blender::Color_to_tuple_ex (ColorObject *self, int ndigits)
Color Type: <tt>__new__</tt> / <tt>mathutils.Color()</tt>
static PyObject * blender::Color_vectorcall (PyObject *type, PyObject *const *args, const size_t nargsf, PyObject *kwnames)
static PyObject * blender::Color_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
Color Methods: Color Space Conversion
 blender::PyDoc_STRVAR (Color_from_scene_linear_to_srgb_doc, ".. method:: 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 * blender::Color_from_scene_linear_to_srgb (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_srgb_to_scene_linear_doc, ".. method:: 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 * blender::Color_from_srgb_to_scene_linear (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_scene_linear_to_xyz_d65_doc, ".. method:: 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 * blender::Color_from_scene_linear_to_xyz_d65 (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_xyz_d65_to_scene_linear_doc, ".. method:: 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 * blender::Color_from_xyz_d65_to_scene_linear (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_scene_linear_to_aces_doc, ".. method:: 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 * blender::Color_from_scene_linear_to_aces (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_aces_to_scene_linear_doc, ".. method:: 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 * blender::Color_from_aces_to_scene_linear (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_scene_linear_to_acescg_doc, ".. method:: from_scene_linear_to_acescg()\n" "\n" " Convert from scene linear to ACEScg linear color space.\n" "\n" " :return: A color in ACEScg linear color space.\n" " :rtype: :class:`Color`\n")
static PyObject * blender::Color_from_scene_linear_to_acescg (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_acescg_to_scene_linear_doc, ".. method:: from_acescg_to_scene_linear()\n" "\n" " Convert from ACEScg linear to scene linear color space.\n" "\n" " :return: A color in scene linear color space.\n" " :rtype: :class:`Color`\n")
static PyObject * blender::Color_from_acescg_to_scene_linear (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_scene_linear_to_rec709_linear_doc, ".. method:: 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 * blender::Color_from_scene_linear_to_rec709_linear (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_rec709_linear_to_scene_linear_doc, ".. method:: 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 * blender::Color_from_rec709_linear_to_scene_linear (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_scene_linear_to_rec2020_linear_doc, ".. method:: from_scene_linear_to_rec2020_linear()\n" "\n" " Convert from scene linear to Rec.2020 linear color space.\n" "\n" " :return: A color in Rec.2020 linear color space.\n" " :rtype: :class:`Color`\n")
static PyObject * blender::Color_from_scene_linear_to_rec2020_linear (ColorObject *self)
 blender::PyDoc_STRVAR (Color_from_rec2020_linear_to_scene_linear_doc, ".. method:: from_rec2020_linear_to_scene_linear()\n" "\n" " Convert from Rec.2020 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 * blender::Color_from_rec2020_linear_to_scene_linear (ColorObject *self)
Color Methods: Color Copy/Deep-Copy
 blender::PyDoc_STRVAR (Color_copy_doc, ".. method:: 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 * blender::Color_copy (ColorObject *self)
static PyObject * blender::Color_deepcopy (ColorObject *self, PyObject *args)
Color Type: <tt>__repr__</tt> & <tt>__str__</tt>
static PyObject * blender::Color_repr (ColorObject *self)
static PyObject * blender::Color_str (ColorObject *self)
Color Type: Rich Compare
static PyObject * blender::Color_richcmpr (PyObject *a, PyObject *b, int op)
Color Type: Hash (<tt>__hash__</tt>)
static Py_hash_t blender::Color_hash (ColorObject *self)
Color Type: Sequence & Mapping Protocols Implementation
static Py_ssize_t blender::Color_len (ColorObject *)
static PyObject * blender::Color_item (ColorObject *self, Py_ssize_t i)
static int blender::Color_ass_item (ColorObject *self, Py_ssize_t i, PyObject *value)
static PyObject * blender::Color_slice (ColorObject *self, Py_ssize_t start, Py_ssize_t step, Py_ssize_t slice_length)
static int blender::Color_ass_slice (ColorObject *self, Py_ssize_t start, Py_ssize_t step, Py_ssize_t slice_length, PyObject *seq)
static PyObject * blender::Color_subscript (ColorObject *self, PyObject *item)
static int blender::Color_ass_subscript (ColorObject *self, PyObject *item, PyObject *value)
Color Type: Numeric Protocol Implementation
static PyObject * blender::Color_add (PyObject *v1, PyObject *v2)
static PyObject * blender::Color_iadd (PyObject *v1, PyObject *v2)
static PyObject * blender::Color_sub (PyObject *v1, PyObject *v2)
static PyObject * blender::Color_isub (PyObject *v1, PyObject *v2)
static PyObject * blender::color_mul_float (ColorObject *color, const float scalar)
static PyObject * blender::Color_mul (PyObject *v1, PyObject *v2)
static PyObject * blender::Color_div (PyObject *v1, PyObject *v2)
static PyObject * blender::Color_imul (PyObject *v1, PyObject *v2)
static PyObject * blender::Color_idiv (PyObject *v1, PyObject *v2)
static PyObject * blender::Color_neg (ColorObject *self)
Color Type: Get/Set Item Implementation
 blender::PyDoc_STRVAR (Color_channel_r_doc, "Red color channel.\n" "\n" ":type: float\n")
 blender::PyDoc_STRVAR (Color_channel_g_doc, "Green color channel.\n" "\n" ":type: float\n")
 blender::PyDoc_STRVAR (Color_channel_b_doc, "Blue color channel.\n" "\n" ":type: float\n")
static PyObject * blender::Color_channel_get (ColorObject *self, void *type)
static int blender::Color_channel_set (ColorObject *self, PyObject *value, void *type)
 blender::PyDoc_STRVAR (Color_channel_hsv_h_doc, "HSV Hue component in [0, 1].\n" "\n" ":type: float\n")
 blender::PyDoc_STRVAR (Color_channel_hsv_s_doc, "HSV Saturation component in [0, 1].\n" "\n" ":type: float\n")
 blender::PyDoc_STRVAR (Color_channel_hsv_v_doc, "HSV Value component in [0, 1].\n" "\n" ":type: float\n")
static PyObject * blender::Color_channel_hsv_get (ColorObject *self, void *type)
static int blender::Color_channel_hsv_set (ColorObject *self, PyObject *value, void *type)
 blender::PyDoc_STRVAR (Color_hsv_doc, "HSV Values in [0, 1].\n" "\n" ":type: tuple[float, float, float]\n")
static PyObject * blender::Color_hsv_get (ColorObject *self, void *)
static int blender::Color_hsv_set (ColorObject *self, PyObject *value, void *)
Color Type: C/API Constructors
PyObject * blender::Color_CreatePyObject (const float col[3], PyTypeObject *base_type)
PyObject * blender::Color_CreatePyObject_wrap (float col[3], PyTypeObject *base_type)
PyObject * blender::Color_CreatePyObject_cb (PyObject *cb_user, uchar cb_type, uchar cb_subtype)

Variables

Color Type: Protocol Declarations
static PySequenceMethods blender::Color_SeqMethods
static PyMappingMethods blender::Color_AsMapping
static PyNumberMethods blender::Color_NumMethods
Color Type: Get/Set Item Definitions
static PyGetSetDef blender::Color_getseters []
Color Type: Method Definitions
static PyMethodDef blender::Color_methods []

Color Type: Buffer Protocol

static PyBufferProcs blender::Color_as_buffer
static int blender::Color_getbuffer (PyObject *obj, Py_buffer *view, int flags)
static void blender::Color_releasebuffer (PyObject *, Py_buffer *view)

Color Type: Python Object Definition

PyTypeObject blender::color_Type
 blender::PyDoc_STRVAR (color_doc, ".. class:: Color(rgb=(0.0, 0.0, 0.0), /)\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: (red, green, blue) color values " "where (0, 0, 0) is black & (1, 1, 1) is white.\n" " :type rgb: Sequence[float]\n")

Macro Definition Documentation

◆ COLOR_SIZE