(sv *SVG)
| 49 | } |
| 50 | |
| 51 | func (g *Rect) Render(sv *SVG) { |
| 52 | vis, pc := g.PushTransform(sv) |
| 53 | if !vis { |
| 54 | return |
| 55 | } |
| 56 | // TODO: figure out a better way to do this |
| 57 | bs := styles.Border{} |
| 58 | bs.Style.Set(styles.BorderSolid) |
| 59 | bs.Width.Set(pc.StrokeStyle.Width) |
| 60 | bs.Color.Set(pc.StrokeStyle.Color) |
| 61 | bs.Radius.Set(units.Px(g.Radius.X)) |
| 62 | if g.Radius.X == 0 && g.Radius.Y == 0 { |
| 63 | pc.DrawRectangle(g.Pos.X, g.Pos.Y, g.Size.X, g.Size.Y) |
| 64 | } else { |
| 65 | // todo: only supports 1 radius right now -- easy to add another |
| 66 | // SidesTODO: also support different radii for each corner |
| 67 | pc.DrawRoundedRectangle(g.Pos.X, g.Pos.Y, g.Size.X, g.Size.Y, styles.NewSideFloats(g.Radius.X)) |
| 68 | } |
| 69 | pc.FillStrokeClear() |
| 70 | g.BBoxes(sv) |
| 71 | g.RenderChildren(sv) |
| 72 | pc.PopTransform() |
| 73 | } |
| 74 | |
| 75 | // ApplyTransform applies the given 2D transform to the geometry of this node |
| 76 | // each node must define this for itself |
nothing calls this directly
no test coverage detected