Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions binding/SkiaSharp/SkiaSharp.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>netstandard1.3;netstandard2.0;net462;net5.0</TargetFrameworks>
<RootNamespace>SkiaSharp</RootNamespace>
<AssemblyName>SkiaSharp</AssemblyName>
<PackagingGroup>SkiaSharp</PackagingGroup>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
<PropertyGroup Condition="$(TargetFramework.StartsWith('netstandard')) or $(TargetFramework.StartsWith('net5'))">
<DefineConstants>$(DefineConstants);NET_STANDARD</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">

<Identity
Name="3f408aeb-c308-4de0-a604-30ef645cb167"
Publisher="CN=mattl"
Version="1.0.0.0" />

<Properties>
<DisplayName>SkiaSharpSample.Package</DisplayName>
<PublisherDisplayName>mattl</PublisherDisplayName>
<Logo>Images\StoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate"/>
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="SkiaSharpSample.Package"
Description="SkiaSharpSample.Package"
BackgroundColor="transparent"
Square150x150Logo="Images\Square150x150Logo.png"
Square44x44Logo="Images\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Images\Wide310x150Logo.png" />
<uap:SplashScreen Image="Images\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '15.0'">
<VisualStudioVersion>15.0</VisualStudioVersion>
</PropertyGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x86">
<Configuration>Debug</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x86">
<Configuration>Release</Configuration>
<Platform>x86</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup>
<WapProjPath Condition="'$(WapProjPath)'==''">$(MSBuildExtensionsPath)\Microsoft\DesktopBridge\</WapProjPath>
<PathToXAMLWinRTImplementations>SkiaSharpSample\</PathToXAMLWinRTImplementations>
</PropertyGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.props" />
<PropertyGroup>
<ProjectGuid>33491cd0-dca7-43bd-a143-eee6bd38d5d6</ProjectGuid>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<DefaultLanguage>en-US</DefaultLanguage>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<AppxTargetsLocation Condition="'$(AppxTargetsLocation)'==''">$(MSBuildThisFileDirectory)build\</AppxTargetsLocation>
<EntryPointProjectUniqueName>..\SkiaSharpSample\SkiaSharpSample.csproj</EntryPointProjectUniqueName>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
</ItemGroup>
<ItemGroup>
<Content Include="Images\SplashScreen.scale-200.png" />
<Content Include="Images\LockScreenLogo.scale-200.png" />
<Content Include="Images\Square150x150Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.scale-200.png" />
<Content Include="Images\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Images\StoreLogo.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SkiaSharpSample\SkiaSharpSample.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<SDKReference Include="Microsoft.VCLibs.Desktop, Version=14.0" />
<!-- Needed for ucrtbased.dll when running a debug build. -->
<SDKReference Include="Microsoft.VCLibs, Version=14.0" Condition="'$(Configuration)' == 'Debug'" />
</ItemGroup>
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />
<Import Project="$(AppxTargetsLocation)Microsoft.WinUI.AppX.targets" />
</Project>
85 changes: 85 additions & 0 deletions samples/Basic/WinUI/Desktop/SkiaSharpSample.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30407.236
MinimumVisualStudioVersion = 10.0.40219.1
Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "SkiaSharpSample.Package", "SkiaSharpSample.Package\SkiaSharpSample.Package.wapproj", "{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharpSample", "SkiaSharpSample\SkiaSharpSample.csproj", "{88FA82C6-187C-4C00-833B-9812FDF3774A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp", "..\..\..\..\binding\SkiaSharp\SkiaSharp.csproj", "{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.WinUI", "..\..\..\..\source\SkiaSharp.Views.WinUI\SkiaSharp.Views.WinUI\SkiaSharp.Views.WinUI.csproj", "{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Debug|Any CPU.ActiveCfg = Debug|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Debug|Any CPU.Build.0 = Debug|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Debug|Any CPU.Deploy.0 = Debug|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Debug|x64.ActiveCfg = Debug|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Debug|x64.Build.0 = Debug|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Debug|x64.Deploy.0 = Debug|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Debug|x86.ActiveCfg = Debug|x86
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Debug|x86.Build.0 = Debug|x86
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Debug|x86.Deploy.0 = Debug|x86
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Release|Any CPU.ActiveCfg = Release|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Release|Any CPU.Build.0 = Release|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Release|Any CPU.Deploy.0 = Release|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Release|x64.ActiveCfg = Release|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Release|x64.Build.0 = Release|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Release|x64.Deploy.0 = Release|x64
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Release|x86.ActiveCfg = Release|x86
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Release|x86.Build.0 = Release|x86
{33491CD0-DCA7-43BD-A143-EEE6BD38D5D6}.Release|x86.Deploy.0 = Release|x86
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Debug|x64.ActiveCfg = Debug|x64
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Debug|x64.Build.0 = Debug|x64
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Debug|x86.ActiveCfg = Debug|x86
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Debug|x86.Build.0 = Debug|x86
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Release|Any CPU.Build.0 = Release|Any CPU
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Release|x64.ActiveCfg = Release|x64
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Release|x64.Build.0 = Release|x64
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Release|x86.ActiveCfg = Release|x86
{88FA82C6-187C-4C00-833B-9812FDF3774A}.Release|x86.Build.0 = Release|x86
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Debug|x64.ActiveCfg = Debug|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Debug|x64.Build.0 = Debug|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Debug|x86.ActiveCfg = Debug|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Debug|x86.Build.0 = Debug|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Release|Any CPU.Build.0 = Release|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Release|x64.ActiveCfg = Release|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Release|x64.Build.0 = Release|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Release|x86.ActiveCfg = Release|Any CPU
{8320763C-3EA5-4A99-8B10-C91EAC28F7E3}.Release|x86.Build.0 = Release|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Debug|x64.ActiveCfg = Debug|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Debug|x64.Build.0 = Debug|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Debug|x86.ActiveCfg = Debug|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Debug|x86.Build.0 = Debug|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Release|Any CPU.Build.0 = Release|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Release|x64.ActiveCfg = Release|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Release|x64.Build.0 = Release|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Release|x86.ActiveCfg = Release|Any CPU
{822DA86C-97BF-470E-87AF-2C9B9B30DBA9}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9024EEAE-E061-42FA-90FD-4C97F114E21D}
EndGlobalSection
EndGlobal
15 changes: 15 additions & 0 deletions samples/Basic/WinUI/Desktop/SkiaSharpSample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Application
x:Class="SkiaSharpSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SkiaSharpSample">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
46 changes: 46 additions & 0 deletions samples/Basic/WinUI/Desktop/SkiaSharpSample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Microsoft.UI.Xaml;
using Windows.ApplicationModel;

