-
Notifications
You must be signed in to change notification settings - Fork 719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for SkiaVisual
#15166
Comments
Awesome, thank you @jeromelaban . I'm looking forward to this feature Why not SKXamlCanvas? Because the SKXamlCanvas is working the hack thing. The SKXamlCanvas will render and then copy to WriteableBitmap to show. The SKXamlCanvas have to copy the pixel data to WriteableBitmap : public partial class SKXamlCanvas : Canvas
{
private void DoInvalidate()
{
...
var info = CreateBitmap(out var unscaledSize, out var dpi);
using (var surface = SKSurface.Create(info, pixelsHandle.AddrOfPinnedObject(), info.RowBytes))
{
...
OnPaintSurface(...);
}
// This implementation is not fast enough, and providing the original pixel buffer
// is needed, yet the internal `IBufferByteAccess` interface is not yet available in Uno.
// Once it is, we can replace this implementation and provide the pinned array directly
// to skia.
using (var data = bitmap.PixelBuffer.AsStream())
{
data.Write(pixels, 0, pixels.Length);
data.Flush();
}
bitmap.Invalidate();
}
} Before the SkiaVisual added, we can use the hack code to implemente the same functionality. The demo code: https://github.com/lindexi/lindexi_gd/tree/5db72c3d67f121becefb5c4e8a0eacd5099c4198/KefalurcilaybelJallbuderenajel |
Thanks for the update. The hack you're suggesting is about exposing an API that is not meant to be exposed in the first place. We need a |
Good job! |
@jeromelaban, @rafael-rosa-knowcode should @jhanvi03 or @Darsh0307 test the uno samples app for this new support? |
@agneszitte yes, the uno samples app contains a new sample for WPF and X11. |
@agneszitte @jeromelaban Not yet. The work is pretty much done but I removed it from #16621 because the PR was getting too big and we wanted to merge the GLCanvasElement work. I will open another PR for SKCanvasElement soon. |
Thanks for the info @ramezgerges, let them know when it will be ready for QA when it will be done please |
What would you like to be added
Add support for a composition level
SkiaVisual
, which can allow third parties to useSkiaSharp
in a constrained visual.Why is this needed
Faster implementation of the
SKXamlCanvas
, and hardware acceleration for such controls, or custom visuals based onSkiaVisual
.For which platform
No response
Anything else we need to know?
Such an API cannot be provided at the XAML level for threading concerns.
A similar implementation for a visual is
TextVisual
, for which there's currently no publicly available API.The text was updated successfully, but these errors were encountered: