Esempio n. 1
0
 public void Transform(Matrix3X3 matrix)
 {
 }
Esempio n. 2
0
        public static Matrix3X3 PreScale(Matrix3X3 matrix, float scaleX, float scaleY, float px, float py)
        {
            var tmp = GetTranslate(-px, -py) * GetScale(scaleX, scaleY) * GetTranslate(px, py);

            return(matrix * tmp);
        }
Esempio n. 3
0
 public void Transform(Matrix3X3 matrix)
 {
     _control1 = matrix.Transform(_control1);
     _control2 = matrix.Transform(_control2);
     _vertex   = matrix.Transform(_vertex);
 }
Esempio n. 4
0
 public static Matrix3X3 PreScale(Matrix3X3 matrix, float scaleX, float scaleY)
 {
     return(matrix * GetScale(scaleX, scaleY));
 }
Esempio n. 5
0
 public static Matrix3X3 PreTranslate(Matrix3X3 matrix, float dx, float dy)
 {
     return(matrix * GetTranslate(dx, dy));
 }
Esempio n. 6
0
 public static Matrix3X3 PreConcat(Matrix3X3 matrix, Matrix3X3 transformAnimationMatrix)
 {
     return(matrix * transformAnimationMatrix);
 }
Esempio n. 7
0
        //public int Opacity
        //{
        //    get
        //    {
        //        return PixelFormat.TRANSLUCENT;
        //    }
        //}

        public override void Render(RenderTarget target)
        {
            lock (this)
            {
                if (_bitmapCanvas == null)
                {
                    return;
                }

                using (_bitmapCanvas.CreateSession(target.Size.Width, target.Size.Height, (DeviceContext)target))
                {
                    _bitmapCanvas.Clear(Color.Transparent);
                    LottieLog.BeginSection("Drawable.Draw");
                    if (_compositionLayer == null)
                    {
                        return;
                    }

                    var   scale      = _scale;
                    float extraScale = 1f;

                    float maxScale = GetMaxScale(_bitmapCanvas);
                    if (scale > maxScale)
                    {
                        scale      = maxScale;
                        extraScale = _scale / scale;
                    }

                    if (extraScale > 1)
                    {
                        // This is a bit tricky...
                        // We can't draw on a canvas larger than ViewConfiguration.get(context).getScaledMaximumDrawingCacheSize()
                        // which works out to be roughly the size of the screen because Android can't generate a
                        // bitmap large enough to render to.
                        // As a result, we cap the scale such that it will never be wider/taller than the screen
                        // and then only render in the top left corner of the canvas. We then use extraScale
                        // to scale up the rest of the scale. However, since we rendered the animation to the top
                        // left corner, we need to scale up and translate the canvas to zoom in on the top left
                        // corner.
                        _bitmapCanvas.Save();
                        float halfWidth        = (float)_composition.Bounds.Width / 2f;
                        float halfHeight       = (float)_composition.Bounds.Height / 2f;
                        float scaledHalfWidth  = halfWidth * scale;
                        float scaledHalfHeight = halfHeight * scale;
                        _bitmapCanvas.Translate(
                            Scale * halfWidth - scaledHalfWidth,
                            Scale * halfHeight - scaledHalfHeight);
                        _bitmapCanvas.Scale(extraScale, extraScale, scaledHalfWidth, scaledHalfHeight);
                    }

                    _matrix.Reset();
                    _matrix = MatrixExt.PreScale(_matrix, scale, scale);
                    _compositionLayer.Draw(_bitmapCanvas, _matrix, _alpha);
                    LottieLog.EndSection("Drawable.Draw");

                    if (extraScale > 1)
                    {
                        //_bitmapCanvas.Restore();
                        _bitmapCanvas.RestoreAll();
                    }
                }
            }
        }
 public void Transform(Matrix3X3 matrix)
 {
     path1.Transform(matrix);
     path2.Transform(matrix);
 }