MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _get_coordinates_of_block

Function _get_coordinates_of_block

lib/matplotlib/backends/backend_pdf.py:244–265  ·  view source on GitHub ↗

Get the coordinates of rotated rectangle and rectangle that covers the rotated rectangle.

(x, y, width, height, angle=0)

Source from the content-addressed store, hash-verified

242
243
244def _get_coordinates_of_block(x, y, width, height, angle=0):
245 """
246 Get the coordinates of rotated rectangle and rectangle that covers the
247 rotated rectangle.
248 """
249
250 vertices = _calculate_quad_point_coordinates(x, y, width,
251 height, angle)
252
253 # Find min and max values for rectangle
254 # adjust so that QuadPoints is inside Rect
255 # PDF docs says that QuadPoints should be ignored if any point lies
256 # outside Rect, but for Acrobat it is enough that QuadPoints is on the
257 # border of Rect.
258
259 pad = 0.00001 if angle % 90 else 0
260 min_x = min(v[0] for v in vertices) - pad
261 min_y = min(v[1] for v in vertices) - pad
262 max_x = max(v[0] for v in vertices) + pad
263 max_y = max(v[1] for v in vertices) + pad
264 return (tuple(itertools.chain.from_iterable(vertices)),
265 (min_x, min_y, max_x, max_y))
266
267
268def _get_link_annotation(gc, x, y, width, height, angle=0):

Callers 1

_get_link_annotationFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…