static PyObject* cms_profile_getattro(CmsProfileObject* self, PyObject* name) { PyObject* name_bytes; char* name_string; if (!PyUnicode_Check(name)) return NULL; if (!(name_bytes = PyUnicode_AsASCIIString(name))) return NULL; if (!(name_string = PyBytes_AsString(name_bytes))) return NULL; if (!strcmp(name_string, "product_name")) return PyUnicode_FromFormat("%s", cmsTakeProductName(self->profile)); if (!strcmp(name_string, "product_desc")) return PyUnicode_FromFormat("%s", cmsTakeProductDesc(self->profile)); if (!strcmp(name_string, "product_info")) return PyUnicode_FromFormat("%s", cmsTakeProductInfo(self->profile)); if (!strcmp(name_string, "rendering_intent")) return PyLong_FromLong(cmsTakeRenderingIntent(self->profile)); if (!strcmp(name_string, "pcs")) return PyUnicode_FromFormat("%s", findICmode(cmsGetPCS(self->profile))); if (!strcmp(name_string, "color_space")) return PyUnicode_FromFormat("%s", findICmode(cmsGetColorSpace(self->profile))); /* FIXME: add more properties (creation_datetime etc) */ return PyObject_GenericGetAttr((PyObject*)self, name); }
static PyObject* cms_profile_getattr(CmsProfileObject* self, char* name) { if (!strcmp(name, "product_name")) return PyString_FromString(cmsTakeProductName(self->profile)); if (!strcmp(name, "product_desc")) return PyString_FromString(cmsTakeProductDesc(self->profile)); if (!strcmp(name, "product_info")) return PyString_FromString(cmsTakeProductInfo(self->profile)); if (!strcmp(name, "rendering_intent")) return PyInt_FromLong(cmsTakeRenderingIntent(self->profile)); if (!strcmp(name, "pcs")) return PyString_FromString(findICmode(cmsGetPCS(self->profile))); if (!strcmp(name, "color_space")) return PyString_FromString(findICmode(cmsGetColorSpace(self->profile))); /* FIXME: add more properties (creation_datetime etc) */ return Py_FindMethod(cms_profile_methods, (PyObject*) self, name); }
static PyObject* cms_profile_getattr_color_space(CmsProfileObject* self, void* closure) { return PyUnicode_DecodeFSDefault(findICmode(cmsGetColorSpace(self->profile))); }
static PyObject* cms_profile_getattr_pcs(CmsProfileObject* self, void* closure) { return PyUnicode_DecodeFSDefault(findICmode(cmsGetPCS(self->profile))); }