Embed SkiaSharp controls into DrawnUi views/pages #167
-
|
Hey Nick - Great work with this repo - keep it up and Hi All!. Question - I understand that DrawnUi is based off SkiaSharp - but is it possible to create an actual SkiaSharp (SkCanvas) control and embed into a DrawnUi page/customview? if possible, any examples or help on how to do it - much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
HI, well in DrawnUI virtual controls live inside Canvas MAUI control, which uses either SKCanvasView or SKGLView, depending on RenderingMode (Accelerated or not). Cstom handlers come along for those to make standart SkiaSharp MAUI controls even better. We do not have special required Page for DrawnUI, those used are optional subclassed ContentPage with some perks that's all. Even SkiaShell is a subclassed ContentPage that expects you to host a Canvas inside. So if you want to just draw manually on the SkiaSharp canvas, you can either override Draw of the Canvas or do this inside one of the virtual drawn controls inside, overriding Paint if you want to follow the DrawnUI control logic, of overriding Render for "just give me the canvas". The Canvas itsself will be then accessible via DrawingContent passed to those virtual methods. I propose to maybe go the opposite way, if you would give me an example fo what you want to achieve i could give you the code. There are also examples of integrating existing libs that use SkiaSharp, like MapsUi or MauiGraphics. It's rather easy, examples are inside Addons folder. |
Beta Was this translation helpful? Give feedback.
HI, well in DrawnUI virtual controls live inside Canvas MAUI control, which uses either SKCanvasView or SKGLView, depending on RenderingMode (Accelerated or not). Cstom handlers come along for those to make standart SkiaSharp MAUI controls even better.
We do not have special required Page for DrawnUI, those used are optional subclassed ContentPage with some perks that's all. Even SkiaShell is a subclassed ContentPage that expects you to host a Canvas inside.
So if you want to just draw manually on the SkiaSharp canvas, you can either override Draw of the Canvas or do this inside one of the virtual drawn controls inside, overriding Paint if you want to follow the DrawnUI control logic, of …