Gradients in MVG, does not obey geometry

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Gradients in MVG, does not obey geometry

Post by anthony »

I have been playing with MVG gradients.

Code: Select all

viewbox 0 0 320 100
translate 30 50

push defs
push gradient 'bar_gradient' linear 0,-32 0,32
stop-color 'rgb(0,255,0)' 0%
stop-color 'rgb(0,128,0)' 100%
pop gradient
pop defs

push graphic-context
fill 'url(#bar_gradient)' stroke black stroke-width 1
roundrectangle -16,-32 146,32 16,32
pop graphic-context
It you give this to convert
convert gradient_test.mvg show:

The result is that the gradient does not obey the translation or its internal offsets!
The vertical length of the gradient is obeyed, but the top (0% stop) is pegged to the top of the drawing space.
It does not obey either the 'start point' specified or the translation of the coordinate system.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Gradients in MVG, does not obey geometry

Post by anthony »

In similar way only the last two 'colors' are actually used.

that is substituting this into the above only produces a green to black gradient!!!

Code: Select all

push gradient 'bar_gradient' linear 0,0 0,100
stop-color 'white' 0%
stop-color 'lime' 30%
stop-color 'green' 60%
stop-color 'black' 100%
I though gradient had been improved in MVG! with expansion of the stop colors.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply