mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-05 21:53:15 +03:00
DWORD -> cmsUInt32Number
This commit is contained in:
parent
e5a6615ad2
commit
db4f11a05c
|
@ -392,30 +392,34 @@ createProfile(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
char *sColorSpace;
|
char *sColorSpace;
|
||||||
cmsHPROFILE hProfile;
|
cmsHPROFILE hProfile;
|
||||||
int iColorTemp = 0;
|
cmsFloat64Number dColorTemp = 0.0;
|
||||||
LPcmsCIExyY whitePoint = NULL;
|
cmsCIExyY *whitePoint = NULL;
|
||||||
LCMSBOOL result;
|
cmsBool result;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s|i:createProfile", &sColorSpace, &iColorTemp))
|
if (!PyArg_ParseTuple(args, "s|d:createProfile", &sColorSpace, &dColorTemp))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (strcmp(sColorSpace, "LAB") == 0) {
|
if (strcmp(sColorSpace, "LAB") == 0) {
|
||||||
if (iColorTemp > 0) {
|
if (dColorTemp > 0.0) {
|
||||||
result = cmsWhitePointFromTemp(iColorTemp, whitePoint);
|
result = cmsWhitePointFromTemp(whitePoint, dColorTemp);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
PyErr_SetString(PyExc_ValueError, "ERROR: Could not calculate white point from color temperature provided, must be integer in degrees Kelvin");
|
PyErr_SetString(PyExc_ValueError, "ERROR: Could not calculate white point from color temperature provided, must be float in degrees Kelvin");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
hProfile = cmsCreateLabProfile(whitePoint);
|
hProfile = cmsCreateLabProfile(whitePoint);
|
||||||
} else
|
} else {
|
||||||
hProfile = cmsCreateLabProfile(NULL);
|
hProfile = cmsCreateLabProfile(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(sColorSpace, "XYZ") == 0)
|
else if (strcmp(sColorSpace, "XYZ") == 0) {
|
||||||
hProfile = cmsCreateXYZProfile();
|
hProfile = cmsCreateXYZProfile();
|
||||||
else if (strcmp(sColorSpace, "sRGB") == 0)
|
}
|
||||||
|
else if (strcmp(sColorSpace, "sRGB") == 0) {
|
||||||
hProfile = cmsCreate_sRGBProfile();
|
hProfile = cmsCreate_sRGBProfile();
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
hProfile = NULL;
|
hProfile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!hProfile) {
|
if (!hProfile) {
|
||||||
PyErr_SetString(PyExc_ValueError, "failed to create requested color space");
|
PyErr_SetString(PyExc_ValueError, "failed to create requested color space");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user