@@ -99,103 +99,6 @@ static PyObject *PyFT2Image_draw_rect_filled(PyFT2Image *self, PyObject *args, P
99
99
Py_RETURN_NONE;
100
100
}
101
101
102
- const char *PyFT2Image_as_str__doc__ =
103
- " s = image.as_str()\n "
104
- " \n "
105
- " [*Deprecated*]\n "
106
- " Return the image buffer as a string\n "
107
- " \n " ;
108
-
109
- static PyObject *PyFT2Image_as_str (PyFT2Image *self, PyObject *args, PyObject *kwds)
110
- {
111
- if (PyErr_WarnEx (PyExc_FutureWarning,
112
- " FT2Image.as_str is deprecated since Matplotlib 3.2 and "
113
- " will be removed in Matplotlib 3.4; convert the FT2Image "
114
- " to a NumPy array with np.asarray instead." ,
115
- 1 )) {
116
- return NULL ;
117
- }
118
- return PyBytes_FromStringAndSize ((const char *)self->x ->get_buffer (),
119
- self->x ->get_width () * self->x ->get_height ());
120
- }
121
-
122
- const char *PyFT2Image_as_rgba_str__doc__ =
123
- " s = image.as_rgba_str()\n "
124
- " \n "
125
- " [*Deprecated*]\n "
126
- " Return the image buffer as a RGBA string\n "
127
- " \n " ;
128
-
129
- static PyObject *PyFT2Image_as_rgba_str (PyFT2Image *self, PyObject *args, PyObject *kwds)
130
- {
131
- if (PyErr_WarnEx (PyExc_FutureWarning,
132
- " FT2Image.as_rgba_str is deprecated since Matplotlib 3.2 and "
133
- " will be removed in Matplotlib 3.4; convert the FT2Image "
134
- " to a NumPy array with np.asarray instead." ,
135
- 1 )) {
136
- return NULL ;
137
- }
138
- npy_intp dims[] = {(npy_intp)self->x ->get_height (), (npy_intp)self->x ->get_width (), 4 };
139
- numpy::array_view<unsigned char , 3 > result (dims);
140
-
141
- unsigned char *src = self->x ->get_buffer ();
142
- unsigned char *end = src + (self->x ->get_width () * self->x ->get_height ());
143
- unsigned char *dst = result.data ();
144
-
145
- while (src != end) {
146
- *dst++ = 0 ;
147
- *dst++ = 0 ;
148
- *dst++ = 0 ;
149
- *dst++ = *src++;
150
- }
151
-
152
- return result.pyobj ();
153
- }
154
-
155
- const char *PyFT2Image_as_array__doc__ =
156
- " x = image.as_array()\n "
157
- " \n "
158
- " [*Deprecated*]\n "
159
- " Return the image buffer as a width x height numpy array of ubyte \n "
160
- " \n " ;
161
-
162
- static PyObject *PyFT2Image_as_array (PyFT2Image *self, PyObject *args, PyObject *kwds)
163
- {
164
- if (PyErr_WarnEx (PyExc_FutureWarning,
165
- " FT2Image.as_array is deprecated since Matplotlib 3.2 and "
166
- " will be removed in Matplotlib 3.4; convert the FT2Image "
167
- " to a NumPy array with np.asarray instead." ,
168
- 1 )) {
169
- return NULL ;
170
- }
171
- npy_intp dims[] = {(npy_intp)self->x ->get_height (), (npy_intp)self->x ->get_width () };
172
- return PyArray_SimpleNewFromData (2 , dims, NPY_UBYTE, self->x ->get_buffer ());
173
- }
174
-
175
- static PyObject *PyFT2Image_get_width (PyFT2Image *self, PyObject *args, PyObject *kwds)
176
- {
177
- if (PyErr_WarnEx (PyExc_FutureWarning,
178
- " FT2Image.get_width is deprecated since Matplotlib 3.2 and "
179
- " will be removed in Matplotlib 3.4; convert the FT2Image "
180
- " to a NumPy array with np.asarray instead." ,
181
- 1 )) {
182
- return NULL ;
183
- }
184
- return PyLong_FromLong (self->x ->get_width ());
185
- }
186
-
187
- static PyObject *PyFT2Image_get_height (PyFT2Image *self, PyObject *args, PyObject *kwds)
188
- {
189
- if (PyErr_WarnEx (PyExc_FutureWarning,
190
- " FT2Image.get_height is deprecated since Matplotlib 3.2 and "
191
- " will be removed in Matplotlib 3.4; convert the FT2Image "
192
- " to a NumPy array with np.asarray instead." ,
193
- 1 )) {
194
- return NULL ;
195
- }
196
- return PyLong_FromLong (self->x ->get_height ());
197
- }
198
-
199
102
static int PyFT2Image_get_buffer (PyFT2Image *self, Py_buffer *buf, int flags)
200
103
{
201
104
FT2Image *im = self->x ;
@@ -227,11 +130,6 @@ static PyTypeObject *PyFT2Image_init_type(PyObject *m, PyTypeObject *type)
227
130
static PyMethodDef methods[] = {
228
131
{" draw_rect" , (PyCFunction)PyFT2Image_draw_rect, METH_VARARGS, PyFT2Image_draw_rect__doc__},
229
132
{" draw_rect_filled" , (PyCFunction)PyFT2Image_draw_rect_filled, METH_VARARGS, PyFT2Image_draw_rect_filled__doc__},
230
- {" as_str" , (PyCFunction)PyFT2Image_as_str, METH_NOARGS, PyFT2Image_as_str__doc__},
231
- {" as_rgba_str" , (PyCFunction)PyFT2Image_as_rgba_str, METH_NOARGS, PyFT2Image_as_rgba_str__doc__},
232
- {" as_array" , (PyCFunction)PyFT2Image_as_array, METH_NOARGS, PyFT2Image_as_array__doc__},
233
- {" get_width" , (PyCFunction)PyFT2Image_get_width, METH_NOARGS, NULL },
234
- {" get_height" , (PyCFunction)PyFT2Image_get_height, METH_NOARGS, NULL },
235
133
{NULL }
236
134
};
237
135
0 commit comments