gbrainy r305 - trunk/src



Author: jmas
Date: Tue Apr 15 21:12:01 2008
New Revision: 305
URL: http://svn.gnome.org/viewvc/gbrainy?rev=305&view=rev

Log:
Use more gradients

Modified:
   trunk/src/CairoContextEx.cs
   trunk/src/ChangeLog
   trunk/src/MemoryColouredFigures.cs
   trunk/src/MemoryCountDots.cs

Modified: trunk/src/CairoContextEx.cs
==============================================================================
--- trunk/src/CairoContextEx.cs	(original)
+++ trunk/src/CairoContextEx.cs	Tue Apr 15 21:12:01 2008
@@ -129,5 +129,16 @@
 		Fill ();
 		Restore ();
 	}
+
+	public void FillGradient (double x, double y, double w, double h, Color color)
+	{
+		Save ();
+		LinearGradient shadow = new LinearGradient (x, y, x + w, y + h);
+		shadow.AddColorStop (0, new Color (color.R, color.G, color.B, color.A));
+		shadow.AddColorStop (0.5, new Color (color.R, color.G, color.B, color.A * 0.7));
+		Source = shadow;
+		Fill ();
+		Restore ();
+	}
 }
 

Modified: trunk/src/MemoryColouredFigures.cs
==============================================================================
--- trunk/src/MemoryColouredFigures.cs	(original)
+++ trunk/src/MemoryColouredFigures.cs	Tue Apr 15 21:12:01 2008
@@ -166,13 +166,12 @@
 			for (int row = 0; row < rows; row++) {
 
 				// if you want 2 schemes (primary or secundary colors)
-				gr.Color = palette.Cairo(ColorPalette.Id.First+ color_sheme*3 + (int)colours[index+(columns * row) + column] );
+				Color c = palette.Cairo(ColorPalette.Id.First+ color_sheme*3 + (int)colours[index+(columns * row) + column] );
 				// if you want 3 colors at random
 				// gr.Color = palette.Cairo((int)colorus[index+(columns*row)+ column]);
 
 				gr.Rectangle (x + row * rect_w, y + column * rect_h, rect_w, rect_h);
-				gr.Fill ();
-				gr.Stroke ();
+				gr.FillGradient (x + row * rect_w, y + column * rect_h, rect_w, rect_h, c);
 			}
 		}
 		gr.Restore ();

Modified: trunk/src/MemoryCountDots.cs
==============================================================================
--- trunk/src/MemoryCountDots.cs	(original)
+++ trunk/src/MemoryCountDots.cs	Tue Apr 15 21:12:01 2008
@@ -122,11 +122,12 @@
 		for (int i = 0,itcolor=0; i < MAXDOTS && itcolor<palette.Count; i++)
 		{
 			int dx,dy;
+			Color color = palette.Cairo(itcolor);
 			dx = ((int)location_order[i]) % NUMCOLUMNS;
 			dy = ((int)location_order[i]) / NUMCOLUMNS;
-			gr.Color = palette.Cairo(itcolor);
+
 			gr.Arc (pos_x+square_size*dx, pos_y+square_size*dy,radius_square,0,2*Math.PI);
-			gr.Fill ();
+			gr.FillGradient (pos_x+square_size*dx, pos_y+square_size*dy, radius_square, radius_square, color);
 
 			if (i==dotsPerColor[itcolor]) itcolor++;
 		}



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