Exemplo n.º 1
0
        protected override void InternalDraw(SKCanvas canvas)
        {
            base.InternalDraw(canvas);

            using (var paint = new SKPaint())
            {
                paint.IsAntialias = true;

                if (HasShadow)
                {
                    using (var filter = SKMaskFilter.CreateBlur(SKBlurStyle.Normal, 2.0f))
                    {
                        paint.MaskFilter = filter;
                        paint.Color      = Color.Gray.ToSKColor();

                        switch (Shape)
                        {
                        case MycoShapes.Rectangle:
                            canvas.DrawRect(RenderBounds.ToSKRect(), paint);
                            break;

                        case MycoShapes.RoundedRectangle:
                            canvas.DrawRoundRect(RenderBounds.ToSKRect(), RoundedRectRadius, RoundedRectRadius, paint);
                            break;

                        case MycoShapes.Oval:
                            canvas.DrawOval(RenderBounds.ToSKRect(), paint);
                            break;
                        }

                        paint.MaskFilter = null;
                    }
                }

                paint.Color = ShapeColor.ToSKColor();

                switch (Shape)
                {
                case MycoShapes.Rectangle:
                    canvas.DrawRect(RenderBounds.ToSKRect(), paint);
                    break;

                case MycoShapes.RoundedRectangle:
                    canvas.DrawRoundRect(RenderBounds.ToSKRect(), RoundedRectRadius, RoundedRectRadius, paint);
                    break;

                case MycoShapes.Oval:
                    canvas.DrawOval(RenderBounds.ToSKRect(), paint);
                    break;
                }
            }
        }
Exemplo n.º 2
0
        protected virtual void InternalDraw(SKCanvas canvas)
        {
            using (var paint = new SKPaint())
            {
                if (BackgroundColor.A > 0)
                {
                    paint.Color = BackgroundColor.ToSKColor();
                    canvas.DrawRect(RenderBounds.ToSKRect(), paint);
                }

                if (FrameColor.A > 0)
                {
                    paint.Color       = FrameColor.ToSKColor();
                    paint.IsStroke    = true;
                    paint.StrokeWidth = (float)FrameThickness;
                    canvas.DrawRect(RenderBounds.ToSKRect(), paint);
                }
            }

            if (Drawing != null)
            {
                Drawing(canvas);
            }
        }