MCPcopy Create free account
hub / github.com/cogentcore/core / GradientNewForNode

Method GradientNewForNode

svg/gradient.go:207–213  ·  view source on GitHub ↗

GradientNewForNode adds a new gradient specific to given node that points to given stops name. returns the new gradient and the url that points to it (nil if parent svg cannot be found). Initializes gradient to use bounding box of object, but using userSpaceOnUse setting

(n Node, radial bool, stops string)

Source from the content-addressed store, hash-verified

205// and the url that points to it (nil if parent svg cannot be found).
206// Initializes gradient to use bounding box of object, but using userSpaceOnUse setting
207func (sv *SVG) GradientNewForNode(n Node, radial bool, stops string) (*Gradient, string) {
208 gr, url := sv.GradientNew(radial)
209 gr.StopsName = stops
210 gr.Grad.AsBase().SetBox(n.LocalBBox())
211 sv.GradientUpdateStops(gr)
212 return gr, url
213}
214
215// GradientNew adds a new gradient, either linear or radial,
216// with a new unique id

Callers 2

GradientCloneNodePropMethod · 0.95

Calls 5

GradientNewMethod · 0.95
GradientUpdateStopsMethod · 0.95
SetBoxMethod · 0.80
AsBaseMethod · 0.65
LocalBBoxMethod · 0.65

Tested by

no test coverage detected