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 SKGLView
Derive from Xamarin.Forms View class
PaintSurface event
Info property: Size of surface area
Surface property: SKSurface  SKCanvas
InvalidateSurface method
Can draw to bitmap or SVG file
Demo
Getting started with SkiaSharp for
Xamarin.Forms
Graphics programming
Drawing Methods
DrawCircle, DrawRect, DrawLine, DrawText, DrawBitmap
DrawPath (the only one you really need)
Transforms
Translate
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
Demo
Back 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
Demo
Back 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
Demo
Visual 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
Documentation
developer.xamarin.com/api/root/SkiaSharp
developer.xamarin.com/guides/xamarin-forms/advanced/skiasharp
Demo Code
aka.ms/cat-clock-demo
aka.ms/skia-sharp-samples
Xamarin University Presents Webinar Series
aka.ms/xam-u-webinars
aka.ms/xam-u-webinar-recordings
Thank You
Q&A
© Copyright Microsoft Corporation. All rights reserved.

SkiaSharp Graphics for Xamarin.Forms