Blender V2.61 - r43446
Defines | Functions | Variables

mathutils_Color.c File Reference

#include <Python.h>
#include "mathutils.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_dynstr.h"

Go to the source code of this file.

Defines

#define COLOR_SIZE   3

Functions

static PyObject * Color_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
static PyObject * Color_ToTupleExt (ColorObject *self, int ndigits)
 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_repr (ColorObject *self)
static PyObject * Color_str (ColorObject *self)
static PyObject * Color_richcmpr (PyObject *a, PyObject *b, int op)
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)
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)
 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))
 PyDoc_STRVAR (color_doc,"This object gives access to Colors in Blender.")
PyObject * Color_CreatePyObject (float *col, int type, PyTypeObject *base_type)
PyObject * Color_CreatePyObject_cb (PyObject *cb_user, int cb_type, int cb_subtype)

Variables

static PySequenceMethods Color_SeqMethods
static PyMappingMethods Color_AsMapping
static PyNumberMethods Color_NumMethods
static PyGetSetDef Color_getseters []
static struct PyMethodDef Color_methods []
PyTypeObject color_Type

Detailed Description

Definition in file mathutils_Color.c.


Define Documentation

#define COLOR_SIZE   3

Function Documentation

static PyObject* Color_add ( PyObject *  v1,
PyObject *  v2 
) [static]
static int Color_ass_item ( ColorObject self,
int  i,
PyObject *  value 
) [static]

Definition at line 210 of file mathutils_Color.c.

References BaseMath_WriteIndexCallback, COLOR_SIZE, and i.

Referenced by Color_ass_subscript(), and Color_channel_set().

static int Color_ass_slice ( ColorObject self,
int  begin,
int  end,
PyObject *  seq 
) [static]
static int Color_ass_subscript ( ColorObject self,
PyObject *  item,
PyObject *  value 
) [static]

Definition at line 327 of file mathutils_Color.c.

References Color_ass_item(), Color_ass_slice(), COLOR_SIZE, i, and step().

static PyObject* Color_channel_get ( ColorObject self,
void *  type 
) [static]

Definition at line 677 of file mathutils_Color.c.

References Color_item(), and GET_INT_FROM_POINTER.

static PyObject* Color_channel_hsv_get ( ColorObject self,
void *  type 
) [static]

Definition at line 692 of file mathutils_Color.c.

References BaseMath_ReadCallback, GET_INT_FROM_POINTER, i, NULL, and rgb_to_hsv().

static int Color_channel_hsv_set ( ColorObject self,
PyObject *  value,
void *  type 
) [static]
static int Color_channel_set ( ColorObject self,
PyObject *  value,
void *  type 
) [static]

Definition at line 682 of file mathutils_Color.c.

References Color_ass_item(), and GET_INT_FROM_POINTER.

static PyObject* Color_copy ( ColorObject self) [static]

Definition at line 103 of file mathutils_Color.c.

References BaseMath_ReadCallback, Color_CreatePyObject(), NULL, and Py_NEW.

PyObject* Color_CreatePyObject ( float *  col,
int  type,
PyTypeObject *  base_type 
)
PyObject* Color_CreatePyObject_cb ( PyObject *  cb_user,
int  cb_type,
int  cb_subtype 
)

Definition at line 888 of file mathutils_Color.c.

References Color_CreatePyObject(), and Py_NEW.

Referenced by pyrna_math_object_from_array().

static PyObject* Color_div ( PyObject *  v1,
PyObject *  v2 
) [static]

Definition at line 530 of file mathutils_Color.c.

References BaseMath_ReadCallback, color_mul_float(), ColorObject_Check, and NULL.

static PyObject* Color_hsv_get ( ColorObject self,
void *  UNUSEDclosure 
) [static]

Definition at line 734 of file mathutils_Color.c.

References BaseMath_ReadCallback, NULL, and rgb_to_hsv().

static int Color_hsv_set ( ColorObject self,
PyObject *  value,
void *  UNUSEDclosure 
) [static]
static PyObject* Color_iadd ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Color_idiv ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Color_imul ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Color_isub ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Color_item ( ColorObject self,
int  i 
) [static]

Definition at line 191 of file mathutils_Color.c.

References BaseMath_ReadIndexCallback, COLOR_SIZE, i, and NULL.

Referenced by Color_channel_get(), and Color_subscript().

static int Color_len ( ColorObject UNUSEDself) [static]

Definition at line 185 of file mathutils_Color.c.

References COLOR_SIZE.

static PyObject* Color_mul ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* color_mul_float ( ColorObject color,
const float  scalar 
) [static]

