How to render a layout into an image?

I’m working on a Tizen.NET wearable Xamarin.Forms application and I’m looking for a way to render a simple layout into a bitmap/image, which after that I’d like to use in another layout. In some cases it can be just one “Label” that I need to render as an image. In other cases it may be a little more complex, let’s say a “StackLayout” with a few “Label”, nothing more. If it is not possible to do it using Xamarin API maybe there is a way to do it using objects from the ElmSharp namespace. I would like to avoid using extra libraries for that but if SkiaSharp can help I don’t mind using it. I need at least a starting point how to do it, a complete example would be ideal. I did similar thing on Xamarin + Android but I have no idea how to approach it with Tizen.

UPDATE: it seems to me this is my starting point evas_render_copy, at least one of the possible ones. That is just my guess, of course. It looks like it’s supposed to give me an image from a canvas but there are two major stumbling blocks. This is the Native API. I would rather not use it if a similar method is exposed somewhere in the ElmSharp namespace, but I didn’t find anything like that there yet. Another thing, I still don’t fully understand the architecture of the UI, how to create invisible canvas, render something on it and then create a Xamarin.Froms ImageSource out of it.

UPDATE: Still didn’t find any methods in the managed API for rendering and my try to use the native API failed as well. I declared the native function like that

  [DllImport("evas", EntryPoint = "evas_render_copy")]
  private static extern int RenderCopy(IntPtr obj, IntPtr buffer, int stride, int width, int height, uint format, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh);

I tried to call it like that

     if(nativeView is Canvas canvas) {
        IntPtr buffer = Marshal.AllocHGlobal(100000);
        RenderCopy(canvas.Handle, buffer, 0, 10, 10, 0u, 0, 0, 10, 10, 0, 0, 10, 10);
     }

That miserably failed which is not really a surprise. I don’t understand what those arguments are supposed to be. Is there a detailed documentation for this native function anywhere?

UPDATE: On the other had the function evas_render_copy seems to belong to IoT native API and I guess it might not be available on wearable. Still trying to find a way to render a canvas to an image.

Hi,
You can check this github repo. This may help you to find a suitable sample project that you are looking for. Check the UI folder, there are several applications which are related to the complex UI interface. Hope this helps you.
If you already have some solution, you can share it with us.