SkiaSharp.SKPaint.Dispose C# (CSharp) Method

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void
		protected override void Dispose (bool disposing)
		{
			if (Handle != IntPtr.Zero && OwnsHandle) {
				SkiaApi.sk_paint_delete (Handle);
			}

			base.Dispose (disposing);
		}
		

Usage Example

		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 ();
			}
		}