diff options
-rw-r--r-- | include/mupdf/fitz/geometry.h | 3 | ||||
-rw-r--r-- | source/fitz/geometry.c | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/mupdf/fitz/geometry.h b/include/mupdf/fitz/geometry.h index 9ae058eb..9127c34f 100644 --- a/include/mupdf/fitz/geometry.h +++ b/include/mupdf/fitz/geometry.h @@ -646,4 +646,7 @@ struct fz_quad_s fz_rect fz_rect_from_quad(fz_quad q); fz_quad *fz_transform_quad(fz_quad *q, const fz_matrix *m); +int fz_is_point_inside_rect(fz_point p, fz_rect r); +int fz_is_point_inside_irect(int x, int y, fz_irect r); + #endif diff --git a/source/fitz/geometry.c b/source/fitz/geometry.c index 3857ce35..7cced024 100644 --- a/source/fitz/geometry.c +++ b/source/fitz/geometry.c @@ -598,3 +598,13 @@ fz_transform_quad(fz_quad *q, const fz_matrix *m) fz_transform_point(&q->lr, m); return q; } + +int fz_is_point_inside_rect(fz_point p, fz_rect r) +{ + return (p.x >= r.x0 && p.x < r.x1 && p.y >= r.y0 && p.y < r.y1); +} + +int fz_is_point_inside_irect(int x, int y, fz_irect r) +{ + return (x >= r.x0 && x < r.x1 && y >= r.y0 && y < r.y1); +} |