MCPcopy
hub / github.com/tdewolff/canvas / SetColorSpace

Method SetColorSpace

patterns.go:86–97  ·  view source on GitHub ↗

SetColorSpace sets the color space. Automatically called by the rasterizer.

(colorSpace ColorSpace)

Source from the content-addressed store, hash-verified

84
85// SetColorSpace sets the color space. Automatically called by the rasterizer.
86func (p *HatchPattern) SetColorSpace(colorSpace ColorSpace) Pattern {
87 if _, ok := colorSpace.(LinearColorSpace); ok {
88 return p
89 }
90
91 if p.Fill.IsGradient() {
92 p.Fill.Gradient.SetColorSpace(colorSpace)
93 } else if p.Fill.IsColor() {
94 p.Fill.Color = colorSpace.ToLinear(p.Fill.Color)
95 }
96 return p
97}
98
99// Tile tiles the hatch pattern within the clipping path.
100func (p *HatchPattern) Tile(clip *Path) *Path {

Callers

nothing calls this directly

Calls 4

IsGradientMethod · 0.80
IsColorMethod · 0.80
SetColorSpaceMethod · 0.65
ToLinearMethod · 0.65

Tested by

no test coverage detected