From 50dd94664bb6b75f82ffbfb9090670af9b698091 Mon Sep 17 00:00:00 2001 From: Aleksandr Karpinskii Date: Tue, 17 Sep 2024 23:30:52 +0200 Subject: [PATCH] Correct types of _imaging methods Move new_block method to _imaging remove _imaging.convert method --- src/PIL/ImageTk.py | 2 +- src/_imaging.c | 26 ++++++++++---------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/PIL/ImageTk.py b/src/PIL/ImageTk.py index bf29fdba5..b095b589c 100644 --- a/src/PIL/ImageTk.py +++ b/src/PIL/ImageTk.py @@ -181,7 +181,7 @@ class PhotoImage: image = im.im if not image.isblock() or im.mode != self.__mode: block = Image.core.new_block(self.__mode, im.size) - image.convert2(block, image) # convert directly between buffers + image.convert2(block) # convert directly between buffers ptr = block.ptr _pyimagingtkcall("PyImagingPhoto", self.__photo, ptr) diff --git a/src/_imaging.c b/src/_imaging.c index b28284fb5..a1bd8b2ad 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -92,7 +92,7 @@ #define S16(v) ((v) < 32768 ? (v) : ((v) - 65536)) /* -------------------------------------------------------------------- */ -/* OBJECT ADMINISTRATION */ +/* OBJECT ADMINISTRATION */ /* -------------------------------------------------------------------- */ typedef struct { @@ -256,7 +256,7 @@ ImagingError_Clear(void) { } /* -------------------------------------------------------------------- */ -/* HELPERS */ +/* HELPERS */ /* -------------------------------------------------------------------- */ static int @@ -605,7 +605,7 @@ getink(PyObject *color, Imaging im, char *ink) { } /* -------------------------------------------------------------------- */ -/* FACTORIES */ +/* FACTORIES */ /* -------------------------------------------------------------------- */ static PyObject * @@ -688,7 +688,7 @@ _radial_gradient(PyObject *self, PyObject *args) { } static PyObject * -_alpha_composite(ImagingObject *self, PyObject *args) { +_alpha_composite(PyObject *self, PyObject *args) { ImagingObject *imagep1; ImagingObject *imagep2; @@ -702,7 +702,7 @@ _alpha_composite(ImagingObject *self, PyObject *args) { } static PyObject * -_blend(ImagingObject *self, PyObject *args) { +_blend(PyObject *self, PyObject *args) { ImagingObject *imagep1; ImagingObject *imagep2; double alpha; @@ -920,15 +920,12 @@ _convert(ImagingObject *self, PyObject *args) { static PyObject * _convert2(ImagingObject *self, PyObject *args) { - ImagingObject *imagep1; - ImagingObject *imagep2; - if (!PyArg_ParseTuple( - args, "O!O!", &Imaging_Type, &imagep1, &Imaging_Type, &imagep2 - )) { + ImagingObject *imagep; + if (!PyArg_ParseTuple(args, "O!", &Imaging_Type, &imagep)) { return NULL; } - if (!ImagingConvert2(imagep1->image, imagep2->image)) { + if (!ImagingConvert2(imagep->image, self->image)) { return NULL; } @@ -3487,7 +3484,7 @@ _effect_spread(ImagingObject *self, PyObject *args) { } /* -------------------------------------------------------------------- */ -/* UTILITIES */ +/* UTILITIES */ /* -------------------------------------------------------------------- */ static PyObject * @@ -3523,7 +3520,7 @@ _getcodecstatus(PyObject *self, PyObject *args) { } /* -------------------------------------------------------------------- */ -/* DEBUGGING HELPERS */ +/* DEBUGGING HELPERS */ /* -------------------------------------------------------------------- */ static PyObject * @@ -4162,9 +4159,6 @@ static PyMethodDef functions[] = { {"new_block", (PyCFunction)_new_block, METH_VARARGS}, {"merge", (PyCFunction)_merge, METH_VARARGS}, - /* Functions */ - {"convert", (PyCFunction)_convert2, METH_VARARGS}, - /* Codecs */ {"bcn_decoder", (PyCFunction)PyImaging_BcnDecoderNew, METH_VARARGS}, {"bit_decoder", (PyCFunction)PyImaging_BitDecoderNew, METH_VARARGS},