Restore the saved region. If bbox (instance of BboxBase, or its extents) is given, only the region specified by the bbox will be restored. *xy* (a pair of floats) optionally specifies the new position (the LLC of the original region, not the LLC of the bbox)
(self, region, bbox=None, xy=None)
| 337 | return False |
| 338 | |
| 339 | def restore_region(self, region, bbox=None, xy=None): |
| 340 | """ |
| 341 | Restore the saved region. If bbox (instance of BboxBase, or |
| 342 | its extents) is given, only the region specified by the bbox |
| 343 | will be restored. *xy* (a pair of floats) optionally |
| 344 | specifies the new position (the LLC of the original region, |
| 345 | not the LLC of the bbox) where the region will be restored. |
| 346 | |
| 347 | >>> region = renderer.copy_from_bbox() |
| 348 | >>> x1, y1, x2, y2 = region.get_extents() |
| 349 | >>> renderer.restore_region(region, bbox=(x1+dx, y1, x2, y2), |
| 350 | ... xy=(x1-dx, y1)) |
| 351 | |
| 352 | """ |
| 353 | if bbox is not None or xy is not None: |
| 354 | if bbox is None: |
| 355 | x1, y1, x2, y2 = region.get_extents() |
| 356 | elif isinstance(bbox, BboxBase): |
| 357 | x1, y1, x2, y2 = bbox.extents |
| 358 | else: |
| 359 | x1, y1, x2, y2 = bbox |
| 360 | |
| 361 | if xy is None: |
| 362 | ox, oy = x1, y1 |
| 363 | else: |
| 364 | ox, oy = xy |
| 365 | |
| 366 | # The incoming data is float, but the _renderer type-checking wants |
| 367 | # to see integers. |
| 368 | self._renderer.restore_region(region, int(x1), int(y1), |
| 369 | int(x2), int(y2), int(ox), int(oy)) |
| 370 | |
| 371 | else: |
| 372 | self._renderer.restore_region(region) |
| 373 | |
| 374 | def start_filter(self): |
| 375 | """ |