MCPcopy
hub / github.com/fogleman/primitive / Frames

Method Frames

primitive/model.go:66–84  ·  view source on GitHub ↗
(scoreDelta float64)

Source from the content-addressed store, hash-verified

64}
65
66func (model *Model) Frames(scoreDelta float64) []image.Image {
67 var result []image.Image
68 dc := model.newContext()
69 result = append(result, imageToRGBA(dc.Image()))
70 previous := 10.0
71 for i, shape := range model.Shapes {
72 c := model.Colors[i]
73 dc.SetRGBA255(c.R, c.G, c.B, c.A)
74 shape.Draw(dc, model.Scale)
75 dc.Fill()
76 score := model.Scores[i]
77 delta := previous - score
78 if delta >= scoreDelta {
79 previous = score
80 result = append(result, imageToRGBA(dc.Image()))
81 }
82 }
83 return result
84}
85
86func (model *Model) SVG() string {
87 bg := model.Background

Callers 1

mainFunction · 0.95

Calls 4

newContextMethod · 0.95
imageToRGBAFunction · 0.85
ImageMethod · 0.80
DrawMethod · 0.65

Tested by

no test coverage detected