Split SkiaSharp package into smaller "Native Asset" packages (#1758)

This commit is contained in:
Matthew Leibowitz 2021-08-06 02:09:17 +02:00 коммит произвёл GitHub
Родитель 491aa086c4
Коммит c1e169e0f8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
16 изменённых файлов: 719 добавлений и 279 удалений

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

@ -57,6 +57,15 @@ SkiaSharp.NativeAssets.Linux nuget 2.88.0
SkiaSharp.NativeAssets.Linux.NoDependencies nuget 2.88.0
SkiaSharp.NativeAssets.NanoServer nuget 2.88.0
SkiaSharp.NativeAssets.WebAssembly nuget 2.88.0
SkiaSharp.NativeAssets.Android nuget 2.88.0
SkiaSharp.NativeAssets.iOS nuget 2.88.0
SkiaSharp.NativeAssets.MacCatalyst nuget 2.88.0
SkiaSharp.NativeAssets.macOS nuget 2.88.0
SkiaSharp.NativeAssets.Tizen nuget 2.88.0
SkiaSharp.NativeAssets.tvOS nuget 2.88.0
SkiaSharp.NativeAssets.UWP nuget 2.88.0
SkiaSharp.NativeAssets.watchOS nuget 2.88.0
SkiaSharp.NativeAssets.Win32 nuget 2.88.0
SkiaSharp.Views nuget 2.88.0
SkiaSharp.Views.Desktop.Common nuget 2.88.0
SkiaSharp.Views.Gtk2 nuget 2.88.0

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

@ -66,6 +66,15 @@ var TRACKED_NUGETS = new Dictionary<string, Version> {
{ "SkiaSharp.NativeAssets.Linux.NoDependencies", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.NanoServer", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.WebAssembly", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.Android", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.iOS", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.MacCatalyst", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.macOS", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.Tizen", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.tvOS", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.UWP", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.watchOS", new Version (1, 57, 0) },
{ "SkiaSharp.NativeAssets.Win32", new Version (1, 57, 0) },
{ "SkiaSharp.Views", new Version (1, 57, 0) },
{ "SkiaSharp.Views.Desktop.Common", new Version (1, 57, 0) },
{ "SkiaSharp.Views.Gtk2", new Version (1, 57, 0) },
@ -379,8 +388,8 @@ Task ("samples-generate")
{
EnsureDirectoryExists ("./output/");
// create the workbooks archive
Zip ("./workbooks", "./output/workbooks.zip");
// create the interactive archive
Zip ("./interactive", "./output/interactive.zip");
// create the samples archive
CreateSamplesDirectory ("./samples/", "./output/samples/");

129
interactive/Gradients.dib Normal file
Просмотреть файл

@ -0,0 +1,129 @@
#!markdown
# Gradients
SkiaSharp has may features that allow us to create any image we may want. One such feature is gradients. There are a few gradient types:
- linear
- radial
- sweep
- two-point conical
In this example, are are going to use a linear gradient as a background to a ball created with a two-point conical gradient.
The first thing we need to do is intsall the package:
#!csharp
#i https://aka.ms/skiasharp-eap/index.json
#r nuget:SkiaSharp,*-*
#!markdown
After installing the `SkiaSharp` NuGet package, we can now add the typical `using` statements:
#!csharp
using SkiaSharp;
#!markdown
Now, we can start coding. Here we create a simple 256x256 canvas and clear off any contents:
#!csharp
var info = new SKImageInfo(256, 256);
var surface = SKSurface.Create(info);
var canvas = surface.Canvas;
canvas.Clear();
#!markdown
To make things easier, we are just going to use two colors (black and white) for both the background and the ball:
#!csharp
var lightColor = SKColors.White;
var darkColor = SKColors.Black;
var colors = new[] { lightColor, darkColor };
colors
#!markdown
The first gradient we are going to make is for the background. This is a linear gradient and has 3 main pieces of information:
- start & end points
- colors
- clamp mode
For a linear gradient, the points represent the coordinates of the line that will form the direction of the gradient. Since we want the full image, we can use a line down the side of the canvas. It doesn't really matter where along the x-axis we put the line since it goes on for infinity:
#!csharp
var backgroundShader = SKShader.CreateLinearGradient(
start: new SKPoint(0, 0),
end: new SKPoint(0, info.Height),
colors: colors,
mode: SKShaderTileMode.Clamp);
#!markdown
To draw this shader, we create a new `SKPaint` instance and set the `Shader` property to the shadr we just created. And then we draw it:
#!csharp
var backgroundPaint = new SKPaint
{
IsAntialias = true,
Shader = backgroundShader,
};
canvas.DrawPaint(backgroundPaint);
surface
#!markdown
That is looking very nice!
The next thing we need to do is draw the ball. Like the background, we need to use a shader. This shader now has more information:
- start & end points
- start & end radii
- colors
- clamp mode
The gradient we are going to draw is similar to a radial gradient, but instead we want to control the start and end circles as well as those circles being offset a bit. This will allows us to create an image that looks 3D but is not at all:
#!csharp
var ballShader = SKShader.CreateTwoPointConicalGradient(
start: new SKPoint(115.2f, 102.4f),
startRadius: 20.0f,
end: new SKPoint(102.4f, 102.4f),
endRadius: 128.0f,
colors: new[] { lightColor, darkColor },
mode: SKShaderTileMode.Clamp);
#!markdown
Again like the background, we create a paint object and draw that. However, to give the illusion that it is a 3D ball, we are going to draw the shader inside a circle. This will effectively clip the gradient to a circle shape giving the edges to the ball:
#!csharp
var ballPaint = new SKPaint
{
IsAntialias = true,
Shader = ballShader,
};
canvas.DrawOval(new SKRect(51.2f, 51.2f, 204.8f, 204.8f), ballPaint);
surface
#!markdown
All done. The image is rendered and we have a gray ball floating in space.

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

@ -1,49 +1,45 @@
---
id: 21aa1668-c9a4-480b-ab86-9f7655776547
title: SkiaSharp
uti: com.xamarin.workbook
platforms:
- DotNetCore
packages:
- id: SkiaSharp
version: 1.60.2
---
#!markdown
# SkiaSharp Workbook
# SkiaSharp
Welcome to SkiaSharp, the most awesome, cross-platform 2D-graphics engine. It is powered by the same engine that powers Android and Chrome.
After installing the `SkiaSharp` NuGet package, we must make sure that the references have been added:
The first thing we need to do is intsall the package:
```csharp
#r "SkiaSharp"
```
#!csharp
That being done, we can now add the typical `using` statements:
#i https://aka.ms/skiasharp-eap/index.json
#r nuget:SkiaSharp,2.80.*-*
#!markdown
After installing the `SkiaSharp` NuGet package, we can now add the typical `using` statements:
#!csharp
```csharp
using SkiaSharp;
```
#!markdown
Now, we can start coding. Here we create a simple 256x256 canvas:
```csharp
#!csharp
// create the bitmap that will hold the pixels
var bitmap = new SKBitmap(256, 256);
// create the canvas so that we can draw on thet bitmap
// create the canvas so that we can draw on that bitmap
var canvas = new SKCanvas(bitmap);
// clear the canvas, so that it is fresh
canvas.Clear(SKColors.Transparent);
// appear in Workbooks
bitmap
```
#!markdown
Before we can draw anything, we need to create the object that will be used to describe how the thing we are drawing will look. To do this, we need a `SKPaint` object:
```csharp
#!csharp
var paint = new SKPaint {
IsAntialias = true, // smooth text
TextSize = 50, // 50px high text
@ -52,21 +48,24 @@ var paint = new SKPaint {
Style = SKPaintStyle.Fill, // solid text
Typeface = SKTypeface.FromFamilyName("Trebuchet") // use the Trebuchet typeface
};
```
#!markdown
Now that our canvas is all ready, we can start drawing. Here we are writing the word “SkiaSharp” in the middle:
```csharp
#!csharp
// clear the canvas, just in case we are running this a second time
canvas.Clear(SKColors.Transparent);
// draw the text using the paint
canvas.DrawText("SkiaSharp", 128, 128 + (paint.TextSize / 2), paint);
// appear in Workbooks
// appear in VS Code
bitmap
```
#!markdown
Thats it! So simple! And, best of all, this code can be used ANYWHERE!
Check out the code on GitHub: [https://github.com/mono/SkiaSharp](https://github.com/mono/SkiaSharp "mono/SkiaSharp").
Check out the code on GitHub: [https://github.com/mono/SkiaSharp](https://github.com/mono/SkiaSharp "mono/SkiaSharp").

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

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.NativeAssets.Android</id>
<title>SkiaSharp - Native Assets for Android</title>
<version>1.0.0</version>
<description>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
</description>
<summary>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="monoandroid1.0">
</group>
<group targetFramework="net6.0-android30.0">
</group>
</dependencies>
</metadata>
<files>
<!-- the build bits -->
<file src="build/monoandroid1.0/SkiaSharp.targets" target="build/monoandroid1.0/SkiaSharp.NativeAssets.Android.targets" />
<file src="build/monoandroid1.0/SkiaSharp.targets" target="buildTransitive/monoandroid1.0/SkiaSharp.NativeAssets.Android.targets" />
<file src="build/net6.0-android/SkiaSharp.targets" target="build/net6.0-android30.0/SkiaSharp.NativeAssets.Android.targets" />
<file src="build/net6.0-android/SkiaSharp.targets" target="buildTransitive/net6.0-android30.0/SkiaSharp.NativeAssets.Android.targets" />
<!-- libSkiaSharp.dll and other native files -->
<file platform="macos,windows" src="runtimes/android-x64/native/libSkiaSharp.so" />
<file platform="macos,windows" src="runtimes/android-x86/native/libSkiaSharp.so" />
<file platform="macos,windows" src="runtimes/android-arm/native/libSkiaSharp.so" />
<file platform="macos,windows" src="runtimes/android-arm64/native/libSkiaSharp.so" />
<!-- placeholders -->
<file src="_._" target="lib/monoandroid1.0/_._" />
<file src="_._" target="lib/net6.0-android30.0/_._" />
<!-- legal -->
<file src="LICENSE.txt" />
<file src="THIRD-PARTY-NOTICES.txt" />
</files>
</package>

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

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.NativeAssets.MacCatalyst</id>
<title>SkiaSharp - Native Assets for Mac Catalyst</title>
<version>1.0.0</version>
<description>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
</description>
<summary>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="net6.0-maccatalyst13.5">
</group>
</dependencies>
</metadata>
<files>
<!-- the build bits -->
<!-- <file src="build/net6.0-macos/SkiaSharp.targets" target="build/net6.0-macos10.15/SkiaSharp.NativeAssets.macOS.targets" /> -->
<!-- <file src="build/net6.0-macos/SkiaSharp.targets" target="buildTransitive/net6.0-macos10.15/SkiaSharp.NativeAssets.macOS.targets" /> -->
<!-- libSkiaSharp.dll and other native files -->
<!-- <file platform="macos" src="runtimes/maccatalyst/native/libSkiaSharp.framework/**/*" target="runtimes/maccatalyst/native/libSkiaSharp.framework" /> -->
<!-- placeholders -->
<file src="_._" target="lib/net6.0-maccatalyst13.5/_._" />
<!-- legal -->
<file src="LICENSE.txt" />
<file src="THIRD-PARTY-NOTICES.txt" />
</files>
</package>

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

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.NativeAssets.Tizen</id>
<title>SkiaSharp - Native Assets for Tizen</title>
<version>1.0.0</version>
<description>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
</description>
<summary>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="tizen40">
</group>
</dependencies>
</metadata>
<files>
<!-- the build bits -->
<file src="build/tizen40/SkiaSharp.targets" target="build/tizen40/SkiaSharp.NativeAssets.Tizen.targets" />
<file src="build/tizen40/SkiaSharp.targets" target="buildTransitive/tizen40/SkiaSharp.NativeAssets.Tizen.targets" />
<!-- libSkiaSharp.dll and other native files -->
<file src="build/tizen40/arm/libSkiaSharp.so" />
<file src="build/tizen40/x86/libSkiaSharp.so" />
<!-- placeholders -->
<file src="_._" target="lib/tizen40/_._" />
<!-- legal -->
<file src="LICENSE.txt" />
<file src="THIRD-PARTY-NOTICES.txt" />
</files>
</package>

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

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.NativeAssets.UWP</id>
<title>SkiaSharp - Native Assets for UWP</title>
<version>1.0.0</version>
<description>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
</description>
<summary>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="uap10.0.10240">
</group>
</dependencies>
</metadata>
<files>
<!-- the build bits -->
<!-- libSkiaSharp.dll and other native files -->
<file platform="windows" src="runtimes/win10-x64/nativeassets/uap10.0/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win10-x86/nativeassets/uap10.0/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win10-arm/nativeassets/uap10.0/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win10-arm64/nativeassets/uap10.0/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win10-x64/nativeassets/uap10.0/libGLESv2.dll" />
<file platform="windows" src="runtimes/win10-x86/nativeassets/uap10.0/libGLESv2.dll" />
<file platform="windows" src="runtimes/win10-arm/nativeassets/uap10.0/libGLESv2.dll" />
<file platform="windows" src="runtimes/win10-arm64/nativeassets/uap10.0/libGLESv2.dll" />
<file platform="windows" src="runtimes/win10-x64/nativeassets/uap10.0/libEGL.dll" />
<file platform="windows" src="runtimes/win10-x86/nativeassets/uap10.0/libEGL.dll" />
<file platform="windows" src="runtimes/win10-arm/nativeassets/uap10.0/libEGL.dll" />
<file platform="windows" src="runtimes/win10-arm64/nativeassets/uap10.0/libEGL.dll" />
<!-- placeholders -->
<file src="_._" target="lib/uap10.0.10240/_._" />
<!-- legal -->
<file src="LICENSE.txt" />
<file src="THIRD-PARTY-NOTICES.txt" />
</files>
</package>

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

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.NativeAssets.Win32</id>
<title>SkiaSharp - Native Assets for Win32</title>
<version>1.0.0</version>
<description>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
</description>
<summary>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="net462">
</group>
<group targetFramework="netstandard1.3">
</group>
</dependencies>
</metadata>
<files>
<!-- the build bits -->
<file src="build/net462/SkiaSharp.targets" target="build/net462/SkiaSharp.NativeAssets.Win32.targets" />
<file src="build/net462/SkiaSharp.targets" target="buildTransitive/net462/SkiaSharp.NativeAssets.Win32.targets" />
<!-- libSkiaSharp.dll and other native files -->
<file platform="windows" src="runtimes/win-x64/native/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win-x86/native/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win-arm64/native/libSkiaSharp.dll" />
<!-- placeholders -->
<file src="_._" target="lib/net462/_._" />
<file src="_._" target="lib/netstandard1.3/_._" />
<!-- legal -->
<file src="LICENSE.txt" />
<file src="THIRD-PARTY-NOTICES.txt" />
</files>
</package>

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

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.NativeAssets.iOS</id>
<title>SkiaSharp - Native Assets for iOS</title>
<version>1.0.0</version>
<description>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
</description>
<summary>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="xamarinios1.0">
</group>
<group targetFramework="net6.0-ios13.6">
</group>
</dependencies>
</metadata>
<files>
<!-- the build bits -->
<file src="build/xamarinios1.0/SkiaSharp.targets" target="build/xamarinios1.0/SkiaSharp.NativeAssets.iOS.targets" />
<file src="build/xamarinios1.0/SkiaSharp.targets" target="buildTransitive/xamarinios1.0/SkiaSharp.NativeAssets.iOS.targets" />
<file src="build/net6.0-ios/SkiaSharp.targets" target="build/net6.0-ios13.6/SkiaSharp.NativeAssets.iOS.targets" />
<file src="build/net6.0-ios/SkiaSharp.targets" target="buildTransitive/net6.0-ios13.6/SkiaSharp.NativeAssets.iOS.targets" />
<!-- libSkiaSharp.dll and other native files -->
<file platform="macos" src="runtimes/ios/native/libSkiaSharp.framework/**/*" target="runtimes/ios/native/libSkiaSharp.framework" />
<!-- placeholders -->
<file src="_._" target="lib/xamarinios1.0/_._" />
<file src="_._" target="lib/net6.0-ios13.6/_._" />
<!-- legal -->
<file src="LICENSE.txt" />
<file src="THIRD-PARTY-NOTICES.txt" />
</files>
</package>

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

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.NativeAssets.macOS</id>
<title>SkiaSharp - Native Assets for macOS</title>
<version>1.0.0</version>
<description>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
</description>
<summary>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="xamarinmac2.0">
</group>
<group targetFramework="net6.0-macos10.15">
</group>
<group targetFramework="net462">
</group>
<group targetFramework="netstandard1.3">
</group>
</dependencies>
</metadata>
<files>
<!-- the build bits -->
<file src="build/xamarinmac2.0/SkiaSharp.targets" target="build/xamarinmac2.0/SkiaSharp.NativeAssets.macOS.targets" />
<file src="build/xamarinmac2.0/SkiaSharp.targets" target="buildTransitive/xamarinmac2.0/SkiaSharp.NativeAssets.macOS.targets" />
<file src="build/net6.0-macos/SkiaSharp.targets" target="build/net6.0-macos10.15/SkiaSharp.NativeAssets.macOS.targets" />
<file src="build/net6.0-macos/SkiaSharp.targets" target="buildTransitive/net6.0-macos10.15/SkiaSharp.NativeAssets.macOS.targets" />
<file src="build/net462/SkiaSharp.targets" target="build/net462/SkiaSharp.NativeAssets.macOS.targets" />
<file src="build/net462/SkiaSharp.targets" target="buildTransitive/net462/SkiaSharp.NativeAssets.macOS.targets" />
<!-- libSkiaSharp.dll and other native files -->
<file platform="macos" src="runtimes/osx/native/libSkiaSharp.dylib" />
<!-- placeholders -->
<file src="_._" target="lib/xamarinmac2.0/_._" />
<file src="_._" target="lib/net6.0-macos10.15/_._" />
<file src="_._" target="lib/net462/_._" />
<file src="_._" target="lib/netstandard1.3/_._" />
<!-- legal -->
<file src="LICENSE.txt" />
<file src="THIRD-PARTY-NOTICES.txt" />
</files>
</package>

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

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.NativeAssets.tvOS</id>
<title>SkiaSharp - Native Assets for tvOS</title>
<version>1.0.0</version>
<description>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
</description>
<summary>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="xamarintvos1.0">
</group>
<group targetFramework="net6.0-tvos13.4">
</group>
</dependencies>
</metadata>
<files>
<!-- the build bits -->
<file src="build/xamarintvos1.0/SkiaSharp.targets" target="build/xamarintvos1.0/SkiaSharp.NativeAssets.tvOS.targets" />
<file src="build/xamarintvos1.0/SkiaSharp.targets" target="buildTransitive/xamarintvos1.0/SkiaSharp.NativeAssets.tvOS.targets" />
<file src="build/net6.0-tvos/SkiaSharp.targets" target="build/net6.0-tvos13.4/SkiaSharp.NativeAssets.tvOS.targets" />
<file src="build/net6.0-tvos/SkiaSharp.targets" target="buildTransitive/net6.0-tvos13.4/SkiaSharp.NativeAssets.tvOS.targets" />
<!-- libSkiaSharp.dll and other native files -->
<file platform="macos" src="runtimes/tvos/native/libSkiaSharp.framework/**/*" target="runtimes/tvos/native/libSkiaSharp.framework" />
<!-- placeholders -->
<file src="_._" target="lib/xamarintvos1.0/_._" />
<file src="_._" target="lib/net6.0-tvos13.4/_._" />
<!-- legal -->
<file src="LICENSE.txt" />
<file src="THIRD-PARTY-NOTICES.txt" />
</files>
</package>

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

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<!-- package -->
<id>SkiaSharp.NativeAssets.watchOS</id>
<title>SkiaSharp - Native Assets for watchOS</title>
<version>1.0.0</version>
<description>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms based on Google's Skia Graphics Library.
It provides a comprehensive 2D API that can be used across mobile, server and desktop models to render images.
</description>
<summary>
SkiaSharp is a cross-platform 2D graphics API for .NET platforms that can be used across mobile, server and desktop models to render images.
</summary>
<releaseNotes>
Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release notes.
</releaseNotes>
<projectUrl>https://go.microsoft.com/fwlink/?linkid=868515</projectUrl>
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2130524</iconUrl>
<tags>xamarin graphics ios android linux windows uwp tvos watchos macos tizen cross-platform skiasharp</tags>
<!-- legal -->
<licenseUrl>https://go.microsoft.com/fwlink/?linkid=868514</licenseUrl>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
<dependencies>
<group targetFramework="xamarinwatchos1.0">
</group>
</dependencies>
</metadata>
<files>
<!-- the build bits -->
<file src="build/xamarinwatchos1.0/SkiaSharp.targets" target="build/xamarinwatchos1.0/SkiaSharp.NativeAssets.watchOS.targets" />
<file src="build/xamarinwatchos1.0/SkiaSharp.targets" target="buildTransitive/xamarinwatchos1.0/SkiaSharp.NativeAssets.watchOS.targets" />
<!-- libSkiaSharp.dll and other native files -->
<file platform="macos" src="runtimes/watchos/native/libSkiaSharp.framework/**/*" target="runtimes/watchos/native/libSkiaSharp.framework" />
<!-- placeholders -->
<file src="_._" target="lib/xamarinwatchos1.0/_._" />
<!-- legal -->
<file src="LICENSE.txt" />
<file src="THIRD-PARTY-NOTICES.txt" />
</files>
</package>

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

@ -29,43 +29,62 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<dependencies>
<group targetFramework="net462">
<dependency id="SkiaSharp.NativeAssets.Win32" version="1.0.0" />
<dependency id="SkiaSharp.NativeAssets.macOS" version="1.0.0" />
<dependency id="System.Memory" version="1.0.0" />
</group>
<group targetFramework="netstandard1.3">
<dependency id="SkiaSharp.NativeAssets.Win32" version="1.0.0" />
<dependency id="SkiaSharp.NativeAssets.macOS" version="1.0.0" />
<dependency id="System.IO.UnmanagedMemoryStream" version="1.0.0" />
<dependency id="System.Memory" version="1.0.0" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="SkiaSharp.NativeAssets.Win32" version="1.0.0" />
<dependency id="SkiaSharp.NativeAssets.macOS" version="1.0.0" />
<dependency id="System.Memory" version="1.0.0" />
</group>
<group targetFramework="monoandroid1.0">
<dependency id="SkiaSharp.NativeAssets.Android" version="1.0.0" />
</group>
<group targetFramework="xamarinios1.0">
<dependency id="SkiaSharp.NativeAssets.iOS" version="1.0.0" />
</group>
<group targetFramework="xamarintvos1.0">
<dependency id="SkiaSharp.NativeAssets.tvOS" version="1.0.0" />
</group>
<group targetFramework="xamarinwatchos1.0">
<dependency id="SkiaSharp.NativeAssets.watchOS" version="1.0.0" />
</group>
<group targetFramework="xamarinmac2.0">
<dependency id="SkiaSharp.NativeAssets.macOS" version="1.0.0" />
</group>
<group targetFramework="uap10.0.10240">
<dependency id="SkiaSharp.NativeAssets.UWP" version="1.0.0" />
<dependency id="System.Memory" version="1.0.0" />
</group>
<group targetFramework="uap10.0.16299">
<dependency id="SkiaSharp.NativeAssets.UWP" version="1.0.0" />
<dependency id="System.Memory" version="1.0.0" />
</group>
<group targetFramework="tizen40">
<dependency id="SkiaSharp.NativeAssets.Tizen" version="1.0.0" />
<dependency id="System.Memory" version="1.0.0" />
</group>
<group targetFramework="net6.0-ios13.6">
<dependency id="SkiaSharp.NativeAssets.iOS" version="1.0.0" />
</group>
<group targetFramework="net6.0-maccatalyst13.5">
<dependency id="SkiaSharp.NativeAssets.MacCatalyst" version="1.0.0" />
</group>
<group targetFramework="net6.0-tvos13.4">
<dependency id="SkiaSharp.NativeAssets.tvOS" version="1.0.0" />
</group>
<group targetFramework="net6.0-macos10.15">
<dependency id="SkiaSharp.NativeAssets.macOS" version="1.0.0" />
</group>
<group targetFramework="net6.0-android30.0">
<dependency id="SkiaSharp.NativeAssets.Android" version="1.0.0" />
</group>
</dependencies>
@ -106,69 +125,6 @@ Please visit https://go.microsoft.com/fwlink/?linkid=868517 to view the release
<file platform="macos" src="lib/net6.0-macos/SkiaSharp.dll" target="lib/net6.0-macos10.15/SkiaSharp.dll" />
<file platform="macos" src="lib/net6.0-macos/SkiaSharp.xml" target="lib/net6.0-macos10.15/SkiaSharp.xml" />
<!-- the build bits -->
<!-- net4x (win32/macos/linux) -->
<file src="build/net462/SkiaSharp.targets" />
<file src="build/net462/SkiaSharp.targets" target="buildTransitive/net462/SkiaSharp.targets" />
<!-- others -->
<file src="build/monoandroid1.0/SkiaSharp.targets" />
<file src="build/monoandroid1.0/SkiaSharp.targets" target="buildTransitive/monoandroid1.0/SkiaSharp.targets" />
<file src="build/net6.0-android/SkiaSharp.targets" target="build/net6.0-android30.0/SkiaSharp.targets" />
<file src="build/net6.0-android/SkiaSharp.targets" target="buildTransitive/net6.0-android30.0/SkiaSharp.targets" />
<file src="build/xamarinios1.0/SkiaSharp.targets" />
<file src="build/xamarinios1.0/SkiaSharp.targets" target="buildTransitive/xamarinios1.0/SkiaSharp.targets" />
<file src="build/net6.0-ios/SkiaSharp.targets" target="build/net6.0-ios13.6/SkiaSharp.targets" />
<file src="build/net6.0-ios/SkiaSharp.targets" target="buildTransitive/net6.0-ios13.6/SkiaSharp.targets" />
<file src="build/xamarintvos1.0/SkiaSharp.targets" />
<file src="build/xamarintvos1.0/SkiaSharp.targets" target="buildTransitive/xamarintvos1.0/SkiaSharp.targets" />
<file src="build/net6.0-tvos/SkiaSharp.targets" target="build/net6.0-tvos13.4/SkiaSharp.targets" />
<file src="build/net6.0-tvos/SkiaSharp.targets" target="buildTransitive/net6.0-tvos13.4/SkiaSharp.targets" />
<file src="build/xamarinwatchos1.0/SkiaSharp.targets" />
<file src="build/xamarinwatchos1.0/SkiaSharp.targets" target="buildTransitive/xamarinwatchos1.0/SkiaSharp.targets" />
<file src="build/xamarinmac2.0/SkiaSharp.targets" />
<file src="build/xamarinmac2.0/SkiaSharp.targets" target="buildTransitive/xamarinmac2.0/SkiaSharp.targets" />
<file src="build/net6.0-macos/SkiaSharp.targets" target="build/net6.0-macos10.15/SkiaSharp.targets" />
<file src="build/net6.0-macos/SkiaSharp.targets" target="buildTransitive/net6.0-macos10.15/SkiaSharp.targets" />
<file src="build/tizen40/SkiaSharp.targets" />
<file src="build/tizen40/SkiaSharp.targets" target="buildTransitive/tizen40/SkiaSharp.targets" />
<!-- libSkiaSharp.dll and other native files -->
<!-- win -->
<file platform="windows" src="runtimes/win-x64/native/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win-x86/native/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win-arm64/native/libSkiaSharp.dll" />
<!-- macos -->
<file platform="macos" src="runtimes/osx/native/libSkiaSharp.dylib" />
<!-- win10 -->
<file platform="windows" src="runtimes/win10-x64/nativeassets/uap10.0/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win10-x86/nativeassets/uap10.0/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win10-arm/nativeassets/uap10.0/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win10-arm64/nativeassets/uap10.0/libSkiaSharp.dll" />
<file platform="windows" src="runtimes/win10-x64/nativeassets/uap10.0/libGLESv2.dll" />
<file platform="windows" src="runtimes/win10-x86/nativeassets/uap10.0/libGLESv2.dll" />
<file platform="windows" src="runtimes/win10-arm/nativeassets/uap10.0/libGLESv2.dll" />
<file platform="windows" src="runtimes/win10-arm64/nativeassets/uap10.0/libGLESv2.dll" />
<file platform="windows" src="runtimes/win10-x64/nativeassets/uap10.0/libEGL.dll" />
<file platform="windows" src="runtimes/win10-x86/nativeassets/uap10.0/libEGL.dll" />
<file platform="windows" src="runtimes/win10-arm/nativeassets/uap10.0/libEGL.dll" />
<file platform="windows" src="runtimes/win10-arm64/nativeassets/uap10.0/libEGL.dll" />
<!-- tizen -->
<file src="build/tizen40/arm/libSkiaSharp.so" />
<file src="build/tizen40/x86/libSkiaSharp.so" />
<!-- android -->
<file platform="macos,windows" src="runtimes/android-x64/native/libSkiaSharp.so" />
<file platform="macos,windows" src="runtimes/android-x86/native/libSkiaSharp.so" />
<file platform="macos,windows" src="runtimes/android-arm/native/libSkiaSharp.so" />
<file platform="macos,windows" src="runtimes/android-arm64/native/libSkiaSharp.so" />
<!-- ios -->
<file platform="macos" src="runtimes/ios/native/libSkiaSharp.framework/**/*" target="runtimes/ios/native/libSkiaSharp.framework" />
<!-- maccatalyst -->
<!-- <file platform="macos" src="runtimes/maccatalyst/native/libSkiaSharp.framework/**/*" target="runtimes/maccatalyst/native/libSkiaSharp.framework" /> -->
<!-- tvos -->
<file platform="macos" src="runtimes/tvos/native/libSkiaSharp.framework/**/*" target="runtimes/tvos/native/libSkiaSharp.framework" />
<!-- watchos -->
<file platform="macos" src="runtimes/watchos/native/libSkiaSharp.framework/**/*" target="runtimes/watchos/native/libSkiaSharp.framework" />
<!-- .NET interactive -->
<file src="interactive-extensions/dotnet/SkiaSharp.DotNet.Interactive.dll" />

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

@ -1,96 +0,0 @@
---
uti: com.xamarin.workbook
id: 66b3be4b-ee9f-45f2-875c-670508c1c26e
title: SkiaSharp on WPF
platforms:
- WPF
packages:
- id: SkiaSharp
version: 1.60.2
- id: SkiaSharp.Views
version: 1.60.2
---
# SkiaSharp on WPF Workbook
Welcome to SkiaSharp, the most awesome, cross-platform 2D-graphics engine. It is powered by the same engine that powers Android and Chrome.
After installing the `SkiaSharp` NuGet package, we must make sure that the references have been added:
```csharp
#r "SkiaSharp"
```
Because we going to do some UI work, we also need to add the `SkiaSharp.Views` package. This package contains all the bits needed for all supported platforms. After installing the package, we add the references:
```csharp
#r "SkiaSharp.Views.Desktop"
#r "SkiaSharp.Views.WPF"
```
Now SkiaSharp is installed, so we can add all our using statements:
```csharp
// SkiaSharp usings
using SkiaSharp;
using SkiaSharp.Views.Desktop;
using SkiaSharp.Views.WPF;
// WPF usings
using System.Windows;
```
We are finally ready to start coding. The first thing we need to do is to add the SkiaSharp UI element to the window. To do this, we need to get this main window:
```csharp
var mainWindow = new Window {
Width = 512,
Height = 512,
Title = "SkiaSharp on WPF"
};
mainWindow.Show();
```
Next, we need to create the SkiaSharp element and add it to the window:
```csharp
// create the element
var skiaCanvasElement = new SKElement();
// add it to the window
mainWindow.Content = skiaCanvasElement;
```
Now that we have our windows and the SkiaSharp element, we can start writing drawing code. The first thing we need to do is handle the `PaintSurface` event:
```csharp
skiaCanvasElement.PaintSurface += OnPaintSurface;
void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
var canvas = e.Surface.Canvas;
var size = e.Info.Size;
canvas.Clear(SKColors.Transparent);
var paint = new SKPaint {
IsAntialias = true,
TextSize = 50,
TextAlign = SKTextAlign.Center,
Color = 0xFF3498DB,
Style = SKPaintStyle.Fill,
Typeface = SKTypeface.FromFamilyName("Trebuchet")
};
canvas.DrawText(
"SkiaSharp",
size.Width / 2,
(size.Height + paint.TextSize) / 2,
paint);
}
// trigger a refresh
skiaCanvasElement.InvalidateVisual();
```
And that is it for today!

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

@ -1,89 +0,0 @@
---
uti: com.xamarin.workbook
id: 3f9c2e8c-577a-47e1-bd7f-8ec872ff5c29
title: SkiaSharp on iOS
platforms:
- iOS
packages:
- id: SkiaSharp
version: 1.60.2
- id: SkiaSharp.Views
version: 1.60.2
---
# SkiaSharp on iOS Workbook
Welcome to SkiaSharp, the most awesome, cross-platform 2D-graphics engine. It is powered by the same engine that powers Android and Chrome.
After installing the `SkiaSharp` NuGet package, we must make sure that the references have been added:
```csharp
#r "SkiaSharp"
```
Because we going to do some UI work, we also need to add the `SkiaSharp.Views` package. This package contains all the bits needed for all supported platforms. After installing the package, we add the references:
```csharp
#r "SkiaSharp.Views.iOS"
```
Now SkiaSharp is installed, so we can add all our using statements:
```csharp
// SkiaSharp usings
using SkiaSharp;
using SkiaSharp.Views.iOS;
// iOS usings
using UIKit;
```
We are finally ready to start coding. The first thing we need to do is to add the SkiaSharp UI view to the view controller. To do this, we need to get this controller:
```csharp
var controller = RootViewController;
```
Next, we need to create the SkiaSharp view and add it to the controller:
```csharp
// create the view
var skiaCanvasView = new SKCanvasView(controller.View.Bounds);
// add it to the window
controller.View.AddSubview(skiaCanvasView);
```
Now that we have our windows and the SkiaSharp view, we can start writing drawing code. The first thing we need to do is handle the `PaintSurface` event:
```csharp
skiaCanvasView.PaintSurface += OnPaintSurface;
void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
var canvas = e.Surface.Canvas;
var size = e.Info.Size;
canvas.Clear(SKColors.White);
var paint = new SKPaint {
IsAntialias = true,
TextSize = 50,
TextAlign = SKTextAlign.Center,
Color = 0xFF3498DB,
Style = SKPaintStyle.Fill,
Typeface = SKTypeface.FromFamilyName("Trebuchet")
};
canvas.DrawText(
"SkiaSharp",
size.Width / 2,
(size.Height + paint.TextSize) / 2,
paint);
}
// trigger a refresh
skiaCanvasView.SetNeedsDisplay();
```
And that is it for today!