mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-28 23:19:53 +08:00
avalonia 11.0.0-preview5
This commit is contained in:
@@ -200,7 +200,7 @@ namespace Avalonia
|
||||
{
|
||||
public static int StartWithClassicDesktopLifetime2<T>(
|
||||
this T builder, string[] args, ShutdownMode shutdownMode = ShutdownMode.OnLastWindowClose)
|
||||
where T : AppBuilderBase<T>, new()
|
||||
where T : AppBuilder, new()
|
||||
{
|
||||
var lifetime = new ClassicDesktopStyleApplicationLifetime2()
|
||||
{
|
||||
|
||||
@@ -22,12 +22,12 @@ public interface IFontManagerImpl2 : IFontManagerImpl
|
||||
return Impl.GetInstalledFontFamilyNames(checkForUpdates);
|
||||
}
|
||||
|
||||
bool IFontManagerImpl.TryMatchCharacter(int codepoint, FontStyle fontStyle, FontWeight fontWeight, FontFamily fontFamily, CultureInfo culture, out Typeface typeface)
|
||||
bool IFontManagerImpl.TryMatchCharacter(int codepoint, FontStyle fontStyle, FontWeight fontWeight, FontStretch fontStretch, FontFamily fontFamily, CultureInfo culture, out Typeface typeface)
|
||||
{
|
||||
return Impl.TryMatchCharacter(codepoint, fontStyle, fontWeight, fontFamily, culture, out typeface);
|
||||
return Impl.TryMatchCharacter(codepoint, fontStyle, fontWeight, fontStretch, fontFamily, culture, out typeface);
|
||||
}
|
||||
|
||||
IGlyphTypefaceImpl IFontManagerImpl.CreateGlyphTypeface(Typeface typeface)
|
||||
IGlyphTypeface IFontManagerImpl.CreateGlyphTypeface(Typeface typeface)
|
||||
{
|
||||
typeface = OnCreateGlyphTypeface(typeface);
|
||||
return Impl.CreateGlyphTypeface(typeface);
|
||||
|
||||
@@ -2,11 +2,12 @@ extern alias AvaloniaSkia;
|
||||
|
||||
using Avalonia.Platform;
|
||||
using AvaloniaSkia::Avalonia.Skia.Helpers;
|
||||
using Avalonia.Visuals.Media.Imaging;
|
||||
using SkiaSharp;
|
||||
using AvaloniaSkia::Avalonia.Skia;
|
||||
using DrawingContextImpl = AvaloniaSkia::Avalonia.Skia.DrawingContextImpl;
|
||||
using IDrawableBitmapImpl = AvaloniaSkia::Avalonia.Skia.IDrawableBitmapImpl;
|
||||
using Avalonia.Media.Imaging;
|
||||
using System.Drawing;
|
||||
|
||||
// https://github.com/AvaloniaUI/Avalonia/blob/0.10.13/src/Skia/Avalonia.Skia/ImmutableBitmap.cs
|
||||
|
||||
@@ -15,9 +16,10 @@ namespace Avalonia.Skia;
|
||||
/// <summary>
|
||||
/// Immutable Skia bitmap.
|
||||
/// </summary>
|
||||
internal class ImmutableBitmap : IDrawableBitmapImpl
|
||||
internal class ImmutableBitmap : IDrawableBitmapImpl, IReadableBitmapImpl
|
||||
{
|
||||
private readonly SKImage _image;
|
||||
private readonly SKBitmap? _bitmap;
|
||||
|
||||
public ImmutableBitmap(SKImage image)
|
||||
{
|
||||
@@ -165,13 +167,13 @@ internal class ImmutableBitmap : IDrawableBitmapImpl
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Save(string fileName)
|
||||
public void Save(string fileName, int? quality = null)
|
||||
{
|
||||
ImageSavingHelper.SaveImage(_image, fileName);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Save(Stream stream)
|
||||
public void Save(Stream stream, int? quality = null)
|
||||
{
|
||||
ImageSavingHelper.SaveImage(_image, stream);
|
||||
}
|
||||
@@ -181,4 +183,16 @@ internal class ImmutableBitmap : IDrawableBitmapImpl
|
||||
{
|
||||
context.Canvas.DrawImage(_image, sourceRect, destRect, paint);
|
||||
}
|
||||
|
||||
public PixelFormat? Format => _bitmap?.ColorType.ToAvalonia();
|
||||
public ILockedFramebuffer Lock()
|
||||
{
|
||||
if (_bitmap is null)
|
||||
throw new NotSupportedException("A bitmap is needed for locking");
|
||||
|
||||
if (_bitmap.ColorType.ToAvalonia() is not { } format)
|
||||
throw new NotSupportedException($"Unsupported format {_bitmap.ColorType}");
|
||||
|
||||
return new LockedFramebuffer(_bitmap.GetPixels(), PixelSize, _bitmap.RowBytes, Dpi, format, null);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
extern alias AvaloniaSkia;
|
||||
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
using Avalonia.Visuals.Media.Imaging;
|
||||
using ISkiaGpu = AvaloniaSkia::Avalonia.Skia.ISkiaGpu;
|
||||
using @this = AvaloniaSkia::Avalonia.Skia.PlatformRenderInterface;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Avalonia.Skia;
|
||||
|
||||
sealed class PlatformRenderInterface : @this, IPlatformRenderInterface
|
||||
{
|
||||
public PlatformRenderInterface(ISkiaGpu? skiaGpu, long? maxResourceBytes = null) : base(skiaGpu, maxResourceBytes)
|
||||
public PlatformRenderInterface(long? maxResourceBytes = null) : base(maxResourceBytes)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ public static class SkiaPlatform2
|
||||
static IPlatformRenderInterface GetPlatformRenderInterface()
|
||||
{
|
||||
var options = AvaloniaLocator.Current.GetService<SkiaOptions>() ?? new();
|
||||
var customGpu = options.CustomGpuFactory?.Invoke();
|
||||
var renderInterface = new PlatformRenderInterface(customGpu, options.MaxGpuResourceSizeBytes);
|
||||
var renderInterface = new PlatformRenderInterface(options.MaxGpuResourceSizeBytes);
|
||||
return renderInterface;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ extern alias AvaloniaSkia;
|
||||
using SkiaSharp;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Utilities;
|
||||
using Avalonia.Visuals.Media.Imaging;
|
||||
|
||||
namespace Avalonia.Skia;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using Avalonia.Shared.PlatformSupport;
|
||||
#if WINDOWS
|
||||
using System.Windows;
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,5 @@
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Styles>
|
||||
<FluentTheme Mode="Light" />
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
|
||||
@@ -26,8 +26,6 @@ global using Avalonia.Media.Imaging;
|
||||
global using Avalonia.Media.Immutable;
|
||||
global using Avalonia.Threading;
|
||||
global using Avalonia.Visuals;
|
||||
global using Avalonia.Visuals.Media;
|
||||
global using Avalonia.Visuals.Media.Imaging;
|
||||
global using Avalonia.Styling;
|
||||
global using Avalonia.Input;
|
||||
#if _IMPORT_AVALONIA_GIF__
|
||||
|
||||
Reference in New Issue
Block a user