(width, height float64, viewbox [4]float64)
| 100 | } |
| 101 | |
| 102 | func (svg *svgParser) init(width, height float64, viewbox [4]float64) { |
| 103 | svg.width, svg.height = width*96.0/25.4, height*96.0/25.4 |
| 104 | svg.diagonal = math.Sqrt((svg.width*svg.width + svg.height*svg.height) / 2.0) |
| 105 | |
| 106 | svg.c = New(width, height) |
| 107 | svg.ctx = NewContext(svg.c) |
| 108 | svg.ctx.SetCoordSystem(CartesianIV) |
| 109 | if 0.0 < viewbox[2] && 0.0 < viewbox[3] { |
| 110 | m := Identity.Scale(width/viewbox[2], height/viewbox[3]).Translate(-viewbox[0], -viewbox[1]) |
| 111 | svg.ctx.SetView(m) |
| 112 | } |
| 113 | svg.ctx.SetStrokeJoiner(MiterJoiner{BevelJoin, svgDefaultState.strokeMiterLimit}) |
| 114 | svg.state = svgDefaultState |
| 115 | } |
| 116 | |
| 117 | func (svg *svgParser) push(tag string, attrs map[string]string) { |
| 118 | svg.ctx.Push() |
no test coverage detected