[longomatch] Fix tringles drawing and support for different orientations
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Fix tringles drawing and support for different orientations
- Date: Mon, 7 Jul 2014 11:21:45 +0000 (UTC)
commit 255f6653feaf7acd70f4ef3073b3ca8f0c65d115
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Tue May 20 16:57:19 2014 +0200
Fix tringles drawing and support for different orientations
.../Interfaces/Drawing/IDrawingToolkit.cs | 3 +-
LongoMatch.Drawing.Cairo/CairoBackend.cs | 32 +++++++++++++++----
2 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
b/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
index df4a3a3..a92f17b 100644
--- a/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
+++ b/LongoMatch.Core/Interfaces/Drawing/IDrawingToolkit.cs
@@ -35,7 +35,8 @@ namespace LongoMatch.Interfaces
void Begin();
void End();
void DrawLine (Point start, Point stop);
- void DrawTriangle (Point corner, double width, double height);
+ void DrawTriangle (Point corner, double width, double height,
+ SelectionPosition orientation);
void DrawRectangle (Point start, double width, double height);
void DrawRoundedRectangle (Point start, double width, double height, double radius);
void DrawArea (List<Point> vertices);
diff --git a/LongoMatch.Drawing.Cairo/CairoBackend.cs b/LongoMatch.Drawing.Cairo/CairoBackend.cs
index 8693789..a7f174c 100644
--- a/LongoMatch.Drawing.Cairo/CairoBackend.cs
+++ b/LongoMatch.Drawing.Cairo/CairoBackend.cs
@@ -135,15 +135,33 @@ namespace LongoMatch.Drawing.Cairo
context.Stroke();
}
- public void DrawTriangle (Point corner, double width, double height) {
- double x, y;
+ public void DrawTriangle (Point corner, double width, double height,
+ SelectionPosition position) {
+ double x1, y1, x2, y2, x3, y3;
+
+ x1 = corner.X;
+ y1 = corner.Y;
+
+ switch (position) {
+ case SelectionPosition.Top:
+ x2 = x1 + width/2;
+ y2 = y1 + height;
+ x3 = x1 - width/2;
+ y3 = y1 + height;
+ break;
+ case SelectionPosition.Bottom:
+ default:
+ x2 = x1 + width/2;
+ y2 = y1 - height;
+ x3 = x1 - width/2;
+ y3 = y1 - height;
+ break;
+ }
- x = corner.X;
- y = corner.Y;
context.Color = strokeColor;
- context.MoveTo (x, y);
- context.LineTo (x + width/2, y + height);
- context.LineTo (x - width/2, y - height);
+ context.MoveTo (x1, y1);
+ context.LineTo (x2, y2);
+ context.LineTo (x3, y3);
context.ClosePath();
context.StrokePreserve ();
context.Color = fillColor;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]