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

Method GradientApplyTransformPt

svg/gradient.go:78–94  ·  view source on GitHub ↗

GradientApplyTransformPt applies the given transform with ctr point to any gradients for this node, that are using specific coordinates (not bounding box which is automatic)

(sv *SVG, xf math32.Matrix2, pt math32.Vector2)

Source from the content-addressed store, hash-verified

76// to any gradients for this node, that are using specific coordinates
77// (not bounding box which is automatic)
78func (g *NodeBase) GradientApplyTransformPt(sv *SVG, xf math32.Matrix2, pt math32.Vector2) {
79 gi := g.This.(Node)
80 gnm := NodePropURL(gi, "fill")
81 if gnm != "" {
82 gr := sv.GradientByName(gi, gnm)
83 if gr != nil {
84 gr.Grad.AsBase().Transform.SetMulCenter(xf, pt) // todo: ctr off?
85 }
86 }
87 gnm = NodePropURL(gi, "stroke")
88 if gnm != "" {
89 gr := sv.GradientByName(gi, gnm)
90 if gr != nil {
91 gr.Grad.AsBase().Transform.SetMulCenter(xf, pt)
92 }
93 }
94}
95
96// GradientWritePoints writes the gradient points to
97// a slice of floating point numbers, appending to end of slice.

Callers 6

ApplyDeltaTransformMethod · 0.80
ApplyDeltaTransformMethod · 0.80
ApplyDeltaTransformMethod · 0.80
ApplyDeltaTransformMethod · 0.80
ApplyDeltaTransformMethod · 0.80
ApplyDeltaTransformMethod · 0.80

Calls 4

NodePropURLFunction · 0.85
GradientByNameMethod · 0.80
SetMulCenterMethod · 0.80
AsBaseMethod · 0.65

Tested by

no test coverage detected