diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-02 12:10:35 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-02 12:10:35 +0100 |
| commit | 610dd6bb08138388ecdab8f86bbe556569490893 (patch) | |
| tree | e876ccff5b4dbc58aae1f1542f591ce7506fc6bd /src | |
| parent | 7fe5cc0563fa79df34c2b8fe5ca6283de7555b75 (diff) | |
IFill implementation
Diffstat (limited to 'src')
| -rw-r--r-- | src/Cairo/IFill.cs | 11 | ||||
| -rw-r--r-- | src/Colors.cs | 11 | ||||
| -rw-r--r-- | src/GraphicObjects/GraphicObject.cs | 2 | ||||
| -rw-r--r-- | src/OpenTKGameWindow.cs | 2 |
4 files changed, 23 insertions, 3 deletions
diff --git a/src/Cairo/IFill.cs b/src/Cairo/IFill.cs new file mode 100644 index 00000000..e3459bb0 --- /dev/null +++ b/src/Cairo/IFill.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace Crow +{ + public interface ICairoFill + { + void SetAsSource (Cairo.Context ctx); + } +} + diff --git a/src/Colors.cs b/src/Colors.cs index 61f9208f..b83a2a96 100644 --- a/src/Colors.cs +++ b/src/Colors.cs @@ -10,7 +10,7 @@ using System.Diagnostics; namespace Crow
{
- public struct Color
+ public struct Color : ICairoFill
{
#region CTOR
public Color(double _R, double _G, double _B, double _A)
@@ -148,6 +148,15 @@ namespace Crow return new Color (this.R, this.G, this.B, _A);
}
+ #region IFill implementation
+
+ public void SetAsSource (Cairo.Context ctx)
+ {
+ ctx.SetSourceRGBA (R, G, B, A);
+ }
+
+ #endregion
+
#region Predefined colors
public static readonly Color Transparent = new Color(0, 0, 0, 0, "Transparent");
public static readonly Color Clear = new Color(-1, -1, -1, -1, "Clear");
diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index 99513f14..cef2c501 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -707,7 +707,7 @@ namespace Crow {
Rectangle rBack = new Rectangle (Slot.Size);
- gr.SetSourceColor(Background);
+ Background.SetAsSource (gr);
CairoHelpers.CairoRectangle(gr,rBack,_cornerRadius);
gr.Fill ();
}
diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index ba458b54..a62f79f1 100644 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -294,7 +294,7 @@ namespace Crow #if DEBUG_CLIP_RECTANGLE
redrawClip.stroke (ctx, new Color(1.0,0,0,0.3));
#endif
- redrawClip.clearAndClip (ctx);//rajouté après, tester si utile
+ redrawClip.clearAndClip (ctx);
//Link.draw (ctx);
foreach (GraphicObject p in invGOList) {
|