This commit is contained in:
Wiesław Šoltés 2022-08-20 01:03:45 +02:00
Родитель 0a8daf5635
Коммит 0f154aac80
8 изменённых файлов: 38 добавлений и 24 удалений

Просмотреть файл

@ -13,8 +13,9 @@
<AvaloniaResource Include="Assets\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="0.10.15" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.1-preview.63" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview1" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.1-preview.108" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LottieDemo\LottieDemo.csproj" />

Просмотреть файл

@ -57,8 +57,8 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Avalonia.Web.Blazor" Version="0.10.15" />
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" Version="2.88.1-preview.63" />
<PackageReference Include="Avalonia.Web.Blazor" Version="11.0.0-preview1" />
<PackageReference Include="SkiaSharp.NativeAssets.WebAssembly" Version="2.88.1-preview.108" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -12,10 +12,11 @@
<AvaloniaResource Include="Assets\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.15" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0-preview4" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.15" />
<PackageReference Include="Avalonia" Version="11.0.0-preview1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview1" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview1" />
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Avalonia.Skia.Lottie\Avalonia.Skia.Lottie.csproj" />

Просмотреть файл

@ -11,11 +11,12 @@
<TrimmableAssembly Include="Avalonia.Themes.Default" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.15" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.15" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.15" />
<PackageReference Include="Avalonia" Version="11.0.0-preview1" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview1" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview1" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview1" />
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.63" />
<PackageReference Include="SkiaSharp.Skottie" Version="2.88.1-preview.63" />
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108" />
<PackageReference Include="SkiaSharp.Skottie" Version="2.88.1-preview.108" />
</ItemGroup>
</Project>

Просмотреть файл

@ -59,6 +59,11 @@ public partial class MainWindow : Window
}
}
if (outputPath is null)
{
return;
}
await Task.Run(() =>
{
foreach (var path in paths)

Просмотреть файл

@ -9,8 +9,8 @@
<RootNamespace>Avalonia.Skia.Lottie</RootNamespace>
</PropertyGroup>
<PropertyGroup>
<VersionPrefix>0.10.15</VersionPrefix>
<VersionSuffix>preview.65</VersionSuffix>
<VersionPrefix>11.0.0</VersionPrefix>
<VersionSuffix>preview1</VersionSuffix>
<Authors>Wiesław Šoltés</Authors>
<Company>Wiesław Šoltés</Company>
<Copyright>Copyright © Wiesław Šoltés 2022</Copyright>
@ -27,9 +27,9 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.15" />
<PackageReference Include="Avalonia.Skia" Version="0.10.15" />
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.63" />
<PackageReference Include="SkiaSharp.Skottie" Version="2.88.1-preview.63" />
<PackageReference Include="Avalonia" Version="11.0.0-preview1" />
<PackageReference Include="Avalonia.Skia" Version="11.0.0-preview1" />
<PackageReference Include="SkiaSharp" Version="2.88.1-preview.108" />
<PackageReference Include="SkiaSharp.Skottie" Version="2.88.1-preview.108" />
</ItemGroup>
</Project>

Просмотреть файл

@ -27,7 +27,13 @@ internal class FuncCustomDrawOperation : ICustomDrawOperation
public void Render(IDrawingContextImpl context)
{
var canvas = (context as ISkiaDrawingContextImpl)?.SkCanvas;
var leaseFeature = context.GetFeature<ISkiaSharpApiLeaseFeature>();
if (leaseFeature is null)
{
return;
}
using var lease = leaseFeature.Lease();
var canvas = lease?.SkCanvas;
if (canvas is not null)
{
_draw(canvas);

Просмотреть файл

@ -187,20 +187,20 @@ public class Lottie : Control, IAffectsRender
}
/// <inheritdoc/>
protected override void OnPropertyChanged<T>(AvaloniaPropertyChangedEventArgs<T> change)
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
if (change.Property == PathProperty)
{
var path = change.NewValue.GetValueOrDefault<string?>();
var path = change.GetNewValue<string?>();
Load(path);
RaiseInvalidated(EventArgs.Empty);
}
if (change.Property == RepeatCountProperty)
{
_repeatCount = change.NewValue.GetValueOrDefault<int>();
_repeatCount = change.GetNewValue<int>();
Stop();
Start();
InvalidateVisual();
@ -367,7 +367,7 @@ public class Lottie : Control, IAffectsRender
var frameTime = _watch.Elapsed.TotalSeconds;
if (_watch.Elapsed.TotalSeconds > _animation.Duration)
if (_watch.Elapsed.TotalSeconds > _animation.Duration.TotalSeconds)
{
_watch.Restart();
_ic?.End();
@ -404,7 +404,7 @@ public class Lottie : Control, IAffectsRender
var t = GetFrameTime();
if (!_isRunning)
{
t = (float)animation.Duration;
t = (float)animation.Duration.TotalSeconds;
}
var dst = new SKRect(0, 0, animation.Size.Width, animation.Size.Height);