當前位置: 首頁>>代碼示例>>C#>>正文


C# SKPaint.Dispose方法代碼示例

本文整理匯總了C#中SkiaSharp.SKPaint.Dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# SKPaint.Dispose方法的具體用法?C# SKPaint.Dispose怎麽用?C# SKPaint.Dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SkiaSharp.SKPaint的用法示例。


在下文中一共展示了SKPaint.Dispose方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateBackgroundImage

		public SKImage CreateBackgroundImage ()
		{
			SKPaint paint = null;
			SKPath path = null;

			try 
			{
				var height = (int)Bounds.Height;
				var width = (int)Bounds.Width;

				using (var surface = SKSurface.Create (width, height, SKColorType.N_32, SKAlphaType.Premul)) 
				{
					var canvas = surface.Canvas;

					//canvas.Clear (SKColors.Beige);

					paint = new SKPaint
					{
						Color = SKColors.DarkBlue,
						IsStroke = true,
						StrokeWidth = 1,
						StrokeCap = SKStrokeCap.Round,
						IsAntialias = true
					};

					//path = new SKPath ();
					//path.MoveTo (0f, 0f);
					//path.LineTo (width, height);
					//path.Close ();

					//canvas.DrawPath (path, paint);


					//DrawArc (canvas, paint, 0, 90);

					var start = -90;
					var end = 0;

					//DrawCircle (canvas, paint, width / 2, height / 2, width / 2 - 4);
					DrawArcFromTo (canvas, paint, width / 2, height / 2, width / 2 - 4, start, end);
					DrawArcFromTo (canvas, paint, width / 2, height / 2, (int)((width / 2 - 4) * 0.8), start, end);

					return surface.Snapshot ();
				}
			} 
			finally 
			{
				if (paint != null)
					paint.Dispose ();

				if (path != null)
					path.Dispose ();
			}
		}
開發者ID:yonglehou,項目名稱:Orleans.MobileDashboard,代碼行數:54,代碼來源:HealthIndicatorView.xaml.cs


注:本文中的SkiaSharp.SKPaint.Dispose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。