Changed SKGLView and Gradient test

* Fixed to call SKObject.Dispose
This commit is contained in:
aosoft 2018-01-06 22:42:22 +09:00
Родитель f129f3f62f
Коммит fdce8d7333
3 изменённых файлов: 18 добавлений и 7 удалений

Просмотреть файл

@ -19,7 +19,7 @@
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<skia:SKCanvasView
<skia:SKGLView
Grid.Column="0" Grid.Row="0"
Grid.ColumnSpan="2"
Grid.RowSpan="2"
@ -70,11 +70,11 @@
Increment="1"
Maximum="100"
Value="45"/>
<WebView
<!--<WebView
Grid.Column="1"
Grid.ColumnSpan="2"
Grid.Row="4"
Source="www.google.com"/>
Source="www.google.com"/>-->
<Label
Grid.Column="0" Grid.Row="5"
Text="{Binding Source={x:Reference entry}, Path=Text}"

Просмотреть файл

@ -22,11 +22,20 @@ namespace Xamarin.Forms.ControlGallery.WinForms
System.Windows.Forms.MessageBox.Show("Clicked!");
}
private void SKCanvasView_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs e)
private void SKCanvasView_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintGLSurfaceEventArgs e)
{
var p = new SKPaint();
p.Color = SKColors.Aqua;
e.Surface.Canvas.DrawCircle(100, 100, 20, p);
e.Surface.Canvas.Clear(SKColors.White);
using (var p = new SKPaint())
using (var shader = SKShader.CreateLinearGradient(
new SKPoint(0.0f, 0.0f),
new SKPoint(100.0f, 100.0f),
new [] { SKColors.Red, SKColors.Green },
null,
SKShaderTileMode.Clamp))
{
p.Shader = shader;
e.Surface.Canvas.DrawRect(new SKRect(0.0f, 0.0f, 100.0f, 100.0f), p);
}
}
}
}

Просмотреть файл

@ -14,6 +14,8 @@ namespace Xamarin.Forms.ControlGallery.WinForms
[STAThread]
static void Main()
{
OpenTK.Toolkit.Init();
System.Windows.Forms.Application.EnableVisualStyles();
System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);