Fix compilation: restore clean RC1 codebase
- Restore clean BindableProperty.Create syntax from RC1 commit - Remove decompiler artifacts with mangled delegate types - Add Svg.Skia package reference for icon support - Fix duplicate type definitions - Library now compiles successfully (0 errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,57 +1,62 @@
|
||||
using Microsoft.Maui.Graphics;
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using Microsoft.Maui.Handlers;
|
||||
using Microsoft.Maui.Graphics;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Handlers;
|
||||
|
||||
public class GraphicsViewHandler : ViewHandler<IGraphicsView, SkiaGraphicsView>
|
||||
/// <summary>
|
||||
/// Handler for GraphicsView on Linux using Skia rendering.
|
||||
/// Maps IGraphicsView interface to SkiaGraphicsView platform view.
|
||||
/// IGraphicsView has: Drawable, Invalidate()
|
||||
/// </summary>
|
||||
public partial class GraphicsViewHandler : ViewHandler<IGraphicsView, SkiaGraphicsView>
|
||||
{
|
||||
public static IPropertyMapper<IGraphicsView, GraphicsViewHandler> Mapper = (IPropertyMapper<IGraphicsView, GraphicsViewHandler>)(object)new PropertyMapper<IGraphicsView, GraphicsViewHandler>((IPropertyMapper[])(object)new IPropertyMapper[1] { (IPropertyMapper)ViewHandler.ViewMapper })
|
||||
{
|
||||
["Drawable"] = MapDrawable,
|
||||
["Background"] = MapBackground
|
||||
};
|
||||
public static IPropertyMapper<IGraphicsView, GraphicsViewHandler> Mapper = new PropertyMapper<IGraphicsView, GraphicsViewHandler>(ViewHandler.ViewMapper)
|
||||
{
|
||||
[nameof(IGraphicsView.Drawable)] = MapDrawable,
|
||||
[nameof(IView.Background)] = MapBackground,
|
||||
};
|
||||
|
||||
public static CommandMapper<IGraphicsView, GraphicsViewHandler> CommandMapper = new CommandMapper<IGraphicsView, GraphicsViewHandler>((CommandMapper)(object)ViewHandler.ViewCommandMapper) { ["Invalidate"] = MapInvalidate };
|
||||
public static CommandMapper<IGraphicsView, GraphicsViewHandler> CommandMapper = new(ViewHandler.ViewCommandMapper)
|
||||
{
|
||||
[nameof(IGraphicsView.Invalidate)] = MapInvalidate,
|
||||
};
|
||||
|
||||
public GraphicsViewHandler()
|
||||
: base((IPropertyMapper)(object)Mapper, (CommandMapper)(object)CommandMapper)
|
||||
{
|
||||
}
|
||||
public GraphicsViewHandler() : base(Mapper, CommandMapper)
|
||||
{
|
||||
}
|
||||
|
||||
public GraphicsViewHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
|
||||
: base((IPropertyMapper)(((object)mapper) ?? ((object)Mapper)), (CommandMapper)(((object)commandMapper) ?? ((object)CommandMapper)))
|
||||
{
|
||||
}
|
||||
public GraphicsViewHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
|
||||
: base(mapper ?? Mapper, commandMapper ?? CommandMapper)
|
||||
{
|
||||
}
|
||||
|
||||
protected override SkiaGraphicsView CreatePlatformView()
|
||||
{
|
||||
return new SkiaGraphicsView();
|
||||
}
|
||||
protected override SkiaGraphicsView CreatePlatformView()
|
||||
{
|
||||
return new SkiaGraphicsView();
|
||||
}
|
||||
|
||||
public static void MapDrawable(GraphicsViewHandler handler, IGraphicsView graphicsView)
|
||||
{
|
||||
if (((ViewHandler<IGraphicsView, SkiaGraphicsView>)(object)handler).PlatformView != null)
|
||||
{
|
||||
((ViewHandler<IGraphicsView, SkiaGraphicsView>)(object)handler).PlatformView.Drawable = graphicsView.Drawable;
|
||||
}
|
||||
}
|
||||
public static void MapDrawable(GraphicsViewHandler handler, IGraphicsView graphicsView)
|
||||
{
|
||||
if (handler.PlatformView is null) return;
|
||||
handler.PlatformView.Drawable = graphicsView.Drawable;
|
||||
}
|
||||
|
||||
public static void MapBackground(GraphicsViewHandler handler, IGraphicsView graphicsView)
|
||||
{
|
||||
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
|
||||
if (((ViewHandler<IGraphicsView, SkiaGraphicsView>)(object)handler).PlatformView != null)
|
||||
{
|
||||
Paint background = ((IView)graphicsView).Background;
|
||||
SolidPaint val = (SolidPaint)(object)((background is SolidPaint) ? background : null);
|
||||
if (val != null && val.Color != null)
|
||||
{
|
||||
((ViewHandler<IGraphicsView, SkiaGraphicsView>)(object)handler).PlatformView.BackgroundColor = val.Color.ToSKColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void MapBackground(GraphicsViewHandler handler, IGraphicsView graphicsView)
|
||||
{
|
||||
if (handler.PlatformView is null) return;
|
||||
|
||||
public static void MapInvalidate(GraphicsViewHandler handler, IGraphicsView graphicsView, object? args)
|
||||
{
|
||||
((ViewHandler<IGraphicsView, SkiaGraphicsView>)(object)handler).PlatformView?.Invalidate();
|
||||
}
|
||||
if (graphicsView.Background is SolidPaint solidPaint && solidPaint.Color is not null)
|
||||
{
|
||||
handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor();
|
||||
}
|
||||
}
|
||||
|
||||
public static void MapInvalidate(GraphicsViewHandler handler, IGraphicsView graphicsView, object? args)
|
||||
{
|
||||
handler.PlatformView?.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user