Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="DotSpatial.Projections" Version="[4.0.656,5.0.0)" />
<PackageVersion Include="CommunityToolkit.Maui.Markup" Version="[1.0.0,2.0.0)" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageVersion Include="DotNext.Threading" Version="5.15.0" />
<PackageVersion Include="Eto.Forms" Version="[2.8.0,3.0.0)" />
<PackageVersion Include="Eto.Platform.Wpf" Version="[2.8.0,3.0.0)" />
Expand All @@ -32,8 +32,8 @@
<PackageVersion Include="Eto.Platform.XamMac2" Version="[2.8.0,3.0.0)" />
<PackageVersion Include="Eto.Platform.Gtk" Version="[2.8.0,3.0.0)" />
<PackageVersion Include="Eto.SkiaDraw" Version="[0.2.0,0.3.0)" />
<PackageVersion Include="HarfBuzzSharp" Version="8.3.0.1" />
<PackageVersion Include="HarfBuzzSharp.NativeAssets.WebAssembly" Version="8.3.0.1" />
<PackageVersion Include="HarfBuzzSharp" Version="8.3.1.1" />
<PackageVersion Include="HarfBuzzSharp.NativeAssets.WebAssembly" Version="8.3.1.1" />
<PackageVersion Include="IDisposableAnalyzers" Version="[4.0.8,5.0.0)" />
<PackageVersion Include="Mapsui.Android" Version="5.0.0-beta.8" />
<PackageVersion Include="Mapsui.ArcGIS" Version="5.0.0-beta.8" />
Expand Down Expand Up @@ -62,23 +62,23 @@
<PackageVersion Include="NetTopologySuite.IO.GeoJSON4STJ" Version="[4.0.0,5.0.0)" />
<PackageVersion Include="NUnit" Version="4.3.2" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageVersion Include="SkiaSharp" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.HarfBuzz" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.NativeAssets.iOS" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.NativeAssets.WebAssembly" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.Skottie" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.Views" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.Views.Blazor" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.Views.Maui.Controls" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.Views.Uno" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.Views.WinUI" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.Views.WPF" Version="3.116.1" />
<PackageVersion Include="SkiaSharp.Views.WindowsForms" Version="3.116.1" />
<PackageVersion Include="SkiaSharp" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.HarfBuzz" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.NativeAssets.iOS" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.NativeAssets.WebAssembly" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.Skottie" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.Views" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.Views.Blazor" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.Views.Maui.Controls" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.Views.Uno" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.Views.WinUI" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.Views.WPF" Version="3.119.0" />
<PackageVersion Include="SkiaSharp.Views.WindowsForms" Version="3.119.0" />
<PackageVersion Include="sqlite-net-pcl" Version="1.9.172" />
<PackageVersion Include="SQLitePCLRaw.bundle_green" Version="2.1.10" />
<PackageVersion Include="Svg.Skia" Version="2.0.0.4" />
<PackageVersion Include="Svg.Skia" Version="3.0.0" />
<PackageVersion Include="System.Formats.Asn1" Version="9.0.0" />
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
<PackageVersion Include="Topten.RichTextKit" Version="0.4.167" />
Expand Down
3 changes: 1 addition & 2 deletions Mapsui.Rendering.Skia/SkiaStyles/SvgColorModifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using Svg;
using Svg.Model;

namespace Mapsui.Styles;

