PushTransform checks our bounding box and visibility, returning false if out of bounds. If visible, pushes our transform. Must be called as first step in Render.
(sv *SVG)
| 430 | // out of bounds. If visible, pushes our transform. |
| 431 | // Must be called as first step in Render. |
| 432 | func (g *NodeBase) PushTransform(sv *SVG) (bool, *paint.Context) { |
| 433 | g.BBox = image.Rectangle{} |
| 434 | if g.Paint.Off || g == nil || g.This == nil { |
| 435 | return false, nil |
| 436 | } |
| 437 | ni := g.This.(Node) |
| 438 | // if g.IsInvisible() { // just the Invisible flag |
| 439 | // return false, nil |
| 440 | // } |
| 441 | lbb := ni.LocalBBox() |
| 442 | g.BBox = g.LocalBBoxToWin(lbb) |
| 443 | g.VisBBox = sv.Geom.SizeRect().Intersect(g.BBox) |
| 444 | nvis := g.VisBBox == image.Rectangle{} |
| 445 | // g.SetInvisibleState(nvis) // don't set |
| 446 | |
| 447 | if nvis && !g.isDef { |
| 448 | return false, nil |
| 449 | } |
| 450 | |
| 451 | rs := &sv.RenderState |
| 452 | rs.PushTransform(g.Paint.Transform) |
| 453 | |
| 454 | pc := &paint.Context{rs, &g.Paint} |
| 455 | return true, pc |
| 456 | } |
| 457 | |
| 458 | func (g *NodeBase) RenderChildren(sv *SVG) { |
| 459 | for _, kid := range g.Children { |