Parse cell shading from fills. Args: fills (Shapes): Fill shapes representing cell shading.
(self, fills:Shapes)
| 59 | |
| 60 | |
| 61 | def parse_shading(self, fills:Shapes): |
| 62 | '''Parse cell shading from fills. |
| 63 | |
| 64 | Args: |
| 65 | fills (Shapes): Fill shapes representing cell shading. |
| 66 | ''' |
| 67 | # border width |
| 68 | top, bottom, left, right = self.borders |
| 69 | w_top = top.width |
| 70 | w_right = right.width |
| 71 | w_bottom = bottom.width |
| 72 | w_left = left.width |
| 73 | |
| 74 | # modify the cell bbox from border center to inner region |
| 75 | x0, y0, x1, y1 = self.merged_bbox |
| 76 | inner_bbox = (x0+w_left/2.0, y0+w_top/2.0, x1-w_right/2.0, y1-w_bottom/2.0) |
| 77 | target = Element().update_bbox(inner_bbox) |
| 78 | |
| 79 | # shading shape of this cell |
| 80 | for shape in fills: |
| 81 | if shape.contains(target, threshold=constants.FACTOR_MOST): |
| 82 | self.shading = shape |
| 83 | break |
| 84 | else: |
| 85 | self.shading = None |
| 86 | |
| 87 | |
| 88 | def _get_border_stroke(self, strokes:Shapes, direction:str='row'): |
no test coverage detected