public override void GetBounds(out Rect outBounds, Matrix3X3 parentMatrix) { base.GetBounds(out outBounds, parentMatrix); _contentGroup.GetBounds(out outBounds, BoundsMatrix); }
public void GetBounds(out Rect outBounds, Matrix3X3 parentMatrix) { _contentGroup.GetBounds(out outBounds, parentMatrix); }
public override void DrawLayer(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha) { _contentGroup.Draw(canvas, parentMatrix, parentAlpha); }
public override void GetBounds(out Rect outBounds, Matrix3X3 parentMatrix) { base.GetBounds(out outBounds, parentMatrix); RectExt.Set(ref outBounds, 0, 0, 0, 0); }
private static void Draw(SKSurface bitmapCanvas, CompositionLayer compositionLayer, SKRect bounds, float scale, byte alpha, Matrix3X3 matrix, double width, double height) { bitmapCanvas.Canvas.Clear(SKColors.Transparent); LottieLog.BeginSection("Drawable.Draw"); if (compositionLayer == null) { return; } var localScale = scale; float extraScale = 1f; float maxScale = GetMaxScale(bitmapCanvas.Canvas, bounds); if (localScale > maxScale) { localScale = maxScale; extraScale = scale / localScale; } 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.Canvas.Save(); float halfWidth = (float)bounds.Width / 2f; float halfHeight = (float)bounds.Height / 2f; float scaledHalfWidth = halfWidth * localScale; float scaledHalfHeight = halfHeight * localScale; bitmapCanvas.Canvas.Translate( scale * halfWidth - scaledHalfWidth, scale * halfHeight - scaledHalfHeight); bitmapCanvas.Canvas.Scale(extraScale, extraScale, scaledHalfWidth, scaledHalfHeight); } matrix.Reset(); matrix = MatrixExt.PreScale(matrix, localScale, localScale); compositionLayer.Draw(bitmapCanvas.Canvas, matrix, alpha); LottieLog.EndSection("Drawable.Draw"); if (extraScale > 1) { bitmapCanvas.Canvas.Restore(); } }
//public int Opacity //{ // get // { // return PixelFormat.TRANSLUCENT; // } //} private void CanvasControlOnDraw(ICanvasAnimatedControl canvasControl, CanvasAnimatedDrawEventArgs args) { lock (this) { if (_bitmapCanvas == null) { return; } using (_bitmapCanvas.CreateSession(canvasControl.Device, canvasControl.Size.Width, canvasControl.Size.Height, args.DrawingSession)) { _bitmapCanvas.Clear(Colors.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(); } } } }
public void Transform(Matrix3X3 matrix) { }
public static Matrix3X3 PreTranslate(Matrix3X3 matrix, float dx, float dy) { return(matrix * GetTranslate(dx, dy)); }
public static Matrix3X3 PreScale(Matrix3X3 matrix, float scaleX, float scaleY) { return(matrix * GetScale(scaleX, scaleY)); }
public void SetMatrix(Matrix3X3 matrix) { _matrix.Set(matrix); }
public static Matrix3X3 PreConcat(Matrix3X3 matrix, Matrix3X3 transformAnimationMatrix) { return(matrix * transformAnimationMatrix); }
public void Scale(float sx, float sy, float px, float py) { _matrix = MatrixExt.PreScale(_matrix, sx, sy, px, py); }
public void Translate(float dx, float dy) { _matrix = MatrixExt.PreTranslate(_matrix, dx, dy); }
public void Concat(Matrix3X3 parentMatrix) { _matrix = MatrixExt.PreConcat(_matrix, parentMatrix); }
public void Transform(Matrix3X3 matrix) { path1.Transform(matrix); path2.Transform(matrix); }
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); }
public override void Draw(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha) { Paint.Color = _colorAnimation.Value; base.Draw(canvas, parentMatrix, parentAlpha); }
public override void GetBounds(out Rect outBounds, Matrix3X3 parentMatrix) { base.GetBounds(out outBounds, parentMatrix); UpdateRect(BoundsMatrix); RectExt.Set(ref outBounds, Rect); }
public void Transform(Matrix3X3 matrix) { _control1 = matrix.Transform(_control1); _control2 = matrix.Transform(_control2); _vertex = matrix.Transform(_vertex); }
private void UpdateRect(Matrix3X3 matrix) { RectExt.Set(ref Rect, 0, 0, LayerModel.SolidWidth, LayerModel.SolidHeight); matrix.MapRect(ref Rect); }
public void Transform(Matrix3X3 matrix) { _startPoint = matrix.Transform(_startPoint); _endPoint = matrix.Transform(_endPoint); }
public override void DrawLayer(BitmapCanvas canvas, Matrix3X3 parentMatrix, byte parentAlpha) { // Do nothing. }