skiasharp graphics for xamarin.forms

Post on 21-Jan-2018

648 Views

Category:

Software

5 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Senior Content Developer

charlespetzold.com

Our work and personal data is in the cloud

We have multiple devices and use whichever is best for each task

We use devices in all aspects of our lives

We expect our data to be available on every device we use

iOS

Visual Studio

for Windows or Mac.NET Library.NET Languages

iOS

C# UI

Shared C# business logic

Android

C# UI

Windows

C# UI Shared C# UI

Shared C# business logic

Xamarin.Android and Xamarin.iOS

Separate UIs per platform

Xamarin.Forms

Shared UI definition

Getting started with SkiaSharp for Xamarin.Forms [DEMO]

Graphics programming techniques [DEMO]

Final touches [DEMO]

Resources

Q&A

Have questions?

Getting started with SkiaSharp

Skia Graphics Engine acquired by Google in 2005

Open source

C++

Used in Google Chrome, Mozilla Firefox, and Android

Immediate-mode 2D vector graphics system

Xamarin’s implementation of Skia

C# and .NET API

Bindings for Windows Forms, WPF, UWP, iOS, tvOS,

Mac, Android, and Xamarin.Forms

github.com/mono/SkiaSharp

NuGet: search “SkiaSharp”

SKCanvasView and SKGLViewDerive from Xamarin.Forms View class

PaintSurface eventInfo property: Size of surface area

Surface property: SKSurface SKCanvas

InvalidateSurface method

Can draw to bitmap or SVG file

DemoGetting started with SkiaSharp for Xamarin.Forms

Graphics programming

Drawing MethodsDrawCircle, DrawRect, DrawLine, DrawText, DrawBitmap

DrawPath (the only one you really need)

TransformsTranslate

Scale

RotateDegrees and RotateRadians

Clipping

Style: Stroke, Fill, or both

Color: SKColor value

StrokeWidth

StrokeCap: Butt, Square, or Round

StrokeJoin: Miter, Bevel, or Round

Shader: gradients or bitmap tiling

DemoBack to Visual Studio…

Multiple contours, opened or closed

MoveTo and LineTo

ArcTo: Three kinds of arc definitions

CubicTo and QuadTo: Bézier curves

ConicTo

SVG path data in and out

DemoBack to Visual Studio…

Final touches

CreateLinearGradient

CreateRadialGradient

CreateSweepGradient

CreateTwoPointConicalGradient

CreatePerlinNoise…

CreateBitmap: Tile with SKBitmap

CreateDash

Create1DPath: Dashed with other path

Create2DPath: Stroked with array of other path

CreateDiscrete: Jitter effect

DemoVisual Studio: the final return

aka.ms/buy-xamarin-university

Start your free Xamarin University trial.

Learn to build better mobile apps.

Starting at $83.25/month

Use existing Azure subscription

Flexible billing options

Documentationdeveloper.xamarin.com/api/root/SkiaSharp

developer.xamarin.com/guides/xamarin-forms/advanced/skiasharp

Demo Codeaka.ms/cat-clock-demo

aka.ms/skia-sharp-samples

Xamarin University Presents Webinar Seriesaka.ms/xam-u-webinars

aka.ms/xam-u-webinar-recordings

Thank You

Q&A

© Copyright Microsoft Corporation. All rights reserved.

top related