Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove and deprecate unused methods in src#25728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ksunden merged 3 commits intomatplotlib:mainfromoscargus:srccleanup
May 10, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletionsdoc/api/next_api_changes/deprecations/25728-OG.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
``ft2font.FT2Image.draw_rect`` and ``ft2font.FT2Font.get_xys``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

... are deprecated as they are unused. If you rely on these, please let us know.
34 changes: 9 additions & 25 deletionssrc/_path.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -282,35 +282,15 @@ inline bool point_in_path(
return result[0] != 0;
}

template <class PathIterator, class PointArray, class ResultArray>
void points_on_path(PointArray &points,
const double r,
PathIterator &path,
agg::trans_affine &trans,
ResultArray result)
template <class PathIterator>
inline bool point_on_path(
double x, double y, const double r, PathIterator &path, agg::trans_affine &trans)
{
typedef agg::conv_transform<PathIterator> transformed_path_t;
typedef PathNanRemover<transformed_path_t> no_nans_t;
typedef agg::conv_curve<no_nans_t> curve_t;
typedef agg::conv_stroke<curve_t> stroke_t;

size_t i;
for (i = 0; i < points.size(); ++i) {
result[i] = false;
}

transformed_path_t trans_path(path, trans);
no_nans_t nan_removed_path(trans_path, true, path.has_codes());
curve_t curved_path(nan_removed_path);
stroke_t stroked_path(curved_path);
stroked_path.width(r * 2.0);
point_in_path_impl(points, stroked_path, result);
}

template <class PathIterator>
inline bool point_on_path(
double x, double y, const double r, PathIterator &path, agg::trans_affine &trans)
{
npy_intp shape[] = {1, 2};
numpy::array_view<double, 2> points(shape);
points(0, 0) = x;
Expand All@@ -319,8 +299,12 @@ inline bool point_on_path(
int result[1];
result[0] = 0;

points_on_path(points, r, path, trans, result);

transformed_path_t trans_path(path, trans);
no_nans_t nan_removed_path(trans_path, true, path.has_codes());
curve_t curved_path(nan_removed_path);
stroke_t stroked_path(curved_path);
stroked_path.width(r * 2.0);
point_in_path_impl(points, stroked_path, result);
return result[0] != 0;
}

Expand Down
95 changes: 0 additions & 95 deletionssrc/_path_wrapper.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -91,98 +91,6 @@ static PyObject *Py_points_in_path(PyObject *self, PyObject *args)
return results.pyobj();
}

const char *Py_point_on_path__doc__ =
"point_on_path(x, y, radius, path, trans)\n"
"--\n\n";

static PyObject *Py_point_on_path(PyObject *self, PyObject *args)
{
double x, y, r;
py::PathIterator path;
agg::trans_affine trans;
bool result;

if (!PyArg_ParseTuple(args,
"dddO&O&:point_on_path",
&x,
&y,
&r,
&convert_path,
&path,
&convert_trans_affine,
&trans)) {
return NULL;
}

CALL_CPP("point_on_path", (result = point_on_path(x, y, r, path, trans)));

if (result) {
Py_RETURN_TRUE;
} else {
Py_RETURN_FALSE;
}
}

const char *Py_points_on_path__doc__ =
"points_on_path(points, radius, path, trans)\n"
"--\n\n";

static PyObject *Py_points_on_path(PyObject *self, PyObject *args)
{
numpy::array_view<const double, 2> points;
double r;
py::PathIterator path;
agg::trans_affine trans;

if (!PyArg_ParseTuple(args,
"O&dO&O&:points_on_path",
&convert_points,
&points,
&r,
&convert_path,
&path,
&convert_trans_affine,
&trans)) {
return NULL;
}

npy_intp dims[] = { (npy_intp)points.size() };
numpy::array_view<uint8_t, 1> results(dims);

CALL_CPP("points_on_path", (points_on_path(points, r, path, trans, results)));

return results.pyobj();
}

const char *Py_get_path_extents__doc__ =
"get_path_extents(path, trans)\n"
"--\n\n";

static PyObject *Py_get_path_extents(PyObject *self, PyObject *args)
{
py::PathIterator path;
agg::trans_affine trans;

if (!PyArg_ParseTuple(
args, "O&O&:get_path_extents", &convert_path, &path, &convert_trans_affine, &trans)) {
return NULL;
}

extent_limits e;

CALL_CPP("get_path_extents", (reset_limits(e)));
CALL_CPP("get_path_extents", (update_path_extents(path, trans, e)));

npy_intp dims[] = { 2, 2 };
numpy::array_view<double, 2> extents(dims);
extents(0, 0) = e.x0;
extents(0, 1) = e.y0;
extents(1, 0) = e.x1;
extents(1, 1) = e.y1;

return extents.pyobj();
}

const char *Py_update_path_extents__doc__ =
"update_path_extents(path, trans, rect, minpos, ignore)\n"
"--\n\n";
Expand DownExpand Up@@ -845,9 +753,6 @@ static PyObject *Py_is_sorted(PyObject *self, PyObject *obj)
static PyMethodDef module_functions[] = {
{"point_in_path", (PyCFunction)Py_point_in_path, METH_VARARGS, Py_point_in_path__doc__},
{"points_in_path", (PyCFunction)Py_points_in_path, METH_VARARGS, Py_points_in_path__doc__},
{"point_on_path", (PyCFunction)Py_point_on_path, METH_VARARGS, Py_point_on_path__doc__},
{"points_on_path", (PyCFunction)Py_points_on_path, METH_VARARGS, Py_points_on_path__doc__},
{"get_path_extents", (PyCFunction)Py_get_path_extents, METH_VARARGS, Py_get_path_extents__doc__},
{"update_path_extents", (PyCFunction)Py_update_path_extents, METH_VARARGS, Py_update_path_extents__doc__},
{"get_path_collection_extents", (PyCFunction)Py_get_path_collection_extents, METH_VARARGS, Py_get_path_collection_extents__doc__},
{"point_in_path_collection", (PyCFunction)Py_point_in_path_collection, METH_VARARGS, Py_point_in_path_collection__doc__},
Expand Down
5 changes: 0 additions & 5 deletionssrc/ft2font.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -725,11 +725,6 @@ FT_UInt FT2Font::get_char_index(FT_ULong charcode, bool fallback = false)
return ft_get_char_index_or_warn(ft_object->get_face(), charcode, false);
}

