protected override bool OnDrawn(Cairo.Context cr) { if (!CairoHelper.ShouldDrawWindow (cr, Window)) { return base.OnDrawn (cr); } if (reflect) { CairoExtensions.PushGroup (cr); } cr.Operator = Operator.Over; cr.Translate (h_padding, 0); cr.Rectangle (0, 0, Allocation.Width - h_padding, Math.Max (2 * bar_height, bar_height + bar_label_spacing + layout_height)); cr.Clip (); Pattern bar = RenderBar (Allocation.Width - 2 * h_padding, bar_height); cr.Save (); cr.Source = bar; cr.Paint (); cr.Restore (); if (reflect) { cr.Save (); cr.Rectangle (0, bar_height, Allocation.Width - h_padding, bar_height); cr.Clip (); Matrix matrix = new Matrix (); matrix.InitScale (1, -1); matrix.Translate (0, -(2 * bar_height) + 1); cr.Transform (matrix); cr.Pattern = bar; LinearGradient mask = new LinearGradient (0, 0, 0, bar_height); mask.AddColorStop (0.25, new Color (0, 0, 0, 0)); mask.AddColorStop (0.5, new Color (0, 0, 0, 0.125)); mask.AddColorStop (0.75, new Color (0, 0, 0, 0.4)); mask.AddColorStop (1.0, new Color (0, 0, 0, 0.7)); cr.Mask (mask); mask.Destroy (); cr.Restore (); CairoExtensions.PopGroupToSource (cr); cr.Paint (); } if (show_labels) { cr.Translate ((reflect ? 0 : -h_padding) + (Allocation.Width - layout_width) / 2, bar_height + bar_label_spacing); RenderLabels (cr); } bar.Destroy (); return true; }
void RenderElement (Cairo.Context context, CanvasElement element) { element.Canvas = this; context.Transform (element.Transform); element.Render (context); }
protected override void OnLayoutOutline (Cairo.Context context) { if (IconOnly) { context.Transform (box.Transform); context.Transform (image.Transform); image.LayoutOutline (context); } else { base.OnLayoutOutline (context); } }