| 11 | xg::shape::Element::Element() { InitTransform(); } |
| 12 | |
| 13 | void xg::shape::Element::Draw(canvas::CanvasContext &context) const { |
| 14 | if(IsDestroyed()) { |
| 15 | return; |
| 16 | } |
| 17 | |
| 18 | if(IsVisible()) { |
| 19 | //clip之前需要看是否需要有子shape的多段切割 |
| 20 | // SetContext(context); |
| 21 | if (NeedShapeClip(context, [&](string value) { |
| 22 | context.Save(); |
| 23 | DoClipByIdentifier(context, value); |
| 24 | ResetContext(context); |
| 25 | ResetTransform(context); |
| 26 | DrawInner(context); |
| 27 | RestoreContext(context); |
| 28 | })) { |
| 29 | // |
| 30 | } else { |
| 31 | SetContext(context); |
| 32 | //Group 或者 Shape |
| 33 | //如果是Group的话,继续调用链路 |
| 34 | DrawInner(context); |
| 35 | RestoreContext(context); |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | void xg::shape::Element::Destroy() { |
| 41 | if(IsDestroyed()) { |