示例#1
0
        public override void DrawLayer(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha)
        {
            var bitmap = Bitmap;

            if (bitmap == null)
            {
                return;
            }
            var density = Utils.Utils.DpScale();

            _paint.Alpha = parentAlpha;
            if (_colorFilterAnimation != null)
            {
                _paint.ColorFilter = _colorFilterAnimation.Value;
            }
            canvas.Save();
            canvas.Concat(parentMatrix);
            RectExt.Set(ref _src, 0, 0, PixelWidth, PixelHeight);
            RectExt.Set(ref _dst, 0, 0, (int)(PixelWidth * density), (int)(PixelHeight * density));
            canvas.DrawBitmap(bitmap, _src, _dst, _paint);
            canvas.Restore();
        }
示例#2
0
        public override void DrawLayer(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha)
        {
            LottieLog.BeginSection("CompositionLayer.Draw");
            canvas.Save();
            RectExt.Set(ref _newClipRect, 0, 0, LayerModel.PreCompWidth, LayerModel.PreCompHeight);
            parentMatrix.MapRect(ref _newClipRect);

            for (var i = _layers.Count - 1; i >= 0; i--)
            {
                var nonEmptyClip = true;
                if (!_newClipRect.IsEmpty)
                {
                    nonEmptyClip = canvas.ClipRect(_newClipRect);
                }
                if (nonEmptyClip)
                {
                    var layer = _layers[i];
                    layer.Draw(canvas, parentMatrix, parentAlpha);
                }
            }
            canvas.Restore();
            LottieLog.EndSection("CompositionLayer.Draw");
        }
示例#3
0
 public void GetClipBounds(ref RectangleF bounds)
 {
     RectExt.Set(ref bounds, _currentClip.X, _currentClip.Y, _currentClip.Width, _currentClip.Height);
 }
示例#4
0
 public override void GetBounds(ref RectangleF outBounds, Matrix3X3 parentMatrix)
 {
     base.GetBounds(ref outBounds, parentMatrix);
     RectExt.Set(ref outBounds, 0, 0, 0, 0);
 }
示例#5
0
 public override void GetBounds(out SkiaSharp.SKRect outBounds, Matrix3X3 parentMatrix)
 {
     base.GetBounds(out outBounds, parentMatrix);
     RectExt.Set(ref outBounds, 0, 0, 0, 0);
 }
示例#6
0
 private void UpdateRect(Matrix3X3 matrix)
 {
     RectExt.Set(ref Rect, 0, 0, LayerModel.SolidWidth, LayerModel.SolidHeight);
     matrix.MapRect(ref Rect);
 }
示例#7
0
 public override void GetBounds(out Rect outBounds, Matrix3X3 parentMatrix)
 {
     base.GetBounds(out outBounds, parentMatrix);
     UpdateRect(BoundsMatrix);
     RectExt.Set(ref outBounds, Rect);
 }