skiasharp

Load SVG file in Xamarin with SkiaSharp

混江龙づ霸主 提交于 2020-01-23 13:49:49
问题 From release 1.55.0 SkiaSharp has the support for reading SVG files. The package has been release few days ago (10 Nov. 2016) and I couldn't find enough documentation on how to use it. The following packages are required: SkiaSharp 1.55.0 SkiaSharp Views & Layers 1.55.0 SkiaSharp.Svg 1.55.0-beta1 The first question is what's the best way to load an SKSvg in Xamarin.Android? 回答1: Here two possible solutions to start working with SkiaSharp that are working for me: Loading SVG from Asset folder

Load SVG file in Xamarin with SkiaSharp

瘦欲@ 提交于 2020-01-23 13:49:27
问题 From release 1.55.0 SkiaSharp has the support for reading SVG files. The package has been release few days ago (10 Nov. 2016) and I couldn't find enough documentation on how to use it. The following packages are required: SkiaSharp 1.55.0 SkiaSharp Views & Layers 1.55.0 SkiaSharp.Svg 1.55.0-beta1 The first question is what's the best way to load an SKSvg in Xamarin.Android? 回答1: Here two possible solutions to start working with SkiaSharp that are working for me: Loading SVG from Asset folder

Load SVG file in Xamarin with SkiaSharp

放肆的年华 提交于 2020-01-23 13:48:06
问题 From release 1.55.0 SkiaSharp has the support for reading SVG files. The package has been release few days ago (10 Nov. 2016) and I couldn't find enough documentation on how to use it. The following packages are required: SkiaSharp 1.55.0 SkiaSharp Views & Layers 1.55.0 SkiaSharp.Svg 1.55.0-beta1 The first question is what's the best way to load an SKSvg in Xamarin.Android? 回答1: Here two possible solutions to start working with SkiaSharp that are working for me: Loading SVG from Asset folder

Draw rotated text in SkiaSharp

妖精的绣舞 提交于 2020-01-23 07:33:14
问题 How to draw rotated text in SkiaSharp . Currently I'm rotating the SKCanvas , drawing the text and then rotating it back. But I thought may be there is a more efficient way to do this. canvas.RotateDegrees(45, 20, 20); canvas.DrawText("Text", 20, 20, paint); canvas.RotateDegrees(-45, 20, 20); 回答1: That is the correct way (the only way, I think). It is not that inefficient as you are not really rotating the canvas, but rather adjusting the drawing matrix (an int[9] array). Under the hood it is

drawing on bitmap using skiasharp in xamarin

末鹿安然 提交于 2019-12-25 00:06:21
问题 I have a bitmap which I am placing on canvas using SKRect as the size of image is large. I am trying to draw on the bitmap but the touching co-ordinates don't match with the bitmap co-ordinates (i.e.the touch on canvas and the drawn curves are different from each other) or I am touching somewhere and the drawn curve is on different co-ordinates. Here is the code I am trying. Any help on this would be very helpful. Thanks void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs

Xamarin: how to get cursor/touch coordinates (position X and Y)?

こ雲淡風輕ζ 提交于 2019-12-24 00:52:41
问题 Introduction I am creating my first Xamarin app (that will target UWP first, then Android, finally maybe iOS). Basically, the app should detect multiple fingers and circles will pop over each finger and follow them. My app First I thought that UI and graphics couldn't be coded with Xamarin so I started UWP code : MainPage.xaml.cs using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime;

Xamarin Forms - async Task “Signature (return type) of EventHandler doesn't match the event type”

末鹿安然 提交于 2019-12-13 08:13:15
问题 when I update Xamarin forms to 3.2.0 or higher, I am getting the following error: Error Position 68:29. Signature (return type) of EventHandler "TimeToSport.Views.ItemsPage.OnCanvasViewPaintSurfaceAsync" doesn't match the event type TimeToSport E:\Xamarin Projects\TimeToSport_master\TimeToSport\TimeToSport\Views\Main\ItemsPage.xaml 68 The error is coming from this code (xaml): <skia:SKCanvasView x:Name="canvas" PaintSurface="OnCanvasViewPaintSurfaceAsync" Grid.Row="2" /> In the CS file:

Convert SKSurface to SKBitmap and resize into a image of a specific size on different device sizes

扶醉桌前 提交于 2019-12-11 16:10:02
问题 I have a Xamarin forms view where based on touch events i can alter the image <StackLayout > <skia:SKCanvasView x:Name="canvasView" PaintSurface="ImageCanvas_PaintSurface" EnableTouchEvents="True" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" IgnorePixelScaling="True"// not sure if i need this?? Touch="OnTouch" /> <Button Text="Generate Image" Clicked="CreateButton_Clicked"/> </StackLayout> I need to generate a image of exactly 1060 x 550 based on what is drawn on the

How to add OnTouch Event in android with SkiaSharp

坚强是说给别人听的谎言 提交于 2019-12-11 14:26:34
问题 I have a problem. I am using SkiaSharp to make a TriangleGrid. Now I am doing drawing the Grid, but now I want to touch a triangle in the grid to color it. To do that I need to add a TouchEvent to the SKCanvasView, but I dont know how to do that. On the internet I can find the next example: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/paths/finger-paint https://github.com/mattleibow/SkiaSharpDemo/blob/master/SkiaSharpDemo/SkiaSharpDemo/MainPage.xaml

How to get path of font file from asset folder and how to use that path to set SKTypeface in xamarin android?

邮差的信 提交于 2019-12-11 06:08:02
问题 I am working in native xamarin andorid. I am facing issue to set custom font. I am using "SkiaSharp" plugin to generate canvas view. That plugin is inside PCL so that can be use in both android and ios. I have one .ttf file in my "Assets" folder. I generate font path using following code. string path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); string FontPath = System.IO.Path.Combine(path, "Myfile.ttf"); this Path I send to PCL to set "SKTypeface" paint