diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-24 03:00:25 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-11-24 03:00:25 +0100 |
| commit | f005d76468dc4c6a368b6f1f6eca69da25214e80 (patch) | |
| tree | 14a70c7fb9a58be9083dbd7492ecd94d030c18a9 /Backends/CairoBackend/src/Gradient.cs | |
| parent | 362d83b9556355b1d3dfb6cb892896ed33371521 (diff) | |
default Crow.CairoBackend ok
Diffstat (limited to 'Backends/CairoBackend/src/Gradient.cs')
| -rw-r--r-- | Backends/CairoBackend/src/Gradient.cs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Backends/CairoBackend/src/Gradient.cs b/Backends/CairoBackend/src/Gradient.cs index 3dd0d9d2..74ac7d48 100644 --- a/Backends/CairoBackend/src/Gradient.cs +++ b/Backends/CairoBackend/src/Gradient.cs @@ -28,11 +28,11 @@ // using System; -using Color = Drawing2D.Color; +using Drawing2D; namespace Crow.CairoBackend { - public class Gradient : Pattern + public class Gradient : Pattern, IGradient { protected Gradient (IntPtr handle, bool owned) : base (handle, owned) { @@ -41,20 +41,20 @@ namespace Crow.CairoBackend { public int ColorStopCount { get { int cnt; - NativeMethods.cairo_pattern_get_color_stop_count (Handle, out cnt); + NativeMethods.cairo_pattern_get_color_stop_count (handle, out cnt); return cnt; } } - - public Status AddColorStop (double offset, Color c) - { - NativeMethods.cairo_pattern_add_color_stop_rgba (Handle, offset, c.R / 255.0, c.G / 255.0, c.B / 255.0, c.A / 255.0); - return Status; - } + #region IGradient implementation + public void AddColorStop (double offset, Color c) + => NativeMethods.cairo_pattern_add_color_stop_rgba (handle, offset, c.R / 255.0, c.G / 255.0, c.B / 255.0, c.A / 255.0); + public void AddColorStop(float offset, float r, float g, float b, float a = 1) + => NativeMethods.cairo_pattern_add_color_stop_rgba (handle, offset, r, g, b, a); + #endregion public Status AddColorStopRgb (double offset, Color c) { - NativeMethods.cairo_pattern_add_color_stop_rgb (Handle, offset, c.R / 255.0, c.G / 255.0 / 255.0, c.B / 255.0); + NativeMethods.cairo_pattern_add_color_stop_rgb (handle, offset, c.R / 255.0, c.G / 255.0 / 255.0, c.B / 255.0); return Status; } } |