AvaloniaUI / Avalonia.Labs

Experimental Controls for Avalonia
MIT License
194 stars 25 forks source link

feat: Add SKCanvasView #44

Closed workgroupengineering closed 11 months ago

workgroupengineering commented 11 months ago

A Xaml canvas control that can be drawn on using SkiaSharp drawing commands which facilitates porting from existing Xamarin Forms applications.

workgroupengineering commented 11 months ago

Wouldn't it be better to provide hw-acceleration when it's available?

Yes. Can you tell me where to start doing?

kekekeks commented 11 months ago

The easiest way would be to wrap OpenGlControlBase since it provides a Skia-compatible context

workgroupengineering commented 11 months ago

The easiest way would be to wrap OpenGlControlBase since it provides a Skia-compatible context

Thanks, I'll try.

kekekeks commented 11 months ago

I guess the GPU support should be a separate PR, address review comments and let's get it merged

robloo commented 11 months ago

Note: This seems to be based on the code provided in the discussion here: https://github.com/AvaloniaUI/Avalonia/discussions/12269. That code is itself a rough port from SkiaSharp itself.

1) As mentioned that code was really rough and I really didn't intend for it to get pulled in as-is. Otherwise, I would have done it myself. 1) It might be a good idea to mention this code is a port from SkiaSharp's UWP control 2) It might also be a good idea at some point to get this control in upstream instead

This kind of detail is always great in the PR description for future reference.