Fixed gradient orientation
This commit is contained in:
parent
d5cb1b27fe
commit
28701d01ab
@ -14,14 +14,14 @@ func (pattern Gradient) AtWhen (x, y, width, height int) (c color.RGBA) {
|
|||||||
var position float64
|
var position float64
|
||||||
switch pattern.Orientation {
|
switch pattern.Orientation {
|
||||||
case OrientationVertical:
|
case OrientationVertical:
|
||||||
position = float64(x) / float64(width)
|
position = float64(y) / float64(height)
|
||||||
case OrientationDiagonalRight:
|
case OrientationDiagonalRight:
|
||||||
position = (float64(x) / float64(width) +
|
position = (float64(width - x) / float64(width) +
|
||||||
float64(y) / float64(height)) / 2
|
float64(y) / float64(height)) / 2
|
||||||
case OrientationHorizontal:
|
case OrientationHorizontal:
|
||||||
position = float64(y) / float64(height)
|
position = float64(x) / float64(width)
|
||||||
case OrientationDiagonalLeft:
|
case OrientationDiagonalLeft:
|
||||||
position = (float64(width - x) / float64(width) +
|
position = (float64(x) / float64(width) +
|
||||||
float64(y) / float64(height)) / 2
|
float64(y) / float64(height)) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,11 @@ func (element *Artist) Resize (width, height int) {
|
|||||||
artist.FillEllipse (
|
artist.FillEllipse (
|
||||||
element,
|
element,
|
||||||
artist.EllipticallyBordered {
|
artist.EllipticallyBordered {
|
||||||
Fill: uhex(0xFF0000FF),
|
Fill: artist.Gradient {
|
||||||
|
First: artist.NewUniform(hex(0x00FF00FF)),
|
||||||
|
Second: artist.NewUniform(hex(0x0000FFFF)),
|
||||||
|
Orientation: artist.OrientationVertical,
|
||||||
|
},
|
||||||
Stroke: artist.Stroke { Pattern: uhex(0x00FF00), Weight: 5 },
|
Stroke: artist.Stroke { Pattern: uhex(0x00FF00), Weight: 5 },
|
||||||
},
|
},
|
||||||
element.cellAt(0, 7))
|
element.cellAt(0, 7))
|
||||||
|
Reference in New Issue
Block a user