]> O.S.I.I.S - jp/crow.git/commitdiff
IFill implementation
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 2 Feb 2016 11:10:35 +0000 (12:10 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 2 Feb 2016 11:10:35 +0000 (12:10 +0100)
Crow.csproj
src/Cairo/IFill.cs [new file with mode: 0644]
src/Colors.cs
src/GraphicObjects/GraphicObject.cs
src/OpenTKGameWindow.cs

index 7a253daed021fd6ce383c9c4037489e850f234c4..26f028c1ec5395293f219d4e8ddd189312a2c3b5 100644 (file)
     <Compile Include="src\GraphicObjects\GroupBox.cs" />\r
     <Compile Include="src\GraphicObjects\ScrollBar.cs" />\r
     <Compile Include="src\BubblingMouseButtonEventArgs.cs" />\r
+    <Compile Include="src\Cairo\IFill.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Reference Include="System" />\r
diff --git a/src/Cairo/IFill.cs b/src/Cairo/IFill.cs
new file mode 100644 (file)
index 0000000..e3459bb
--- /dev/null
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+
+namespace Crow
+{
+       public interface ICairoFill
+       {
+               void SetAsSource (Cairo.Context ctx);
+       }
+}
+
index 61f9208f1d45402ccd31a07ca3e70c30d41359c3..b83a2a96115f3f37b7e6477fa588b1f775325043 100644 (file)
@@ -10,7 +10,7 @@ using System.Diagnostics;
 \r
 namespace Crow\r
 {\r
-       public struct Color\r
+       public struct Color : ICairoFill\r
     {\r
                #region CTOR\r
                public Color(double _R, double _G, double _B, double _A)\r
@@ -148,6 +148,15 @@ namespace Crow
                        return new Color (this.R, this.G, this.B, _A);\r
                }\r
 \r
+               #region IFill implementation\r
+\r
+               public void SetAsSource (Cairo.Context ctx)\r
+               {\r
+                       ctx.SetSourceRGBA (R, G, B, A);\r
+               }\r
+\r
+               #endregion\r
+\r
                #region Predefined colors\r
         public static readonly Color Transparent = new Color(0, 0, 0, 0, "Transparent");\r
                public static readonly Color Clear = new Color(-1, -1, -1, -1, "Clear");\r
index 99513f14ee273c2d62d40b0d612d11161170ac3b..cef2c501567ddc41bb53426a06285b49482335bf 100644 (file)
@@ -707,7 +707,7 @@ namespace Crow
                {\r
                        Rectangle rBack = new Rectangle (Slot.Size);\r
 \r
-                       gr.SetSourceColor(Background);\r
+                       Background.SetAsSource (gr);\r
                        CairoHelpers.CairoRectangle(gr,rBack,_cornerRadius);\r
                        gr.Fill ();\r
                }\r
index ba458b54692964842ac2d157aac9261d226d6186..a62f79f15e70da0b5999d802cc5b4754d13ef3a1 100644 (file)
@@ -294,7 +294,7 @@ namespace Crow
                                        #if DEBUG_CLIP_RECTANGLE\r
                                        redrawClip.stroke (ctx, new Color(1.0,0,0,0.3));\r
                                        #endif\r
-                                       redrawClip.clearAndClip (ctx);//rajouté après, tester si utile        \r
+                                       redrawClip.clearAndClip (ctx);  \r
 \r
                                        //Link.draw (ctx);\r
                                        foreach (GraphicObject p in invGOList) {\r