Example #1
0
        protected override void ClippedRender (Cairo.Context cr)
        {
            Brush brush = Background;
            if (!brush.IsValid) {
                return;
            }

            double x = Double.IsNaN (brush.Width)
                ? 0
                : (RenderSize.Width - brush.Width) * XAlign;

            double y = Double.IsNaN (brush.Height)
                ? 0
                : (RenderSize.Height - brush.Height) * YAlign;

            cr.Rectangle (0, 0, RenderSize.Width, RenderSize.Height);
            cr.ClipPreserve ();

            if (x != 0 || y != 0) {
                cr.Translate (x, y);
            }

            cr.Antialias = Cairo.Antialias.None;
            brush.Apply (cr);
            cr.Fill ();
        }
		protected virtual void DrawBackground (Cairo.Context context, Gdk.Rectangle region)
		{	
			LayoutRoundedRectangle (context, region);
			context.ClipPreserve ();

			using (LinearGradient lg = new LinearGradient (region.X, region.Y, region.X, region.Y + region.Height)) {
				lg.AddColorStop (0, Styles.StatusBarFill1Color);
				lg.AddColorStop (1, Styles.StatusBarFill4Color);

				context.Pattern = lg;
				context.FillPreserve ();
			}

			context.Save ();
			double midX = region.X + region.Width / 2.0;
			double midY = region.Y + region.Height;
			context.Translate (midX, midY);

			using (RadialGradient rg = new RadialGradient (0, 0, 0, 0, 0, region.Height * 1.2)) {
				rg.AddColorStop (0, Styles.StatusBarFill1Color);
				rg.AddColorStop (1, Styles.WithAlpha (Styles.StatusBarFill1Color, 0));

				context.Scale (region.Width / (double)region.Height, 1.0);
				context.Pattern = rg;
				context.Fill ();
			}
			context.Restore ();

			using (LinearGradient lg = new LinearGradient (0, region.Y, 0, region.Y + region.Height)) {
				lg.AddColorStop (0, Styles.StatusBarShadowColor1);
				lg.AddColorStop (1, Styles.WithAlpha (Styles.StatusBarShadowColor1, Styles.StatusBarShadowColor1.A * 0.2));

				LayoutRoundedRectangle (context, region, 0, -1);
				context.LineWidth = 1;
				context.Pattern = lg;
				context.Stroke ();
			}

			using (LinearGradient lg = new LinearGradient (0, region.Y, 0, region.Y + region.Height)) {
				lg.AddColorStop (0, Styles.StatusBarShadowColor2);
				lg.AddColorStop (1, Styles.WithAlpha (Styles.StatusBarShadowColor2, Styles.StatusBarShadowColor2.A * 0.2));

				LayoutRoundedRectangle (context, region, 0, -2);
				context.LineWidth = 1;
				context.Pattern = lg;
				context.Stroke ();
			}

			context.ResetClip ();
		}