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

Method Add

primitive/model.go:103–117  ·  view source on GitHub ↗
(shape Shape, alpha int)

Source from the content-addressed store, hash-verified

101}
102
103func (model *Model) Add(shape Shape, alpha int) {
104 before := copyRGBA(model.Current)
105 lines := shape.Rasterize()
106 color := computeColor(model.Target, model.Current, lines, alpha)
107 drawLines(model.Current, color, lines)
108 score := differencePartial(model.Target, before, model.Current, model.Score, lines)
109
110 model.Score = score
111 model.Shapes = append(model.Shapes, shape)
112 model.Colors = append(model.Colors, color)
113 model.Scores = append(model.Scores, score)
114
115 model.Context.SetRGBA255(color.R, color.G, color.B, color.A)
116 shape.Draw(model.Context, model.Scale)
117}
118
119func (model *Model) Step(shapeType ShapeType, alpha, repeat int) int {
120 state := model.runWorkers(shapeType, alpha, 1000, 100, 16)

Callers 1

StepMethod · 0.95

Calls 6

copyRGBAFunction · 0.85
computeColorFunction · 0.85
drawLinesFunction · 0.85
differencePartialFunction · 0.85
RasterizeMethod · 0.65
DrawMethod · 0.65

Tested by

no test coverage detected