Blender  V2.59
Defines | Functions | Variables
mathutils_Color.c File Reference
#include <Python.h>
#include "mathutils.h"
#include "BLI_math.h"
#include "BLI_utildefines.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_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)
static PyObject * Color_getChannel (ColorObject *self, void *type)
static int Color_setChannel (ColorObject *self, PyObject *value, void *type)
static PyObject * Color_getChannelHSV (ColorObject *self, void *type)
static int Color_setChannelHSV (ColorObject *self, PyObject *value, void *type)
static PyObject * Color_getHSV (ColorObject *self, void *UNUSED(closure))
static int Color_setHSV (ColorObject *self, PyObject *value, void *UNUSED(closure))
 PyDoc_STRVAR (color_doc,"This object gives access to Colors in Blender.")
PyObject * newColorObject (float *col, int type, PyTypeObject *base_type)
PyObject * newColorObject_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

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 195 of file mathutils_Color.c.

References BaseMath_WriteIndexCallback, COLOR_SIZE, and i.

Referenced by Color_ass_subscript(), and Color_setChannel().

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 312 of file mathutils_Color.c.

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

static PyObject* Color_copy ( ColorObject self) [static]

Definition at line 103 of file mathutils_Color.c.

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

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

Definition at line 511 of file mathutils_Color.c.

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

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

Definition at line 652 of file mathutils_Color.c.

References Color_item(), and GET_INT_FROM_POINTER.

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

Definition at line 663 of file mathutils_Color.c.

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

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

Definition at line 704 of file mathutils_Color.c.

References BaseMath_ReadCallback, NULL, and rgb_to_hsv().

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 176 of file mathutils_Color.c.

References BaseMath_ReadIndexCallback, COLOR_SIZE, i, and NULL.

Referenced by Color_getChannel(), and Color_subscript().

static int Color_len ( ColorObject UNUSEDself) [static]

Definition at line 170 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 461 of file mathutils_Color.c.

References COLOR_SIZE, mul_vn_vn_fl(), newColorObject(), 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_SIZE, mathutils_array_parse(), newColorObject(), 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 int Color_setChannel ( ColorObject self,
PyObject *  value,
void *  type 
) [static]

Definition at line 657 of file mathutils_Color.c.

References Color_ass_item(), and GET_INT_FROM_POINTER.

static int Color_setChannelHSV ( ColorObject self,
PyObject *  value,
void *  type 
) [static]
static int Color_setHSV ( ColorObject self,
PyObject *  value,
void *  UNUSEDclosure 
) [static]
static PyObject* Color_slice ( ColorObject self,
int  begin,
int  end 
) [static]

Definition at line 223 of file mathutils_Color.c.

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

Referenced by Color_subscript().

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

Definition at line 275 of file mathutils_Color.c.

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

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().

PyObject* newColorObject ( float *  col,
int  type,
PyTypeObject *  base_type 
)
PyObject* newColorObject_cb ( PyObject *  cb_user,
int  cb_type,
int  cb_subtype 
)

Definition at line 858 of file mathutils_Color.c.

References newColorObject(), and Py_NEW.

Referenced by pyrna_math_object_from_array().

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  ,
"This object gives access to Colors in Blender."   
)

Variable Documentation

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

Definition at line 358 of file mathutils_Color.c.

PyGetSetDef Color_getseters[] [static]
Initial value:
 {
        {(char *)"r", (getter)Color_getChannel, (setter)Color_setChannel, (char *)"Red color channel.\n\n:type: float", (void *)0},
        {(char *)"g", (getter)Color_getChannel, (setter)Color_setChannel, (char *)"Green color channel.\n\n:type: float", (void *)1},
        {(char *)"b", (getter)Color_getChannel, (setter)Color_setChannel, (char *)"Blue color channel.\n\n:type: float", (void *)2},

        {(char *)"h", (getter)Color_getChannelHSV, (setter)Color_setChannelHSV, (char *)"HSV Hue component in [0, 1].\n\n:type: float", (void *)0},
        {(char *)"s", (getter)Color_getChannelHSV, (setter)Color_setChannelHSV, (char *)"HSV Saturation component in [0, 1].\n\n:type: float", (void *)1},
        {(char *)"v", (getter)Color_getChannelHSV, (setter)Color_setChannelHSV, (char *)"HSV Value component in [0, 1].\n\n:type: float", (void *)2},

        {(char *)"hsv", (getter)Color_getHSV, (setter)Color_setHSV, (char *)"HSV Values in [0, 1].\n\n:type: float triplet", (void *)0},

        {(char *)"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
        {(char *)"owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
        {NULL, NULL, NULL, NULL, NULL}  
}

Definition at line 743 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 761 of file mathutils_Color.c.

PyNumberMethods Color_NumMethods [static]

Definition at line 614 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 345 of file mathutils_Color.c.

PyTypeObject color_Type

Definition at line 771 of file mathutils_Color.c.

Referenced by PyInit_mathutils().