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,93 +1,66 @@
|
||||
using System;
|
||||
using Microsoft.Maui.Controls;
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform;
|
||||
|
||||
/// <summary>
|
||||
/// Skia-rendered BoxView - a simple colored rectangle.
|
||||
/// </summary>
|
||||
public class SkiaBoxView : SkiaView
|
||||
{
|
||||
public static readonly BindableProperty ColorProperty = BindableProperty.Create("Color", typeof(SKColor), typeof(SkiaBoxView), (object)SKColors.Transparent, (BindingMode)2, (ValidateValueDelegate)null, (BindingPropertyChangedDelegate)delegate(BindableObject b, object o, object n)
|
||||
{
|
||||
((SkiaBoxView)(object)b).Invalidate();
|
||||
}, (BindingPropertyChangingDelegate)null, (CoerceValueDelegate)null, (CreateDefaultValueDelegate)null);
|
||||
public static readonly BindableProperty ColorProperty =
|
||||
BindableProperty.Create(nameof(Color), typeof(SKColor), typeof(SkiaBoxView), SKColors.Transparent,
|
||||
propertyChanged: (b, o, n) => ((SkiaBoxView)b).Invalidate());
|
||||
|
||||
public static readonly BindableProperty CornerRadiusProperty = BindableProperty.Create("CornerRadius", typeof(float), typeof(SkiaBoxView), (object)0f, (BindingMode)2, (ValidateValueDelegate)null, (BindingPropertyChangedDelegate)delegate(BindableObject b, object o, object n)
|
||||
{
|
||||
((SkiaBoxView)(object)b).Invalidate();
|
||||
}, (BindingPropertyChangingDelegate)null, (CoerceValueDelegate)null, (CreateDefaultValueDelegate)null);
|
||||
public static readonly BindableProperty CornerRadiusProperty =
|
||||
BindableProperty.Create(nameof(CornerRadius), typeof(float), typeof(SkiaBoxView), 0f,
|
||||
propertyChanged: (b, o, n) => ((SkiaBoxView)b).Invalidate());
|
||||
|
||||
public SKColor Color
|
||||
{
|
||||
get
|
||||
{
|
||||
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
|
||||
return (SKColor)((BindableObject)this).GetValue(ColorProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
|
||||
((BindableObject)this).SetValue(ColorProperty, (object)value);
|
||||
}
|
||||
}
|
||||
public SKColor Color
|
||||
{
|
||||
get => (SKColor)GetValue(ColorProperty);
|
||||
set => SetValue(ColorProperty, value);
|
||||
}
|
||||
|
||||
public float CornerRadius
|
||||
{
|
||||
get
|
||||
{
|
||||
return (float)((BindableObject)this).GetValue(CornerRadiusProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
((BindableObject)this).SetValue(CornerRadiusProperty, (object)value);
|
||||
}
|
||||
}
|
||||
public float CornerRadius
|
||||
{
|
||||
get => (float)GetValue(CornerRadiusProperty);
|
||||
set => SetValue(CornerRadiusProperty, value);
|
||||
}
|
||||
|
||||
protected override void OnDraw(SKCanvas canvas, SKRect bounds)
|
||||
{
|
||||
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_0020: Expected O, but got Unknown
|
||||
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
|
||||
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
|
||||
SKPaint val = new SKPaint
|
||||
{
|
||||
Color = Color,
|
||||
Style = (SKPaintStyle)0,
|
||||
IsAntialias = true
|
||||
};
|
||||
try
|
||||
{
|
||||
if (CornerRadius > 0f)
|
||||
{
|
||||
canvas.DrawRoundRect(bounds, CornerRadius, CornerRadius, val);
|
||||
}
|
||||
else
|
||||
{
|
||||
canvas.DrawRect(bounds, val);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
((IDisposable)val)?.Dispose();
|
||||
}
|
||||
}
|
||||
protected override void OnDraw(SKCanvas canvas, SKRect bounds)
|
||||
{
|
||||
using var paint = new SKPaint
|
||||
{
|
||||
Color = Color,
|
||||
Style = SKPaintStyle.Fill,
|
||||
IsAntialias = true
|
||||
};
|
||||
|
||||
protected override SKSize MeasureOverride(SKSize availableSize)
|
||||
{
|
||||
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
|
||||
float num = ((base.WidthRequest >= 0.0) ? ((float)base.WidthRequest) : (float.IsInfinity(((SKSize)(ref availableSize)).Width) ? 40f : ((SKSize)(ref availableSize)).Width));
|
||||
float num2 = ((base.HeightRequest >= 0.0) ? ((float)base.HeightRequest) : (float.IsInfinity(((SKSize)(ref availableSize)).Height) ? 40f : ((SKSize)(ref availableSize)).Height));
|
||||
if (float.IsNaN(num))
|
||||
{
|
||||
num = 40f;
|
||||
}
|
||||
if (float.IsNaN(num2))
|
||||
{
|
||||
num2 = 40f;
|
||||
}
|
||||
return new SKSize(num, num2);
|
||||
}
|
||||
if (CornerRadius > 0)
|
||||
{
|
||||
canvas.DrawRoundRect(bounds, CornerRadius, CornerRadius, paint);
|
||||
}
|
||||
else
|
||||
{
|
||||
canvas.DrawRect(bounds, paint);
|
||||
}
|
||||
}
|
||||
|
||||
protected override SKSize MeasureOverride(SKSize availableSize)
|
||||
{
|
||||
// BoxView uses explicit size or a default size when in unbounded context
|
||||
var width = WidthRequest >= 0 ? (float)WidthRequest :
|
||||
(float.IsInfinity(availableSize.Width) ? 40f : availableSize.Width);
|
||||
var height = HeightRequest >= 0 ? (float)HeightRequest :
|
||||
(float.IsInfinity(availableSize.Height) ? 40f : availableSize.Height);
|
||||
|
||||
// Ensure no NaN values
|
||||
if (float.IsNaN(width)) width = 40f;
|
||||
if (float.IsNaN(height)) height = 40f;
|
||||
|
||||
return new SKSize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user