Пример #1
0
        public void Draw(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha)
        {
            if (_hidden)
            {
                return;
            }
            LottieLog.BeginSection("FillContent.Draw");
            _paint.Color = _colorAnimation.Value ?? Colors.White;
            var alpha = (byte)(parentAlpha / 255f * _opacityAnimation.Value / 100f * 255);

            _paint.Alpha = alpha;

            if (_colorFilterAnimation != null)
            {
                _paint.ColorFilter = _colorFilterAnimation.Value;
            }

            _path.Reset();
            for (var i = 0; i < _paths.Count; i++)
            {
                _path.AddPath(_paths[i].Path, parentMatrix);
            }

            canvas.DrawPath(_path, _paint);

            LottieLog.EndSection("FillContent.Draw");
        }
Пример #2
0
        public void Draw(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha)
        {
            if (_hidden)
            {
                return;
            }
            _matrix.Set(parentMatrix);
            byte alpha;

            if (_transformAnimation != null)
            {
                _matrix = MatrixExt.PreConcat(_matrix, _transformAnimation.Matrix);
                alpha   = (byte)(_transformAnimation.Opacity.Value / 100f * parentAlpha / 255f * 255);
            }
            else
            {
                alpha = parentAlpha;
            }

            for (var i = _contents.Count - 1; i >= 0; i--)
            {
                var drawingContent = _contents[i] as IDrawingContent;
                drawingContent?.Draw(canvas, _matrix, alpha);
            }
        }
Пример #3
0
        public void Draw(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha)
        {
            LottieLog.BeginSection("GradientFillContent.Draw");
            _path.Reset();
            for (var i = 0; i < _paths.Count; i++)
            {
                _path.AddPath(_paths[i].Path, parentMatrix);
            }

            //_path.ComputeBounds(out _boundsRect);

            Shader shader;

            if (_type == GradientType.Linear)
            {
                shader = LinearGradient;
            }
            else
            {
                shader = RadialGradient;
            }
            _shaderMatrix.Set(parentMatrix);
            shader.LocalMatrix = _shaderMatrix;
            _paint.Shader      = shader;

            var alpha = (byte)(parentAlpha / 255f * _opacityAnimation.Value / 100f * 255);

            _paint.Alpha = alpha;

            canvas.DrawPath(_path, _paint);
            LottieLog.EndSection("GradientFillContent.Draw");
        }
Пример #4
0
 public override void Draw(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha)
 {
     Paint.Color = _colorAnimation.Value ?? Colors.White;
     if (_colorFilterAnimation != null)
     {
         Paint.ColorFilter = _colorFilterAnimation.Value;
     }
     base.Draw(canvas, parentMatrix, parentAlpha);
 }
Пример #5
0
        public override void Draw(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha)
        {
            GetBounds(out _boundsRect, parentMatrix);
            if (_type == GradientType.Linear)
            {
                Paint.Shader = LinearGradient;
            }
            else
            {
                Paint.Shader = RadialGradient;
            }

            base.Draw(canvas, parentMatrix, parentAlpha);
        }
Пример #6
0
        public void Draw(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte alpha)
        {
            var copies       = _copies.Value.Value;
            var offset       = _offset.Value.Value;
            var startOpacity = _transform.StartOpacity.Value.Value / 100f;
            var endOpacity   = _transform.EndOpacity.Value.Value / 100f;

            for (var i = (int)copies - 1; i >= 0; i--)
            {
                _matrix.Set(parentMatrix);
                _matrix = MatrixExt.PreConcat(_matrix, _transform.GetMatrixForRepeater(i + offset));
                var newAlpha = alpha * MiscUtils.Lerp(startOpacity, endOpacity, i / copies);
                _contentGroup.Draw(canvas, _matrix, (byte)newAlpha);
            }
        }
Пример #7
0
        public virtual void Draw(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha)
        {
            LottieLog.BeginSection("FillContent.Draw");
            _paint.Color = _colorAnimation.Value;
            var alpha = (byte)(parentAlpha / 255f * _opacityAnimation.Value / 100f * 255);

            _paint.Alpha = alpha;

            _path.Reset();
            for (var i = 0; i < _paths.Count; i++)
            {
                _path.AddPath(_paths[i].Path, parentMatrix);
            }

            canvas.DrawPath(_path, _paint);
            LottieLog.EndSection("FillContent.Draw");
        }
Пример #8
0
 public override void Draw(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha)
 {
     Paint.Color = _colorAnimation.Value;
     base.Draw(canvas, parentMatrix, parentAlpha);
 }