示例#1
0
        private void DrawDefaultShadow(CALayer layer, CGRect bounds)
        {
            layer.ShadowRadius  = Element.Shadow.BlurRadius;
            layer.ShadowColor   = Element.Shadow.Color.ToCGColor();
            layer.ShadowOpacity = Element.Shadow.Opacity;
            layer.ShadowOffset  = new SizeF((float)Element.Shadow.Offset.X, (float)Element.Shadow.Offset.Y);

            if (Element.Sides != 4)
            {
                layer.ShadowPath = bounds.CreatePolygonPath(Element.Sides, Element.CornerRadius.TopLeft, Element.OffsetAngle).CGPath;
            }
            else
            {
                layer.ShadowPath = bounds.CreateRoundedRectPath(Element.CornerRadius).CGPath;
            }
        }
示例#2
0
        private void DrawDefaultShadow(CALayer layer, CGRect bounds, nfloat cornerRadius)
        {
            // Ideally we want to be able to have individual corner radii + shadows
            // However, on iOS we can only do one radius + shadow.
            layer.CornerRadius  = cornerRadius;
            layer.ShadowRadius  = Element.Shadow.BlurRadius;
            layer.ShadowColor   = Element.Shadow.Color.ToCGColor();
            layer.ShadowOpacity = Element.Shadow.Opacity;
            layer.ShadowOffset  = new SizeF((float)Element.Shadow.Offset.X, (float)Element.Shadow.Offset.Y);

            if (Element.Sides != 4)
            {
                layer.ShadowPath = bounds.CreatePolygonPath(Element.Sides, Element.CornerRadius.TopLeft, Element.OffsetAngle).ToCGPath();
            }
            else
            {
                layer.ShadowPath = bounds.CreateRoundedRectPath(Element.CornerRadius).ToCGPath();
            }
        }