Files
maui-linux/Handlers/GraphicsViewHandler.cs
Dave Friedel 1f096c38dc Update with recovered code from VM binaries (Jan 1)
Recovered from decompiled OpenMaui.Controls.Linux.dll:
- SkiaShell.cs: FlyoutHeader, FlyoutFooter, scroll support (918 -> 1325 lines)
- X11Window.cs: Cursor support (XCreateFontCursor, XDefineCursor)
- All handlers with dark mode support
- All services with latest implementations
- LinuxApplication with theme change handling
2026-01-01 06:22:48 -05:00

58 lines
2.3 KiB
C#

using Microsoft.Maui.Graphics;
using Microsoft.Maui.Handlers;
namespace Microsoft.Maui.Platform.Linux.Handlers;
public 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 CommandMapper<IGraphicsView, GraphicsViewHandler> CommandMapper = new CommandMapper<IGraphicsView, GraphicsViewHandler>((CommandMapper)(object)ViewHandler.ViewCommandMapper) { ["Invalidate"] = MapInvalidate };
public GraphicsViewHandler()
: base((IPropertyMapper)(object)Mapper, (CommandMapper)(object)CommandMapper)
{
}
public GraphicsViewHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
: base((IPropertyMapper)(((object)mapper) ?? ((object)Mapper)), (CommandMapper)(((object)commandMapper) ?? ((object)CommandMapper)))
{
}
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 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 MapInvalidate(GraphicsViewHandler handler, IGraphicsView graphicsView, object? args)
{
((ViewHandler<IGraphicsView, SkiaGraphicsView>)(object)handler).PlatformView?.Invalidate();
}
}