mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-06 22:23:16 +03:00
Merge pull request #7931 from Yay295/imagingcms_modes
Remove unused CMS properties and fix documentation
This commit is contained in:
commit
f8ec9f7974
|
@ -704,12 +704,12 @@ def applyTransform(
|
||||||
"""
|
"""
|
||||||
(pyCMS) Applies a transform to a given image.
|
(pyCMS) Applies a transform to a given image.
|
||||||
|
|
||||||
If ``im.mode != transform.inMode``, a :exc:`PyCMSError` is raised.
|
If ``im.mode != transform.input_mode``, a :exc:`PyCMSError` is raised.
|
||||||
|
|
||||||
If ``inPlace`` is ``True`` and ``transform.inMode != transform.outMode``, a
|
If ``inPlace`` is ``True`` and ``transform.input_mode != transform.output_mode``, a
|
||||||
:exc:`PyCMSError` is raised.
|
:exc:`PyCMSError` is raised.
|
||||||
|
|
||||||
If ``im.mode``, ``transform.inMode`` or ``transform.outMode`` is not
|
If ``im.mode``, ``transform.input_mode`` or ``transform.output_mode`` is not
|
||||||
supported by pyCMSdll or the profiles you used for the transform, a
|
supported by pyCMSdll or the profiles you used for the transform, a
|
||||||
:exc:`PyCMSError` is raised.
|
:exc:`PyCMSError` is raised.
|
||||||
|
|
||||||
|
@ -723,13 +723,13 @@ def applyTransform(
|
||||||
|
|
||||||
If you want to modify im in-place instead of receiving a new image as
|
If you want to modify im in-place instead of receiving a new image as
|
||||||
the return value, set ``inPlace`` to ``True``. This can only be done if
|
the return value, set ``inPlace`` to ``True``. This can only be done if
|
||||||
``transform.inMode`` and ``transform.outMode`` are the same, because we can't
|
``transform.input_mode`` and ``transform.output_mode`` are the same, because we
|
||||||
change the mode in-place (the buffer sizes for some modes are
|
can't change the mode in-place (the buffer sizes for some modes are
|
||||||
different). The default behavior is to return a new :py:class:`~PIL.Image.Image`
|
different). The default behavior is to return a new :py:class:`~PIL.Image.Image`
|
||||||
object of the same dimensions in mode ``transform.outMode``.
|
object of the same dimensions in mode ``transform.output_mode``.
|
||||||
|
|
||||||
:param im: An :py:class:`~PIL.Image.Image` object, and im.mode must be the same
|
:param im: An :py:class:`~PIL.Image.Image` object, and ``im.mode`` must be the same
|
||||||
as the ``inMode`` supported by the transform.
|
as the ``input_mode`` supported by the transform.
|
||||||
:param transform: A valid CmsTransform class object
|
:param transform: A valid CmsTransform class object
|
||||||
:param inPlace: Bool. If ``True``, ``im`` is modified in place and ``None`` is
|
:param inPlace: Bool. If ``True``, ``im`` is modified in place and ``None`` is
|
||||||
returned, if ``False``, a new :py:class:`~PIL.Image.Image` object with the
|
returned, if ``False``, a new :py:class:`~PIL.Image.Image` object with the
|
||||||
|
|
|
@ -108,10 +108,6 @@ class CmsProfile:
|
||||||
def is_intent_supported(self, intent: int, direction: int, /) -> int: ...
|
def is_intent_supported(self, intent: int, direction: int, /) -> int: ...
|
||||||
|
|
||||||
class CmsTransform:
|
class CmsTransform:
|
||||||
@property
|
|
||||||
def inputMode(self) -> str: ...
|
|
||||||
@property
|
|
||||||
def outputMode(self) -> str: ...
|
|
||||||
def apply(self, id_in: int, id_out: int) -> int: ...
|
def apply(self, id_in: int, id_out: int) -> int: ...
|
||||||
|
|
||||||
def profile_open(profile: str, /) -> CmsProfile: ...
|
def profile_open(profile: str, /) -> CmsProfile: ...
|
||||||
|
|
|
@ -181,9 +181,7 @@ cms_profile_dealloc(CmsProfileObject *self) {
|
||||||
/* a transform represents the mapping between two profiles */
|
/* a transform represents the mapping between two profiles */
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD char mode_in[8];
|
PyObject_HEAD cmsHTRANSFORM transform;
|
||||||
char mode_out[8];
|
|
||||||
cmsHTRANSFORM transform;
|
|
||||||
} CmsTransformObject;
|
} CmsTransformObject;
|
||||||
|
|
||||||
static PyTypeObject CmsTransform_Type;
|
static PyTypeObject CmsTransform_Type;
|
||||||
|
@ -191,7 +189,7 @@ static PyTypeObject CmsTransform_Type;
|
||||||
#define CmsTransform_Check(op) (Py_TYPE(op) == &CmsTransform_Type)
|
#define CmsTransform_Check(op) (Py_TYPE(op) == &CmsTransform_Type)
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
cms_transform_new(cmsHTRANSFORM transform, char *mode_in, char *mode_out) {
|
cms_transform_new(cmsHTRANSFORM transform) {
|
||||||
CmsTransformObject *self;
|
CmsTransformObject *self;
|
||||||
|
|
||||||
self = PyObject_New(CmsTransformObject, &CmsTransform_Type);
|
self = PyObject_New(CmsTransformObject, &CmsTransform_Type);
|
||||||
|
@ -201,9 +199,6 @@ cms_transform_new(cmsHTRANSFORM transform, char *mode_in, char *mode_out) {
|
||||||
|
|
||||||
self->transform = transform;
|
self->transform = transform;
|
||||||
|
|
||||||
strncpy(self->mode_in, mode_in, 8);
|
|
||||||
strncpy(self->mode_out, mode_out, 8);
|
|
||||||
|
|
||||||
return (PyObject *)self;
|
return (PyObject *)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +390,7 @@ _buildTransform(
|
||||||
|
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
|
|
||||||
if (!hTransform) {
|
if (!hTransform) {
|
||||||
PyErr_SetString(PyExc_ValueError, "cannot build transform");
|
PyErr_SetString(PyExc_ValueError, "cannot build transform");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +424,7 @@ _buildProofTransform(
|
||||||
|
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
|
|
||||||
if (!hTransform) {
|
if (!hTransform) {
|
||||||
PyErr_SetString(PyExc_ValueError, "cannot build proof transform");
|
PyErr_SetString(PyExc_ValueError, "cannot build proof transform");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +471,7 @@ buildTransform(PyObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cms_transform_new(transform, sInMode, sOutMode);
|
return cms_transform_new(transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -523,7 +518,7 @@ buildProofTransform(PyObject *self, PyObject *args) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cms_transform_new(transform, sInMode, sOutMode);
|
return cms_transform_new(transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -1456,21 +1451,6 @@ static struct PyMethodDef cms_transform_methods[] = {
|
||||||
{"apply", (PyCFunction)cms_transform_apply, 1}, {NULL, NULL} /* sentinel */
|
{"apply", (PyCFunction)cms_transform_apply, 1}, {NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
cms_transform_getattr_inputMode(CmsTransformObject *self, void *closure) {
|
|
||||||
return PyUnicode_FromString(self->mode_in);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *
|
|
||||||
cms_transform_getattr_outputMode(CmsTransformObject *self, void *closure) {
|
|
||||||
return PyUnicode_FromString(self->mode_out);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct PyGetSetDef cms_transform_getsetters[] = {
|
|
||||||
{"inputMode", (getter)cms_transform_getattr_inputMode},
|
|
||||||
{"outputMode", (getter)cms_transform_getattr_outputMode},
|
|
||||||
{NULL}};
|
|
||||||
|
|
||||||
static PyTypeObject CmsTransform_Type = {
|
static PyTypeObject CmsTransform_Type = {
|
||||||
PyVarObject_HEAD_INIT(NULL, 0) "PIL.ImageCms.core.CmsTransform", /*tp_name*/
|
PyVarObject_HEAD_INIT(NULL, 0) "PIL.ImageCms.core.CmsTransform", /*tp_name*/
|
||||||
sizeof(CmsTransformObject), /*tp_basicsize*/
|
sizeof(CmsTransformObject), /*tp_basicsize*/
|
||||||
|
@ -1501,7 +1481,7 @@ static PyTypeObject CmsTransform_Type = {
|
||||||
0, /*tp_iternext*/
|
0, /*tp_iternext*/
|
||||||
cms_transform_methods, /*tp_methods*/
|
cms_transform_methods, /*tp_methods*/
|
||||||
0, /*tp_members*/
|
0, /*tp_members*/
|
||||||
cms_transform_getsetters, /*tp_getset*/
|
0, /*tp_getset*/
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue
Block a user