ParTransform returns the full compounded 2D transform matrix for all of the parents of this node. If self is true, then include our own transform too.
(self bool)
| 160 | // of the parents of this node. If self is true, then include our |
| 161 | // own transform too. |
| 162 | func (g *NodeBase) ParTransform(self bool) math32.Matrix2 { |
| 163 | pars := []Node{} |
| 164 | xf := math32.Identity2() |
| 165 | n := g.This.(Node) |
| 166 | for { |
| 167 | if n.AsTree().Parent == nil { |
| 168 | break |
| 169 | } |
| 170 | n = n.AsTree().Parent.(Node) |
| 171 | pars = append(pars, n) |
| 172 | } |
| 173 | np := len(pars) |
| 174 | if np > 0 { |
| 175 | xf = pars[np-1].AsNodeBase().PaintStyle().Transform |
| 176 | } |
| 177 | for i := np - 2; i >= 0; i-- { |
| 178 | n := pars[i] |
| 179 | xf.SetMul(n.AsNodeBase().PaintStyle().Transform) |
| 180 | } |
| 181 | if self { |
| 182 | xf.SetMul(g.Paint.Transform) |
| 183 | } |
| 184 | return xf |
| 185 | } |
| 186 | |
| 187 | // ApplyTransform applies the given 2D transform to the geometry of this node |
| 188 | // this just does a direct transform multiplication on coordinates. |
no test coverage detected