mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-05 14:10:52 +03:00
Merge pull request #3232 from hugovk/rm-draw_line
Remove unused draw_line, draw_point and getabc
This commit is contained in:
commit
afb5cee0f4
|
@ -2697,22 +2697,6 @@ _draw_ellipse(ImagingDrawObject* self, PyObject* args)
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
|
||||||
_draw_line(ImagingDrawObject* self, PyObject* args)
|
|
||||||
{
|
|
||||||
int x0, y0, x1, y1;
|
|
||||||
int ink;
|
|
||||||
if (!PyArg_ParseTuple(args, "(ii)(ii)i", &x0, &y0, &x1, &y1, &ink))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (ImagingDrawLine(self->image->image, x0, y0, x1, y1,
|
|
||||||
&ink, self->blend) < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
|
||||||
return Py_None;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
_draw_lines(ImagingDrawObject* self, PyObject* args)
|
_draw_lines(ImagingDrawObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
|
@ -2766,21 +2750,6 @@ _draw_lines(ImagingDrawObject* self, PyObject* args)
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
|
||||||
_draw_point(ImagingDrawObject* self, PyObject* args)
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
int ink;
|
|
||||||
if (!PyArg_ParseTuple(args, "(ii)i", &x, &y, &ink))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (ImagingDrawPoint(self->image->image, x, y, &ink, self->blend) < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
|
||||||
return Py_None;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
_draw_points(ImagingDrawObject* self, PyObject* args)
|
_draw_points(ImagingDrawObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
|
@ -2961,14 +2930,12 @@ _draw_rectangle(ImagingDrawObject* self, PyObject* args)
|
||||||
static struct PyMethodDef _draw_methods[] = {
|
static struct PyMethodDef _draw_methods[] = {
|
||||||
#ifdef WITH_IMAGEDRAW
|
#ifdef WITH_IMAGEDRAW
|
||||||
/* Graphics (ImageDraw) */
|
/* Graphics (ImageDraw) */
|
||||||
{"draw_line", (PyCFunction)_draw_line, 1},
|
|
||||||
{"draw_lines", (PyCFunction)_draw_lines, 1},
|
{"draw_lines", (PyCFunction)_draw_lines, 1},
|
||||||
#ifdef WITH_ARROW
|
#ifdef WITH_ARROW
|
||||||
{"draw_outline", (PyCFunction)_draw_outline, 1},
|
{"draw_outline", (PyCFunction)_draw_outline, 1},
|
||||||
#endif
|
#endif
|
||||||
{"draw_polygon", (PyCFunction)_draw_polygon, 1},
|
{"draw_polygon", (PyCFunction)_draw_polygon, 1},
|
||||||
{"draw_rectangle", (PyCFunction)_draw_rectangle, 1},
|
{"draw_rectangle", (PyCFunction)_draw_rectangle, 1},
|
||||||
{"draw_point", (PyCFunction)_draw_point, 1},
|
|
||||||
{"draw_points", (PyCFunction)_draw_points, 1},
|
{"draw_points", (PyCFunction)_draw_points, 1},
|
||||||
{"draw_arc", (PyCFunction)_draw_arc, 1},
|
{"draw_arc", (PyCFunction)_draw_arc, 1},
|
||||||
{"draw_bitmap", (PyCFunction)_draw_bitmap, 1},
|
{"draw_bitmap", (PyCFunction)_draw_bitmap, 1},
|
||||||
|
|
|
@ -674,47 +674,6 @@ font_getsize(FontObject* self, PyObject* args)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
|
||||||
font_getabc(FontObject* self, PyObject* args)
|
|
||||||
{
|
|
||||||
FT_ULong ch;
|
|
||||||
FT_Face face;
|
|
||||||
double a, b, c;
|
|
||||||
|
|
||||||
/* calculate ABC values for a given string */
|
|
||||||
|
|
||||||
PyObject* string;
|
|
||||||
if (!PyArg_ParseTuple(args, "O:getabc", &string))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
|
||||||
if (!PyUnicode_Check(string)) {
|
|
||||||
#else
|
|
||||||
if (!PyUnicode_Check(string) && !PyString_Check(string)) {
|
|
||||||
#endif
|
|
||||||
PyErr_SetString(PyExc_TypeError, "expected string");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (font_getchar(string, 0, &ch)) {
|
|
||||||
int index, error;
|
|
||||||
face = self->face;
|
|
||||||
index = FT_Get_Char_Index(face, ch);
|
|
||||||
/* Note: bitmap fonts within ttf fonts do not work, see #891/pr#960 */
|
|
||||||
error = FT_Load_Glyph(face, index, FT_LOAD_DEFAULT|FT_LOAD_NO_BITMAP);
|
|
||||||
if (error)
|
|
||||||
return geterror(error);
|
|
||||||
a = face->glyph->metrics.horiBearingX / 64.0;
|
|
||||||
b = face->glyph->metrics.width / 64.0;
|
|
||||||
c = (face->glyph->metrics.horiAdvance -
|
|
||||||
face->glyph->metrics.horiBearingX -
|
|
||||||
face->glyph->metrics.width) / 64.0;
|
|
||||||
} else
|
|
||||||
a = b = c = 0.0;
|
|
||||||
|
|
||||||
return Py_BuildValue("ddd", a, b, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
font_render(FontObject* self, PyObject* args)
|
font_render(FontObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
|
@ -854,7 +813,6 @@ font_dealloc(FontObject* self)
|
||||||
static PyMethodDef font_methods[] = {
|
static PyMethodDef font_methods[] = {
|
||||||
{"render", (PyCFunction) font_render, METH_VARARGS},
|
{"render", (PyCFunction) font_render, METH_VARARGS},
|
||||||
{"getsize", (PyCFunction) font_getsize, METH_VARARGS},
|
{"getsize", (PyCFunction) font_getsize, METH_VARARGS},
|
||||||
{"getabc", (PyCFunction) font_getabc, METH_VARARGS},
|
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user