Comments (4)
Thanks, I understand but this will help me for sure :)
from skia4delphi.
Hi @Darkster1
This happens when trying to render a bitmap with no size (width or height zero) by calling TBitmap.SkiaDraw. I will remove this exception. For now try to avoid these zero-size renderings.
from skia4delphi.
I actually don't try to render zero size (that's maybe what happens) but what I want is render it horizontally flipped. Is there any other possible way doing this? with a LottieAnimation? like I have a file which displayes some people walking from left to right, I just want them (including background) to walk to the left when onTouch is fired.
So if you could implement something like that? would be great.
from skia4delphi.
@Darkster1 Ok, let's skip the "'Invalid Bitmap' raises" and focus on your problem which is the horizontal flip effect.
I made a small example adding the FlipAngle property to TSkSkottieAnimation:
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
System.Math, System.Math.Vectors, FMX.Types, FMX.Controls, FMX.Forms,
FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation, FMX.StdCtrls, Skia, Skia.FMX;
type
TSkLottieAnimation = class(Skia.FMX.TSkLottieAnimation)
strict private
FFlipAngle: Single;
procedure SetFlipAngle(const AValue: Single);
strict protected
procedure RenderFrame(const ACanvas: ISkCanvas; const ADest: TRectF; const AProgress: Double; const AOpacity: Single); override;
public
property FlipAngle: Single read FFlipAngle write SetFlipAngle;
end;
TForm1 = class(TForm)
SkLottieAnimation1: TSkLottieAnimation;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
{ TSkLottieAnimation }
procedure TSkLottieAnimation.RenderFrame(const ACanvas: ISkCanvas;
const ADest: TRectF; const AProgress: Double; const AOpacity: Single);
var
LRotation: Single;
begin
LRotation := Sin(DegToRad((FFlipAngle + 180) / 2));
ACanvas.Save;
ACanvas.Translate((1 - LRotation) * (ADest.Width / 2), 0);
ACanvas.Scale(LRotation, 1);
inherited;
ACanvas.Restore;
end;
procedure TSkLottieAnimation.SetFlipAngle(const AValue: Single);
begin
if not SameValue(FFlipAngle, AValue, TEpsilon.Angle) then
begin
FFlipAngle := AValue;
Redraw;
end;
end;
end.
See the result:
21.11.2021_16.30.37_REC.mp4
To make an animation with this new property, you can use the TFloatAnimation for example...
I will not add this property to the official TSkSkottieAnimation as it is a property for a very specific situation. And the idea is to keep everything summarized and simple.
Best regards Vinícius F.
from skia4delphi.
Related Issues (20)
- In Delphi 12 IDE crashes when you drag and drop TSkAnimatedPaintbox to Form HOT 1
- ACCESS Violation after adding SKIA to Uses clause HOT 3
- Text extent fails under MacOS(!) HOT 3
- SKIA for Android: GPU SkImage Rendering Failure on TGLCanvas vs. Vulkan HOT 10
- Android Crash on Delphi 11.3 for Transferred Bricks Game Demo Project HOT 2
- Universal MAC Dylib HOT 4
- ISkRuntimeEffect changes from 3.4.0 to 6.0.0 HOT 3
- Request for SkFontMg.matchFamilyStyleCharacter equivalent
- Request for SkTextBlob.bounds eqivalent
- How to enable GPU in VCL? HOT 1
- Getting an indexed color from TSkPaint.Shader.MakeGradientLinear HOT 1
- Crashes Delphi 11.1, skia versão 6.0 HOT 2
- error: program is too large HOT 2
- TSkSvg with an SVG with french special caracters HOT 4
- Japanese fonts are not displayed correctly when Skia is enabled.
- Blackscreen on iPad Pro 11" (3rd Gen) with biggest display zoom, setting "more surface" and GlobalMetal=true HOT 6
- Make more classes public in vcl.skia
- Distribuition without DLL Skia4d.dll HOT 1
- TSkSvg fails to honor opacity on text element
- Problema desconhecido com Delphi 12.1 e Skia4Delphi no Android64 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skia4delphi.