Expand All @@ -14,7 +13,7 @@ public static MemoryStream GetModifiedSvg(byte[] bytes, Color? fillColor = null,
var svgStrokeColor = (System.Drawing.Color?)strokeColor;

using var memoryStream = new MemoryStream(bytes);
var svgDocument = SvgExtensions.Open(memoryStream) ?? throw new Exception("Could not open stream as svg");
var svgDocument = SvgDocument.Open<SvgDocument>(memoryStream) ?? throw new Exception("Could not open stream as svg");

var elements = GetAllElements(svgDocument.Children);
foreach (var element in elements)
Expand Down
3 changes: 2 additions & 1 deletion Mapsui.UI.Uno.WinUI/Mapsui.UI.Uno.WinUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
https://aka.platform.uno/singleproject-features
-->
<UnoFeatures>
</UnoFeatures>
SkiaRenderer;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the UnoFeatures SkiaRenderer do? It uses SkiaRendering instead of something else? Which platforms does it affect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SkiaRenderer is now the default on Uno 6.0. I'll investigate if this is needed in the Control. My guess is that this setting only works on an WinUI Application, because only in the WinUI Sample the references changed when I enabled this. But nothing changed in the MapControl.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed in the Control too, It adds some more dependencies (But only in the Wasm Targets)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should be using SkiaRenderer here - it will make it stop working on native renderers. The correct thing to do is leave it off unless you only want to support skia.

Copy link

@mikernet mikernet Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that #if ANDROID blocks won't have any effect when a non-skia library is used on skia renderer app though.

LiveCharts2 renders using skia and it works on both native and skia renderers, might be worth having a look at what they did?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikernet There #if ANDROID was removed, so that is a good thing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should be using SkiaRenderer here - it will make it stop working on native renderers. The correct thing to do is leave it off unless you only want to support skia.

To 'support skia' means that the entire interface is rendered to a skia canvas, right? And from your url I understand that this is the default for Android and iOS fro Uno 6, but apparently it is just an option. So, the question is what Mapsui should support, or what it needs to do to support both.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pauldendulk Sorry, that was slightly confusing phrasing from me. For a library to support both uno native and uno skia renderers (where the whole app is rendered to a skia canvas), the library itself should not use the SkiaRenderer feature. The controls in the library itself can render to a skia surface I believe, as apparently evidenced by LiveCharts2 working fine on both, but not sure what caveats that entails.

</UnoFeatures>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

Expand Down
15 changes: 4 additions & 11 deletions Mapsui.UI.WinUI/MapControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@

public MapControl()
{
SharedConstructor();

// The commented out code crashes the app when MouseWheelAnimation.Duration > 0. Could be a bug in SKXamlCanvas
//if (Dispatcher.HasThreadAccess) _canvas?.Invalidate();
//else RunOnUIThread(() => _canvas?.Invalidate());
Expand All @@ -62,6 +60,9 @@
_canvas.PaintSurface += Canvas_PaintSurface;
}

// The Canvas needs to be first set before calling the Shared Constructor or else it crashes in the InvalidateCanvas
SharedConstructor();
Copy link
Contributor Author

@inforithmics inforithmics Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to move it here or it crashed on my computer with _canvas not initilized in InitCanvas(); I think this could be a problem on other platforms too. But I think this should be then a seperate pull request.

Copy link
Member

@pauldendulk pauldendulk Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is. I was just looking into this because of another bug report I got.


Children.Add(_selectRectangle);

Loaded += MapControlLoaded;
Expand Down Expand Up @@ -304,7 +305,7 @@
GC.SuppressFinalize(this);
}
#elif HAS_UNO && __IOS__ // on ios don't dispose _canvas, _canvasGPU, _selectRectangle, base class
protected new virtual void Dispose(bool disposing)

Check warning on line 308 in Mapsui.UI.WinUI/MapControl.cs

View workflow job for this annotation

GitHub Actions / macBuild

The member 'MapControl.Dispose(bool)' does not hide an accessible member. The new keyword is not required.

Check warning on line 308 in Mapsui.UI.WinUI/MapControl.cs

View workflow job for this annotation

GitHub Actions / macBuild

The member 'MapControl.Dispose(bool)' does not hide an accessible member. The new keyword is not required.

Check warning on line 308 in Mapsui.UI.WinUI/MapControl.cs

View workflow job for this annotation

GitHub Actions / macBuild

The member 'MapControl.Dispose(bool)' does not hide an accessible member. The new keyword is not required.

Check warning on line 308 in Mapsui.UI.WinUI/MapControl.cs

View workflow job for this annotation

GitHub Actions / macBuild

The member 'MapControl.Dispose(bool)' does not hide an accessible member. The new keyword is not required.

Check warning on line 308 in Mapsui.UI.WinUI/MapControl.cs

View workflow job for this annotation

GitHub Actions / macBuild

The member 'MapControl.Dispose(bool)' does not hide an accessible member. The new keyword is not required.