Definition at line 480 of file mathutils_Color.c.

References Color_CreatePyObject(), COLOR_SIZE, mul_vn_vn_fl(), and Py_NEW.

Referenced by Color_div(), and Color_mul().

static PyObject* Color_neg ( ColorObject self) [static]
static PyObject* Color_new ( PyTypeObject *  type,
PyObject *  args,
PyObject *  kwds 
) [static]

Definition at line 41 of file mathutils_Color.c.

References Color_CreatePyObject(), COLOR_SIZE, mathutils_array_parse(), NULL, and Py_NEW.

static PyObject* Color_repr ( ColorObject self) [static]

Definition at line 114 of file mathutils_Color.c.

References BaseMath_ReadCallback, Color_ToTupleExt(), and NULL.

static PyObject* Color_richcmpr ( PyObject *  a,
PyObject *  b,
int  op 
) [static]
static PyObject* Color_slice ( ColorObject self,
int  begin,
int  end 
) [static]

Definition at line 238 of file mathutils_Color.c.

References BaseMath_ReadCallback, CLAMP(), COLOR_SIZE, MIN2, and NULL.

Referenced by Color_subscript().

static PyObject* Color_str ( ColorObject self) [static]
static PyObject* Color_sub ( PyObject *  v1,
PyObject *  v2 
) [static]
static PyObject* Color_subscript ( ColorObject self,
PyObject *  item 
) [static]

Definition at line 290 of file mathutils_Color.c.

References Color_item(), COLOR_SIZE, Color_slice(), i, NULL, and step().

static PyObject* Color_ToTupleExt ( ColorObject self,
int  ndigits 
) [static]

Definition at line 71 of file mathutils_Color.c.

References COLOR_SIZE, double_round(), and i.

Referenced by Color_repr().

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_channel_g_doc  ,
"Green color channel.\n\n:type: float"   
)
PyDoc_STRVAR ( color_doc  ,
"This object gives access to Colors in Blender."   
)
PyDoc_STRVAR ( Color_hsv_doc  ,
"HSV Values in .\n\n:type: float triplet"  [0, 1] 
)
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_b_doc  ,
"Blue color channel.\n\n:type: float"   
)

Variable Documentation

PyMappingMethods Color_AsMapping [static]
Initial value:
 {
    (lenfunc)Color_len,
    (binaryfunc)Color_subscript,
    (objobjargproc)Color_ass_subscript
}

Definition at line 373 of file mathutils_Color.c.

PyGetSetDef Color_getseters[] [static]
Initial value:
 {
    {(char *)"r", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_r_doc, (void *)0},
    {(char *)"g", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_g_doc, (void *)1},
    {(char *)"b", (getter)Color_channel_get, (setter)Color_channel_set, Color_channel_b_doc, (void *)2},

    {(char *)"h", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_h_doc, (void *)0},
    {(char *)"s", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_s_doc, (void *)1},
    {(char *)"v", (getter)Color_channel_hsv_get, (setter)Color_channel_hsv_set, (char *)Color_channel_hsv_v_doc, (void *)2},

    {(char *)"hsv", (getter)Color_hsv_get, (setter)Color_hsv_set, (char *)Color_hsv_doc, (void *)0},

    {(char *)"is_wrapped", (getter)BaseMathObject_is_wrapped_get, (setter)NULL, BaseMathObject_is_wrapped_doc, NULL},
    {(char *)"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
    {NULL, NULL, NULL, NULL, NULL}  
}

Definition at line 773 of file mathutils_Color.c.

struct PyMethodDef Color_methods[] [static]
Initial value:
 {
    {"__copy__", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc},
    {"copy", (PyCFunction) Color_copy, METH_NOARGS, Color_copy_doc},
    {NULL, NULL, 0, NULL}
}

Definition at line 791 of file mathutils_Color.c.

PyNumberMethods Color_NumMethods [static]

Definition at line 635 of file mathutils_Color.c.

PySequenceMethods Color_SeqMethods [static]
Initial value:
 {
    (lenfunc) Color_len,                    
    (binaryfunc) NULL,                      
    (ssizeargfunc) NULL,                    
    (ssizeargfunc) Color_item,              
    NULL,                                   
    (ssizeobjargproc) Color_ass_item,       
    NULL,                                   
    (objobjproc) NULL,                      
    (binaryfunc) NULL,                      
    (ssizeargfunc) NULL,                    
}

Definition at line 360 of file mathutils_Color.c.

PyTypeObject color_Type

Definition at line 801 of file mathutils_Color.c.

Referenced by PyInit_mathutils().