Get the coordinates of rotated rectangle and rectangle that covers the rotated rectangle.
(x, y, width, height, angle=0)
| 242 | |
| 243 | |
| 244 | def _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 | |
| 268 | def _get_link_annotation(gc, x, y, width, height, angle=0): |
no test coverage detected
searching dependent graphs…