How to Use SkiaSharp in Tizen .NET
skiasharp is a cross-platform 2d graphics api for .net platforms powered by the google skia library. skiasharp provides a comprehensive api that is used on mobile, tv, watch, and desktop platforms. you can use skiasharp to create many different types of graphics, tables, and text in your own application. for more information about skiasharp apis, see the skiasharp api guide. this blog introduces skiasharp use in tizen .net. create a tizen .net application create a tizen .net ui application. if you are not familiar with the tizen .net application, see quick guides for further information. in this blog, we share example code using elmsharp. the sample application references the tizenfx package, which contains elmsharp. change the target framework change the targetframework of the ui application project file (.csproj) using skiasharp in tizen .net. as is <propertygroup> <outputtype>exe</outputtype> <targetframework>netcoreapp2.0</targetframework> </propertygroup> new <propertygroup> <outputtype>exe</outputtype> <targetframework>tizen40</targetframework> </propertygroup> note: this example is based on tizen 4.0. if your application is based on tizen 5.0, change targetframework to tizen50 instead of tizen40. install the nuget packages for skiasharp in solution explorer, right-click on the project name of your ui application and click manage nuget packages. select the browse tab choose nuget.org as the package source, and search for skiasharp and skiasharp.views. select these packages in the list, and click install. draw the text create the skcanvasview and use skiasharp drawing commands to draw simple text. add paintsurface event handler of skcanvasview. implement the following example code inside paintsurface event handler to draw text using skcanvas's drawtext method: using tizen.applications; using elmsharp; using skiasharp; using skiasharp.views.tizen; namespace skiasharptizen { class app : coreuiapplication { protected override void oncreate() { base.oncreate(); window window = new window("elmsharpapp") { availablerotations = displayrotation.degree_0 | displayrotation.degree_180 | displayrotation.degree_270 | displayrotation.degree_90 }; window.backbuttonpressed += (s, e) => { exit(); }; window.show(); var skiaview = new skcanvasview(window); skiaview.paintsurface += onpaintsurface; skiaview.show(); var conformant = new conformant(window); conformant.show(); conformant.setcontent(skiaview); } private void onpaintsurface(object sender, skpaintsurfaceeventargs e) { var skiaview = sender as skcanvasview; var canvas = e.surface.canvas; var scale = (float)scalinginfo.scalingfactor; var scaledsize = new sksize(e.info.width / scale, e.info.height / scale); canvas.scale(scale); canvas.clear(skcolors.yellow); var paint = new skpaint { color = skcolors.black, isantialias = true, style = skpaintstyle.fill, textalign = sktextalign.center, textsize = 20 }; var coord = new skpoint(scaledsize.width / 2, (scaledsize.height + paint.textsize) / 2); canvas.drawtext("skiasharp in tizen", coord, paint); } static void main(string[] args) { elementary.initialize(); elementary.themeoverlay(); app app = new app(); app.run(args); } } } build the application project, install, and run this application. draw the star polygon to draw a star polygon, add the skcanvasview paintsurface event handler. then use the following example code to draw a star polygon: private void ondrawsample(skcanvas canvas, int width, int height) { var size = ((float)height > width ? width : height) * 0.75f; var r = 0.45f * size; var tau = 6.2831853f; using (var path = new skpath()) { path.moveto(r, 0.0f); for (int i = 1; i < 7; ++i) { var theta = 3f * i * tau / 7f; path.lineto(r * (float)math.cos(theta), r * (float)math.sin(theta)); } path.close(); using (var paint = new skpaint()) { paint.isantialias = true; canvas.clear(skcolors.lightblue); canvas.translate(width / 2f, height / 2f); canvas.drawpath(path, paint); } } } private void onpaintsurface(object sender, skpaintsurfaceeventargs e) { ondrawsample(e.surface.canvas, e.info.width, e.info.height); } for more information, see the skiasharp2dsample on github. if you have any questions about using skiasharp in tizen .net, use issues to contact us.