namespace SkiaSharpSample
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
{
private Window window;

/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
InitializeComponent();
Suspending += OnSuspending;
}

/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
window = new MainWindow();
window.Activate();
}

/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
// Save application state and stop any background activity
}
}
}
13 changes: 13 additions & 0 deletions samples/Basic/WinUI/Desktop/SkiaSharpSample/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Window
x:Class="SkiaSharpSample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SkiaSharpSample"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:skia="using:SkiaSharp.Views.WinUI"
mc:Ignorable="d">
<Grid>
<skia:SKXamlCanvas PaintSurface="OnPaintSurface" />
</Grid>
</Window>
45 changes: 45 additions & 0 deletions samples/Basic/WinUI/Desktop/SkiaSharpSample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Windows.Graphics.Display;
using Microsoft.UI.Xaml;

using SkiaSharp;
using SkiaSharp.Views.WinUI;

namespace SkiaSharpSample
{
public sealed partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
{
// the the canvas and properties
var canvas = e.Surface.Canvas;

// get the screen density for scaling
var display = DisplayInformation.GetForCurrentView();
var scale = display.LogicalDpi / 96.0f;
var scaledSize = new SKSize(e.Info.Width / scale, e.Info.Height / scale);

// handle the device screen density
canvas.Scale(scale);

// make sure the canvas is blank
canvas.Clear(SKColors.White);

// draw some text
var paint = new SKPaint
{
Color = SKColors.Black,
IsAntialias = true,
Style = SKPaintStyle.Fill,
TextAlign = SKTextAlign.Center,
TextSize = 24
};
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
canvas.DrawText("SkiaSharp", coord, paint);
}
}
}
52 changes: 52 additions & 0 deletions samples/Basic/WinUI/Desktop/SkiaSharpSample/SkiaSharpSample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<RootNamespace>SkiaSharpSample</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>AnyCPU;x86;x64</Platforms>
<SelfContained>true</SelfContained>
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VCRTForwarders.140" Version="1.0.6" />
<PackageReference Include="Microsoft.WinUI" Version="3.0.0-preview2.200713.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\..\binding\SkiaSharp\SkiaSharp.csproj" />
<ProjectReference Include="..\..\..\..\..\source\SkiaSharp.Views.WinUI\SkiaSharp.Views.WinUI\SkiaSharp.Views.WinUI.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\..\..\..\output\native\windows\$(Platform)\libSkiaSharp.dll" Condition="Exists('..\..\..\..\..\output\native\windows\$(Platform)\libSkiaSharp.dll')">
<Link>libSkiaSharp.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Remove="App.xaml" />
<None Remove="MainWindow.xaml" />
</ItemGroup>

<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

<ItemGroup>
<Page Update="App.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Update="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>

</Project>
Loading