[banshee/grid] Started a new namespace containing simple glyph renderers



commit e541267227e281401e1f5bf93d8d8f1cc94cab78
Author: Aaron Bockover <abockover novell com>
Date:   Mon Dec 14 01:53:06 2009 -0500

    Started a new namespace containing simple glyph renderers
    
    First one is an implementation of Jakub's Moblin-style Banshee logo.
    Next I'll add play and pause renderers. It will make sense later.

 .../Banshee.CairoGlyphs/BansheeLineLogo.cs         |   74 ++++++++++++++++++++
 1 files changed, 74 insertions(+), 0 deletions(-)
---
diff --git a/src/Core/Banshee.ThickClient/Banshee.CairoGlyphs/BansheeLineLogo.cs b/src/Core/Banshee.ThickClient/Banshee.CairoGlyphs/BansheeLineLogo.cs
new file mode 100644
index 0000000..66b2069
--- /dev/null
+++ b/src/Core/Banshee.ThickClient/Banshee.CairoGlyphs/BansheeLineLogo.cs
@@ -0,0 +1,74 @@
+//
+// BansheeLineLogo.cs
+// 
+// Author:
+//   Aaron Bockover <abockover novell com>
+// 
+// Copyright 2009 Novell, Inc.
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using Cairo;
+
+namespace Banshee.CairoGlyphs
+{
+    public static class BansheeLineLogo
+    {
+        private static Color inner_color = Hyena.Gui.CairoExtensions.RgbaToColor (0xddddddff);
+        private static Color outer_color = Hyena.Gui.CairoExtensions.RgbaToColor (0xddddddff);
+
+        public static void Render (Context cr, double x, double y, double size)
+        {
+            Render (cr, x, y, size, inner_color, outer_color);
+        }
+
+        public static void Render (Context cr, double x, double y, double size, Color innerColor, Color outerColor)
+        {
+            double original_size = 12; // largest dimension as computed in rendering
+            double scale = size / original_size;
+            double tx = x - scale / 2.0;
+            double ty = y - scale / 2.0;
+
+            cr.Save ();
+            cr.Translate (tx, ty);
+            cr.Scale (scale, scale);
+
+            cr.LineWidth = 1;
+            cr.LineCap = LineCap.Round;
+            cr.LineJoin = LineJoin.Round;
+
+            // Inner B note
+            cr.Color = innerColor;
+            cr.MoveTo (1, 2);
+            cr.LineTo (3, 0);
+            cr.LineTo (3, 8);
+            cr.Arc (3 + 2, 8, 2, Math.PI, Math.PI * 3);
+            cr.Stroke ();
+
+            // Outer circle
+            cr.Color = outerColor;
+            cr.ArcNegative (5, 4 + 4, 4, Math.PI * -0.87, Math.PI * 1.48);
+            cr.Stroke ();
+
+            cr.Restore ();
+        }
+    }
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]