Reputation: 23104
Here is the code from user manual:
> stops = mkStops [(gray, 0, 1), (white, 0.5, 1), (purple, 1, 1)]
> gradient = mkLinearGradient stops ((-0.5) ^& 0) (0.5 ^& 0) GradPad
> sq1 = square 1 # fillTexture gradient
> sq2 = square 1 # fillTexture (gradient & _LG . lGradSpreadMethod .~ GradRepeat
> & _LG . lGradStart .~ (-0.1) ^& 0
> & _LG . lGradEnd .~ 0.1 ^& 0)
> sq3 = square 1 # fillTexture (gradient & _LG . lGradSpreadMethod .~ GradReflect
> & _LG . lGradStart .~ (-0.1) ^& 0
> & _LG . lGradEnd .~ 0.1 ^& 0)
>
> example = hcat' (with & sep .~ 0.25) [sq1, sq2, sq3]
Here is what I got:
Here is what it looks like in the manual:
They don't quite match.
ghc 7.8.3, OS X 10.10
diagrams 1.2
output: SVG
Upvotes: 2
Views: 101
Reputation: 2986
It looks like mac's svg renderer doesn't support spread methods. Here's screen shot from and Chrome (OS X 10.9.5, Chrome version 37) with the same svg:
Tools like imagemagick don't render them at all but this is a bug in the SVG backend that should be fixed in the next version.
I've actually been working on manually implementing spread methods for another backend so we'll probably add an option in the svg backend for this too, for better compatibility.
The Rasterific and Cairo backend gradients should (mostly) work. (Cairo's svg output still doesn't work with Safari but it does with imagemagick)
Upvotes: 1