Check warning on line 308 in Mapsui.UI.WinUI/MapControl.cs

View workflow job for this annotation

GitHub Actions / macBuild

The member 'MapControl.Dispose(bool)' does not hide an accessible member. The new keyword is not required.

Check warning on line 308 in Mapsui.UI.WinUI/MapControl.cs

View workflow job for this annotation

GitHub Actions / winBuild

The member 'MapControl.Dispose(bool)' does not hide an accessible member. The new keyword is not required.

Check warning on line 308 in Mapsui.UI.WinUI/MapControl.cs

View workflow job for this annotation

GitHub Actions / winBuild

The member 'MapControl.Dispose(bool)' does not hide an accessible member. The new keyword is not required.
{
SharedDispose(disposing);
}
Expand All @@ -313,22 +314,14 @@
{
GC.SuppressFinalize(this);
}
#else
#if __ANDROID__
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ghd #if ANDROID is not relevant anymore. Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dispose in Android is now too only Dispose() without (boolean) Parameter so making an #if Android compilation made no sense anymore because it is the same code as the #else case.

protected new virtual void Dispose(bool disposing)
{
CommonUnoDispose(disposing);
SharedDispose(disposing);
base.Dispose(disposing);
}
#else
protected virtual void Dispose(bool disposing)
{
CommonUnoDispose(disposing);
SharedDispose(disposing);
base.Dispose();
}
#endif

public new void Dispose()
{
Dispose(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,17 @@
https://aka.platform.uno/singleproject-features
-->
<UnoFeatures>
</UnoFeatures>
SkiaRenderer;
</UnoFeatures>
</PropertyGroup>

<!--workaround for Uno.Resizetizer uses a newer skiasharp version then maui resizetizer -->
<ItemGroup>
<PackageReference Include="Uno.Resizetizer" VersionOverride="1.5.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<!--workaround for Uno.Resizetizer uses a newer skiasharp version then maui resizetizer -->
<ItemGroup>
<PackageReference Include="Uno.Resizetizer" VersionOverride="1.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.Contains('windows'))">
<PackageReference Include="SkiaSharp.Views.WinUI"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Android.Runtime;
using Com.Nostra13.Universalimageloader.Core;

namespace Mapsui.Samples.Uno.WinUI.Droid;

Expand All @@ -15,19 +14,6 @@ public class Application : Microsoft.UI.Xaml.NativeApplication
public Application(IntPtr javaReference, JniHandleOwnership transfer)
: base(() => new App(), javaReference, transfer)
{
ConfigureUniversalImageLoader();
}

private static void ConfigureUniversalImageLoader()
{
// Create global configuration and initialize ImageLoader with this config
ImageLoaderConfiguration config = new ImageLoaderConfiguration
.Builder(Context)
.Build();

ImageLoader.Instance.Init(config);

ImageSource.DefaultImageLoader = ImageLoader.Instance.LoadImageAsync;
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Uno.UI.Runtime.Skia;
using Uno.UI.Hosting;

namespace Mapsui.Samples.Uno.WinUI;

Expand All @@ -9,7 +9,7 @@ public static void Main(string[] args)
{
App.InitializeLogging();

var host = SkiaHostBuilder.Create()
var host = UnoPlatformHostBuilder.Create()
.App(() => new App())
.UseX11()
.UseLinuxFrameBuffer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ public class Program

public static int Main(string[] args)
{
Microsoft.UI.Xaml.Application.Start(_ => _app = new App());
var host = UnoPlatformHostBuilder.Create()
.App(() => new App())
.UseWebAssembly()
.Build();

return 0;
await host.RunAsync();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using UIKit;
using Uno.UI.Hosting;

namespace Mapsui.Samples.Uno.WinUI.iOS;

Expand All @@ -7,8 +7,13 @@ public class EntryPoint
// This is the main entry point of the application.
public static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(App));
App.InitializeLogging();

var host = UnoPlatformHostBuilder.Create()
.App(() => new App())
.UseAppleUIKit()
.Build();

host.Run();
}
}
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"rollForward": "disable"
},
"msbuild-sdks": {
"Uno.Sdk": "5.5.56"
"Uno.Sdk": "6.0.130"
}
}
Loading