コード例 #1
0
		DockySurface CreateUrgentGlowBuffer ()
		{
			// FIXME: create gconf value
			Gdk.Color gdkColor = Style.Backgrounds [(int) StateType.Selected].SetMinimumValue (90);
			Cairo.Color color = new Cairo.Color ((double) gdkColor.Red / ushort.MaxValue,
											(double) gdkColor.Green / ushort.MaxValue,
											(double) gdkColor.Blue / ushort.MaxValue,
											1.0);
			color = color.AddHue (DockServices.Theme.UrgentHueShift).SetSaturation (1);
			
			int size = (int) 2.5 * IconSize;
			
			DockySurface surface = new DockySurface (size, size, background_buffer);
			surface.Clear ();
			
			Cairo.Context cr = surface.Context;
			
			double x = size / 2;
			double y = x;
				
			cr.MoveTo (x, y);
			cr.Arc (x, y, size / 2, 0, Math.PI * 2);
				
			RadialGradient rg = new RadialGradient (x, y, 0, x, y, size / 2);
			rg.AddColorStop (0, new Cairo.Color (1, 1, 1, 1));
			rg.AddColorStop (.33, color.SetAlpha (.66));
			rg.AddColorStop (.66, color.SetAlpha (.33));
			rg.AddColorStop (1.0, color.SetAlpha (0.0));
			
			cr.Pattern = rg;
			cr.Fill ();
			rg.Destroy ();
			
			return surface;
		}
コード例 #2
0
		DockySurface CreateWaitBuffer ()
		{
			DockySurface surface = new DockySurface (IconSize, IconSize, background_buffer);
			surface.Clear ();
			
			surface.Context.Color = new Cairo.Color (0, 0, 0, 0);
			surface.Context.Operator = Operator.Source;
			surface.Context.PaintWithAlpha (0.5);
			
			double baseLog = Math.Log (WaitArmsPerGroup + 1);
			int size = Math.Min (surface.Width, surface.Height);
			
			// Ensure that LineWidth is a multiple of 2 for nice drawing
			surface.Context.LineWidth = (int) Math.Max (1, size / 40.0);
			surface.Context.LineCap = LineCap.Round;
			
			surface.Context.Translate (surface.Width / 2, surface.Height / 2);
			
			if (surface.Context.LineWidth % 2 == 1)
				surface.Context.Translate (.5, .5);
			
			Gdk.Color color = Style.Backgrounds [(int) Gtk.StateType.Selected].SetMinimumValue (100);
			Cairo.Color baseColor = new Cairo.Color ((double) color.Red / ushort.MaxValue,
										(double) color.Green / ushort.MaxValue,
										(double) color.Blue / ushort.MaxValue,
										1);
			
			for (int i = 0; i < WaitArmsPerGroup * WaitGroups; i++) {
				int position = 1 + (i % WaitArmsPerGroup);
				surface.Context.Color = baseColor.SetAlpha (1 - Math.Log (position) / baseLog);
				surface.Context.MoveTo (0, size / 8);
				surface.Context.LineTo (0, size / 4);
				surface.Context.Rotate (-2 * Math.PI / (WaitArmsPerGroup * WaitGroups));
				surface.Context.Stroke ();
			}
			
			return surface;
		}