| 901 | |
| 902 | // function _colorMixin({fill: Color(), stroke: Color(), strokewidth: 1.0, strokestyle: SOLID}) |
| 903 | function _colorMixin(options) { |
| 904 | var s = _ctx.state; |
| 905 | var o = options; |
| 906 | if (options === undefined) { |
| 907 | return [s.fill, s.stroke, s.strokewidth, s.strokestyle, s.linecap]; |
| 908 | } else { |
| 909 | return [ |
| 910 | (o.fill !== undefined)? |
| 911 | (o.fill instanceof Color || o.fill instanceof Gradient)? |
| 912 | o.fill : new Color(o.fill) : s.fill, |
| 913 | (o.stroke !== undefined)? |
| 914 | (o.stroke instanceof Color)? |
| 915 | o.stroke : new Color(o.stroke) : s.stroke, |
| 916 | (o.strokewidth !== undefined)? o.strokewidth : |
| 917 | (o.strokeWidth !== undefined)? o.strokeWidth : s.strokewidth, |
| 918 | (o.strokestyle !== undefined)? o.strokestyle : |
| 919 | (o.strokeStyle !== undefined)? o.strokeStyle : s.strokestyle, |
| 920 | (o.linecap !== undefined)? o.linecap : |
| 921 | (o.lineCap !== undefined)? o.lineCap : s.linecap |
| 922 | ]; |
| 923 | } |
| 924 | } |
| 925 | |
| 926 | /*--------------------------------------------------------------------------------------------------*/ |
| 927 | // Wrappers for _ctx.fill() and _ctx.stroke(), only calling them when necessary. |