gbrainy r289 - trunk/src



Author: jmas
Date: Sun Apr  6 15:54:56 2008
New Revision: 289
URL: http://svn.gnome.org/viewvc/gbrainy?rev=289&view=rev

Log:
2008-04-06 Jordi Mas <jmas softcatala org>

	* PuzzleMatrixGroups.cs: Use gradients instead of the blue color
	* PuzzleCoverPercentage.cs: Use gradients instead of solid gray
	* CairoContextEx.cs: New member FillGradient
	* Memory.cs: Nicer red gradient



Modified:
   trunk/src/CairoContextEx.cs
   trunk/src/ChangeLog
   trunk/src/Memory.cs
   trunk/src/PuzzleCoverPercentage.cs
   trunk/src/PuzzleMatrixGroups.cs

Modified: trunk/src/CairoContextEx.cs
==============================================================================
--- trunk/src/CairoContextEx.cs	(original)
+++ trunk/src/CairoContextEx.cs	Sun Apr  6 15:54:56 2008
@@ -118,5 +118,16 @@
 	{
 		SetFontSize (0.03);
 	}
+
+	public void FillGradient (double x, double y, double w, double h)
+	{
+		Save ();
+		LinearGradient shadow = new LinearGradient (x, y, x + w, y + h);
+		shadow.AddColorStop (0, new Color (0, 0, 0, 0.3));
+		shadow.AddColorStop (0.5, new Color (0, 0, 0, 0.1));
+		Source = shadow;
+		Fill ();
+		Restore ();
+	}
 }
 

Modified: trunk/src/Memory.cs
==============================================================================
--- trunk/src/Memory.cs	(original)
+++ trunk/src/Memory.cs	Sun Apr  6 15:54:56 2008
@@ -180,9 +180,9 @@
 		height *= percentage / 100;
 
 		if (gradient == null) {
-			gradient = new LinearGradient (0, 0, 0, 1);
-			gradient.AddColorStop (1, new Color (0.2, 0, 0, 1));
+			gradient = new LinearGradient (x, y, x + width, y + height);
 			gradient.AddColorStop (0, new Color (1, 0, 0, 1));
+			gradient.AddColorStop (1, new Color (0.2, 0, 0, 1));
 		}
 
 		gr.Source = gradient;			

Modified: trunk/src/PuzzleCoverPercentage.cs
==============================================================================
--- trunk/src/PuzzleCoverPercentage.cs	(original)
+++ trunk/src/PuzzleCoverPercentage.cs	Sun Apr  6 15:54:56 2008
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Jordi Mas i HernÃndez <jmas softcatala org>
+ * Copyright (C) 2007-2008 Jordi Mas i HernÃndez <jmas softcatala org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -70,6 +70,12 @@
 		right_answer = total.ToString ();
 	}
 
+	private void Fill (CairoContextEx gr, double x, double y, double w, double h)
+	{
+		gr.Rectangle (x, y, w, h);
+		gr.FillGradient (x, y, w, h);
+	}
+
 	private void DrawSection (CairoContextEx gr, double x, double y)
 	{
 		double w =  width / 2, h = height / 2;
@@ -88,12 +94,10 @@
 		gr.Save ();
 		gr.Color = new Cairo.Color (0.90, 0.90, 0.90);
 		for (int i = 0; i < partial_zones; i++) {
-			gr.Rectangle (x + line_width, line_width + y, 
+			Fill (gr, x + line_width, line_width + y, 
 				(w / 2) - (line_width * 2) , (h / 5) - (line_width * 2));
-			gr.Fill ();
-			gr.Rectangle (x + (w / 2) + line_width * 2, line_width + y, 
+			Fill (gr, x + (w / 2) + line_width * 2, line_width + y, 
 				(w / 2) - (line_width * 4) , (h / 5) - (line_width * 2));
-			gr.Fill ();			
 			y += h / 5;
 		}
 		gr.Restore ();
@@ -101,11 +105,7 @@
 
 	private void CoverZone (CairoContextEx gr, double x, double y)
 	{
-		gr.Save ();
-		gr.Color = new Cairo.Color (0.90, 0.90, 0.90);
-		gr.Rectangle (x + line_width, y + line_width , (width / 2) - (line_width * 2), (height / 2) - (line_width * 2));
-		gr.Fill ();
-		gr.Restore ();
+		Fill (gr, x + line_width, y + line_width , (width / 2) - (line_width * 2), (height / 2) - (line_width * 2));
 	}
 
 	public override void Draw (CairoContextEx gr, int area_width, int area_height)

Modified: trunk/src/PuzzleMatrixGroups.cs
==============================================================================
--- trunk/src/PuzzleMatrixGroups.cs	(original)
+++ trunk/src/PuzzleMatrixGroups.cs	Sun Apr  6 15:54:56 2008
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Jordi Mas i HernÃndez <jmas softcatala org>
+ * Copyright (C) 2007-2008 Jordi Mas i HernÃndez <jmas softcatala org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -33,17 +33,17 @@
 	}
 
 	public override string Question {
-		get {return Catalog.GetString ("One of the black numbers in the matrix should be blue. Which one?");}
+		get {return Catalog.GetString ("There is a missing circled number in the matrix. Which one?");}
 	}
 
 	public override string Tip {
-		get { return Catalog.GetString ("All blue numbers share an arithmetical property.");}
+		get { return Catalog.GetString ("All circled numbers share an arithmetical property.");}
 	}
 
 	public override string Answer {
 		get { 
 			string answer = base.Answer + " ";
-			answer += String.Format (Catalog.GetString ("Every blue number can be divided by {0}."), divisor);
+			answer += String.Format (Catalog.GetString ("Every circled number can be divided by {0}."), divisor);
 			return answer;
 		}
 	}
@@ -101,7 +101,7 @@
 				found = true;
 		}
 		return unique;
-	}	
+	}
 
 	public override void Draw (CairoContextEx gr, int area_width, int area_height)
 	{
@@ -118,14 +118,17 @@
 				gr.Color = DefaultDrawingColor;
 				gr.Rectangle (DrawAreaX + row * rect_w, DrawAreaY + column * rect_h, rect_w, rect_h);
 				gr.Stroke ();
-				gr.MoveTo (0.04 + DrawAreaX + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h);
 
-				if (numbers[column + (row * 4)] % divisor == 0 && good_pos != column + (row * 4))
-					gr.Color = new Cairo.Color (0, 0, 0.8);
-				else
-					gr.Color = DefaultDrawingColor;
-	
-				gr.ShowText ( (numbers[column + (row * 4)]).ToString() );
+				gr.DrawTextCentered (DrawAreaX + (rect_w / 2) + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h, 
+					(numbers[column + (row * 4)]).ToString() );
+
+				if (numbers[column + (row * 4)] % divisor == 0 && good_pos != column + (row * 4)) {
+					gr.Arc (DrawAreaX + (rect_w / 2) + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h,
+						0.05, 0, 2 * Math.PI);
+					gr.FillGradient (DrawAreaX + (rect_w / 2) + column * rect_w, (rect_h / 2) + DrawAreaY + row * rect_h,
+						0.05, 0.05);
+
+				}		
 				gr.Stroke ();
 			}
 		}



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