Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/generic/imbuf_py_api.c
| Show First 20 Lines • Show All 422 Lines • ▼ Show 20 Lines | static PyObject *M_imbuf_new(PyObject *UNUSED(self), PyObject *args, PyObject *kw) | ||||
| static const char *_keywords[] = {"size", NULL}; | static const char *_keywords[] = {"size", NULL}; | ||||
| static _PyArg_Parser _parser = {"(ii)|i:new", _keywords, 0}; | static _PyArg_Parser _parser = {"(ii)|i:new", _keywords, 0}; | ||||
| if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &size[0], &size[1])) { | if (!_PyArg_ParseTupleAndKeywordsFast(args, kw, &_parser, &size[0], &size[1])) { | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* TODO, make options */ | /* TODO, make options */ | ||||
| uchar planes = 4; | uchar planes = 4; | ||||
| uint flags = IB_rect; | eImBufFlags flags = IB_rect; | ||||
| ImBuf *ibuf = IMB_allocImBuf(UNPACK2(size), planes, flags); | ImBuf *ibuf = IMB_allocImBuf(UNPACK2(size), planes, flags); | ||||
| if (ibuf == NULL) { | if (ibuf == NULL) { | ||||
| PyErr_Format(PyExc_ValueError, "new: Unable to create image (%d, %d)", UNPACK2(size)); | PyErr_Format(PyExc_ValueError, "new: Unable to create image (%d, %d)", UNPACK2(size)); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| return Py_ImBuf_CreatePyObject(ibuf); | return Py_ImBuf_CreatePyObject(ibuf); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines | |||||