protected override void DispatchDraw(Canvas canvas) { base.DispatchDraw(canvas); if (mPinnedSection != null) { // prepare variables int pLeft = ListPaddingLeft; int pTop = ListPaddingTop; View view = mPinnedSection.view; // draw child canvas.Save(); int clipHeight = view.Height + (mShadowDrawable == null ? 0 : Math.Min(mShadowHeight, mSectionsDistanceY)); canvas.ClipRect(pLeft, pTop, pLeft + view.Width, pTop + clipHeight); canvas.Translate(pLeft, pTop + mTranslateY); DrawChild(canvas, mPinnedSection.view, DrawingTime); if (mShadowDrawable != null && mSectionsDistanceY > 0) { mShadowDrawable.SetBounds(mPinnedSection.view.Left, mPinnedSection.view.Bottom, mPinnedSection.view.Right, mPinnedSection.view.Bottom + mShadowHeight); mShadowDrawable.Draw(canvas); } canvas.Restore(); } }
public override void Draw(Canvas canvas) { GradientDrawable.Bounds = canvas.ClipBounds; GradientDrawable.SetOrientation(EasyGradientView.Orientation == GradientOrientation.Vertical ? GradientDrawable.Orientation.TopBottom : GradientDrawable.Orientation.LeftRight); GradientDrawable.Draw(canvas); }
protected override bool DrawChild(Canvas canvas, global::Android.Views.View child, long drawingTime) { GradientDrawable.Bounds = canvas.ClipBounds; GradientDrawable.SetOrientation(GradientContentView.Orientation == GradientOrientation.Vertical ? GradientDrawable.Orientation.TopBottom : GradientDrawable.Orientation.LeftRight); GradientDrawable.Draw(canvas); return(base.DrawChild(canvas, child, drawingTime)); }
/// <summary> /// This method overrides the BoxRenderers Draw method, to draw on the canvas /// </summary> /// <param name="canvas">The passed canvas on which the control is drawn</param> public override void Draw(Canvas canvas) // Canvas is the object that will be drawn on - effectively it is the Control { ExtendedBoxView ebv = (ExtendedBoxView)this.Element; GradientDrawable box = CreateBox(ebv.Color, ebv.CornerRadius, ebv.BorderColor, ebv.BorderThickness, ebv.ForcedBoxShape); // Create shadow if required if (ebv.HasShadow) { GradientDrawable shadow = CreateShadow(ebv.ShadowColor, ebv.CornerRadius, ebv.BorderThickness, ebv.ShadowPosition.dX, ebv.ShadowPosition.dY, ebv.Color.A, ebv.BorderColor.A, ebv.ForcedBoxShape); // Draw shadow on canvas shadow.Draw(canvas); } // Draw box on canvas box.Draw(canvas); if (ebv.Android_Elevation > 0) { this.Elevation = (float)ebv.Android_Elevation; } }
protected override bool DrawChild(Canvas canvas, global::Android.Views.View child, long drawingTime) { GradientDrawable.Bounds = canvas.ClipBounds; switch (GradientContentView.Orientation) { case GradientOrientation.Vertical: GradientDrawable.SetOrientation(GradientDrawable.Orientation.TopBottom); break; case GradientOrientation.Horizontal: GradientDrawable.SetOrientation(GradientDrawable.Orientation.LeftRight); break; case GradientOrientation.BrTl: GradientDrawable.SetOrientation(GradientDrawable.Orientation.BrTl); break; case GradientOrientation.BlTr: GradientDrawable.SetOrientation(GradientDrawable.Orientation.BlTr); break; case GradientOrientation.TlBr: GradientDrawable.SetOrientation(GradientDrawable.Orientation.TlBr); break; case GradientOrientation.TrBl: GradientDrawable.SetOrientation(GradientDrawable.Orientation.TrBl); break; default: break; } GradientDrawable.Draw(canvas); return(base.DrawChild(canvas, child, drawingTime)); }