void FT2Font::get_cbox(FT_BBox &bbox)
{
FT_Glyph_Get_CBox(glyphs.back(), ft_glyph_bbox_subpixels, &bbox);
}

void FT2Font::get_width_height(long *width, long *height)
{
*width = advance;
Expand Down
2 changes: 0 additions & 2 deletionssrc/ft2font.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,6 @@ class FT2Image

void resize(long width, long height);
void draw_bitmap(FT_Bitmap *bitmap, FT_Int x, FT_Int y);
void write_bitmap(FILE *fp) const;
void draw_rect(unsigned long x0, unsigned long y0, unsigned long x1, unsigned long y1);
void draw_rect_filled(unsigned long x0, unsigned long y0, unsigned long x1, unsigned long y1);

Expand DownExpand Up@@ -106,7 +105,6 @@ class FT2Font
void get_glyph_name(unsigned int glyph_number, char *buffer, bool fallback);
long get_name_index(char *name);
FT_UInt get_char_index(FT_ULong charcode, bool fallback);
void get_cbox(FT_BBox &bbox);
PyObject* get_path();
bool get_char_fallback_index(FT_ULong charcode, int& index) const;

Expand Down
25 changes: 23 additions & 2 deletionssrc/ft2font_wrapper.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,10 +69,21 @@ static void PyFT2Image_dealloc(PyFT2Image *self)
const char *PyFT2Image_draw_rect__doc__ =
"draw_rect(self, x0, y0, x1, y1)\n"
"--\n\n"
"Draw an empty rectangle to the image.\n";
"Draw an empty rectangle to the image.\n"
"\n"
".. deprecated:: 3.8\n";
;

static PyObject *PyFT2Image_draw_rect(PyFT2Image *self, PyObject *args)
{
char const* msg =
"FT2Image.draw_rect is deprecated since Matplotlib 3.8 and will be removed "
"two minor releases later as it is not used in the library. If you rely on "
"it, please let us know.";
if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1)) {
return NULL;
}

double x0, y0, x1, y1;

if (!PyArg_ParseTuple(args, "dddd:draw_rect", &x0, &y0, &x1, &y1)) {
Expand DownExpand Up@@ -820,10 +831,20 @@ static PyObject *PyFT2Font_draw_glyphs_to_bitmap(PyFT2Font *self, PyObject *args
const char *PyFT2Font_get_xys__doc__ =
"get_xys(self, antialiased=True)\n"
"--\n\n"
"Get the xy locations of the current glyphs.\n";
"Get the xy locations of the current glyphs.\n"
"\n"
".. deprecated:: 3.8\n";

static PyObject *PyFT2Font_get_xys(PyFT2Font *self, PyObject *args, PyObject *kwds)
{
char const* msg =
"FT2Font.get_xys is deprecated since Matplotlib 3.8 and will be removed two "
"minor releases later as it is not used in the library. If you rely on it, "
"please let us know.";
if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1)) {
return NULL;
}

bool antialiased = true;
std::vector<double> xys;
const char *names[] = { "antialiased", NULL };
Expand Down
11 changes: 0 additions & 11 deletionssrc/tri/_tri.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -133,11 +133,6 @@ double XYZ::dot(const XYZ& other) const
return x*other.x + y*other.y + z*other.z;
}

double XYZ::length_squared() const
{
return x*x + y*y + z*z;
}

XYZ XYZ::operator-(const XYZ& other) const
{
return XYZ(x - other.x, y - other.y, z - other.z);
Expand DownExpand Up@@ -182,12 +177,6 @@ ContourLine::ContourLine()
: std::vector<XY>()
{}

void ContourLine::insert_unique(iterator pos, const XY& point)
{
if (empty() || pos == end() || point != *pos)
std::vector<XY>::insert(pos, point);
}

void ContourLine::push_back(const XY& point)
{
if (empty() || point != back())
Expand Down
7 changes: 2 additions & 5 deletionssrc/tri/_tri.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -116,7 +116,6 @@ struct XYZ
XYZ(const double& x_, const double& y_, const double& z_);
XYZ cross(const XYZ& other) const;
double dot(const XYZ& other) const;
double length_squared() const;
XYZ operator-(const XYZ& other) const;
friend std::ostream& operator<<(std::ostream& os, const XYZ& xyz);

Expand All@@ -137,14 +136,12 @@ class BoundingBox
};

/* A single line of a contour, which may be a closed line loop or an open line
* strip. Identical adjacent points are avoided using insert_unique() and
* push_back(), and a closed line loop should also not have identical first and
* last points. */
* strip. Identical adjacent points are avoided using push_back(), and a closed
* line loop should also not have identical first and last points. */
class ContourLine : public std::vector<XY>
{
public:
ContourLine();
void insert_unique(iterator pos, const XY& point);
void push_back(const XY& point);
void write() const;
};
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp