public override Drawable Mutate()
 {
     if (!_mutated && base.Mutate() == this)
     {
         _circleShadowState = new CircleShadowState(_circleShadowState);
         _mutated           = true;
     }
     return(this);
 }
        public CircleShadowDrawable(ShadowConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            //Stroke width sgould be device density, to avoid broken pixels
            _paint.StrokeWidth = 1f;//(float)(Math.Round(Application.Context.Resources.DisplayMetrics.Density));

            _circleShadowState = new CircleShadowState(config);
            _config            = config;
            _iterations        = (int)Helpers.DpToPx(_config.Blur);
            _densityOffsetX    = Helpers.DpToPx(_config.Offset.X);
            //Wrong implementation for y offset should be inverted
            //TODO need to fix
            _densityOffsetY  = Helpers.DpToPx(_config.Offset.Y) * -1;
            _offsetWithBlurX = ShadowHelpers.GetOffsetWithBlur((int)_densityOffsetX, _iterations);
            _offsetWithBlurY = ShadowHelpers.GetOffsetWithBlur((int)_densityOffsetY, _iterations);

            CalculateColors();
        }
 public CircleShadowState(CircleShadowState state)
 {
     Config = state.Config;
     this.cConfigurations = state.cConfigurations;
 }