Exemplo n.º 1
0
 public override Drawable Mutate()
 {
     if (!_mutated && base.Mutate() == this)
     {
         _circleShadowState = new CircleShadowState(_circleShadowState);
         _mutated           = true;
     }
     return(this);
 }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
 public CircleShadowState(CircleShadowState state)
 {
     Config = state.Config;
     this.cConfigurations = state.cConfigurations;
 }