diff --git a/src/PIL/ImageTk.py b/src/PIL/ImageTk.py index a788c9d1f13..fe9711c8441 100644 --- a/src/PIL/ImageTk.py +++ b/src/PIL/ImageTk.py @@ -190,8 +190,8 @@ def paste(self, im: Image.Image) -> None: if image.isblock() and im.mode == self.__mode: block = image else: - block = image.new_block(self.__mode, im.size) - image.convert2(block, image) # convert directly between buffers + block = Image.core.new_block(self.__mode, im.size) + image.convert2(block) # convert directly between buffers _pyimagingtkcall("PyImagingPhoto", self.__photo, block.id) diff --git a/src/_imaging.c b/src/_imaging.c index b08f2ed2f0e..9d98144c0ef 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; } @@ -3491,7 +3488,7 @@ _effect_spread(ImagingObject *self, PyObject *args) { } /* -------------------------------------------------------------------- */ -/* UTILITIES */ +/* UTILITIES */ /* -------------------------------------------------------------------- */ static PyObject * @@ -3527,7 +3524,7 @@ _getcodecstatus(PyObject *self, PyObject *args) { } /* -------------------------------------------------------------------- */ -/* DEBUGGING HELPERS */ +/* DEBUGGING HELPERS */ /* -------------------------------------------------------------------- */ static PyObject * @@ -3630,8 +3627,6 @@ static struct PyMethodDef methods[] = { {"effect_spread", (PyCFunction)_effect_spread, METH_VARARGS}, /* Misc. */ - {"new_block", (PyCFunction)_new_block, METH_VARARGS}, - {"save_ppm", (PyCFunction)_save_ppm, METH_VARARGS}, {NULL, NULL} /* sentinel */ @@ -4142,11 +4137,9 @@ static PyMethodDef functions[] = { {"blend", (PyCFunction)_blend, METH_VARARGS}, {"fill", (PyCFunction)_fill, METH_VARARGS}, {"new", (PyCFunction)_new, METH_VARARGS}, + {"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},