Fix the what the `IgnorePixelScaling` property works (#1804)
|
@ -9,6 +9,8 @@ namespace SkiaSharp
|
|||
{
|
||||
private const int PatchCornerCount = 4;
|
||||
private const int PatchCubicsCount = 12;
|
||||
private const double RadiansCircle = 2.0 * Math.PI;
|
||||
private const double DegreesCircle = 360.0;
|
||||
|
||||
internal SKCanvas (IntPtr handle, bool owns)
|
||||
: base (handle, owns)
|
||||
|
@ -117,11 +119,17 @@ namespace SkiaSharp
|
|||
|
||||
public void Translate (float dx, float dy)
|
||||
{
|
||||
if (dx == 0 && dy == 0)
|
||||
return;
|
||||
|
||||
SkiaApi.sk_canvas_translate (Handle, dx, dy);
|
||||
}
|
||||
|
||||
public void Translate (SKPoint point)
|
||||
{
|
||||
if (point.IsEmpty)
|
||||
return;
|
||||
|
||||
SkiaApi.sk_canvas_translate (Handle, point.X, point.Y);
|
||||
}
|
||||
|
||||
|
@ -129,21 +137,33 @@ namespace SkiaSharp
|
|||
|
||||
public void Scale (float s)
|
||||
{
|
||||
if (s == 1)
|
||||
return;
|
||||
|
||||
SkiaApi.sk_canvas_scale (Handle, s, s);
|
||||
}
|
||||
|
||||
public void Scale (float sx, float sy)
|
||||
{
|
||||
if (sx == 1 && sy == 1)
|
||||
return;
|
||||
|
||||
SkiaApi.sk_canvas_scale (Handle, sx, sy);
|
||||
}
|
||||
|
||||
public void Scale (SKPoint size)
|
||||
{
|
||||
if (size.IsEmpty)
|
||||
return;
|
||||
|
||||
SkiaApi.sk_canvas_scale (Handle, size.X, size.Y);
|
||||
}
|
||||
|
||||
public void Scale (float sx, float sy, float px, float py)
|
||||
{
|
||||
if (sx == 1 && sy == 1)
|
||||
return;
|
||||
|
||||
Translate (px, py);
|
||||
Scale (sx, sy);
|
||||
Translate (-px, -py);
|
||||
|
@ -153,16 +173,25 @@ namespace SkiaSharp
|
|||
|
||||
public void RotateDegrees (float degrees)
|
||||
{
|
||||
if (degrees % DegreesCircle == 0)
|
||||
return;
|
||||
|
||||
SkiaApi.sk_canvas_rotate_degrees (Handle, degrees);
|
||||
}
|
||||
|
||||
public void RotateRadians (float radians)
|
||||
{
|
||||
if (radians % RadiansCircle == 0)
|
||||
return;
|
||||
|
||||
SkiaApi.sk_canvas_rotate_radians (Handle, radians);
|
||||
}
|
||||
|
||||
public void RotateDegrees (float degrees, float px, float py)
|
||||
{
|
||||
if (degrees % DegreesCircle == 0)
|
||||
return;
|
||||
|
||||
Translate (px, py);
|
||||
RotateDegrees (degrees);
|
||||
Translate (-px, -py);
|
||||
|
@ -170,6 +199,9 @@ namespace SkiaSharp
|
|||
|
||||
public void RotateRadians (float radians, float px, float py)
|
||||
{
|
||||
if (radians % RadiansCircle == 0)
|
||||
return;
|
||||
|
||||
Translate (px, py);
|
||||
RotateRadians (radians);
|
||||
Translate (-px, -py);
|
||||
|
@ -179,11 +211,17 @@ namespace SkiaSharp
|
|||
|
||||
public void Skew (float sx, float sy)
|
||||
{
|
||||
if (sx == 0 && sy == 0)
|
||||
return;
|
||||
|
||||
SkiaApi.sk_canvas_skew (Handle, sx, sy);
|
||||
}
|
||||
|
||||
public void Skew (SKPoint skew)
|
||||
{
|
||||
if (skew.IsEmpty)
|
||||
return;
|
||||
|
||||
SkiaApi.sk_canvas_skew (Handle, skew.X, skew.Y);
|
||||
}
|
||||
|
||||
|
|
|
@ -424,6 +424,8 @@ Task ("samples")
|
|||
{ "tvos", isMac },
|
||||
{ "uwp", isWin },
|
||||
{ "winui", isWin },
|
||||
{ "wapproj", isWin },
|
||||
{ "msix", isWin },
|
||||
{ "watchos", isMac },
|
||||
{ "wpf", isWin },
|
||||
};
|
||||
|
@ -433,6 +435,7 @@ Task ("samples")
|
|||
{ "tvos", "iPhoneSimulator" },
|
||||
{ "uwp", "x86" },
|
||||
{ "winui", "x64" },
|
||||
{ "wapproj", "x64" },
|
||||
{ "watchos", "iPhoneSimulator" },
|
||||
{ "xamarin.forms.mac", "iPhone" },
|
||||
{ "xamarin.forms.windows", "x86" },
|
||||
|
@ -458,8 +461,12 @@ Task ("samples")
|
|||
buildPlatform = platformMatrix [platform];
|
||||
}
|
||||
|
||||
Information ($"Building {sln} ({platform})...");
|
||||
|
||||
RunNuGetRestorePackagesConfig (sln);
|
||||
RunMSBuild (sln, platform: buildPlatform);
|
||||
} else {
|
||||
Information ($"Skipping {sln} ({platform})...");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,13 +40,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = Resources.DisplayMetrics.Density;
|
||||
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);
|
||||
|
||||
|
@ -59,7 +52,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<SkiaSharp.Views.Android.SKCanvasView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:ignorePixelScaling="true"
|
||||
android:id="@+id/skiaView" />
|
||||
</FrameLayout>
|
|
@ -17,13 +17,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = 1f;
|
||||
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);
|
||||
|
||||
|
@ -36,7 +29,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace SkiaSharpSample
|
|||
window.Show();
|
||||
|
||||
var skiaView = new SKCanvasView(window);
|
||||
skiaView.IgnorePixelScaling = true;
|
||||
skiaView.PaintSurface += OnPaintSurface;
|
||||
skiaView.Show();
|
||||
|
||||
|
@ -43,18 +44,9 @@ namespace SkiaSharpSample
|
|||
|
||||
private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
|
||||
{
|
||||
var skiaView = sender as SKCanvasView;
|
||||
|
||||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)ScalingInfo.ScalingFactor;
|
||||
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);
|
||||
|
||||
|
@ -67,7 +59,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,13 +24,6 @@ public partial class MainWindow : Gtk.Window
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = 1f;
|
||||
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);
|
||||
|
||||
|
@ -43,7 +36,7 @@ public partial class MainWindow : Gtk.Window
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,13 +37,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = 1f;
|
||||
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);
|
||||
|
||||
|
@ -56,7 +49,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
BackgroundColor="White">
|
||||
|
||||
<skia:SKCanvasView x:Name="skiaView" PaintSurface="OnPaintSurface"
|
||||
EnableTouchEvents="True" Touch="OnTouch" />
|
||||
EnableTouchEvents="True" Touch="OnTouch"
|
||||
IgnorePixelScaling="True" />
|
||||
|
||||
</ContentPage>
|
||||
|
|
|
@ -30,12 +30,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)(e.Info.Width / skiaView.Width);
|
||||
|
||||
// handle the device screen density
|
||||
canvas.Scale(scale);
|
||||
|
||||
// make sure the canvas is blank
|
||||
canvas.Clear(SKColors.White);
|
||||
|
||||
|
@ -51,8 +45,8 @@ namespace SkiaSharpSample
|
|||
|
||||
// adjust the location based on the pointer
|
||||
var coord = (touchLocation is SKPoint loc)
|
||||
? new SKPoint(loc.X / scale, loc.Y / scale)
|
||||
: new SKPoint((float)skiaView.Width / 2, ((float)skiaView.Height + paint.TextSize) / 2);
|
||||
? new SKPoint(loc.X, loc.Y)
|
||||
: new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
|
||||
// draw some text
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
<TargetFrameworks>net6.0-ios;net6.0-maccatalyst;net6.0-android</TargetFrameworks>
|
||||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
|
||||
<OutputType>Exe</OutputType>
|
||||
<UseMaui>true</UseMaui>
|
||||
<SingleProject>true</SingleProject>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<RootNamespace>SkiaSharpSample</RootNamespace>
|
||||
<ApplicationTitle>SkiaSharpSample</ApplicationTitle>
|
||||
<ApplicationId>com.companyname.SkiaSharpSample</ApplicationId>
|
||||
<ApplicationVersion>1.0</ApplicationVersion>
|
||||
<AndroidVersionCode>1</AndroidVersionCode>
|
||||
<UseMaui>true</UseMaui>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<UseInterpreter Condition="'$(Configuration)' == 'Debug'">True</UseInterpreter>
|
||||
</PropertyGroup>
|
||||
|
@ -39,10 +40,9 @@
|
|||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<AppxPackageRecipe>bin\$(Configuration)\net6.0-windows10.0.19041\win-x64\SkiaSharpSample.build.appxrecipe</AppxPackageRecipe>
|
||||
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-windows'))">win-x64</RuntimeIdentifier>
|
||||
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\..\..\output\SkiaSharp\nuget\build\$(TargetFramework)\SkiaSharp.Local.targets" Condition="Exists('..\..\..\..\output\SkiaSharp\nuget\build\$(TargetFramework)\SkiaSharp.Local.targets')" />
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
mc:Ignorable="d"
|
||||
Title="SkiaSharp" Height="350" Width="525" Icon="/icon.ico">
|
||||
<Grid>
|
||||
<skia:SKElement PaintSurface="OnPaintSurface" />
|
||||
<skia:SKElement PaintSurface="OnPaintSurface" IgnorePixelScaling="True" />
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
@ -17,13 +17,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11;
|
||||
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);
|
||||
|
||||
|
@ -36,7 +29,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
xmlns:skia="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms"
|
||||
x:Class="SkiaSharpSample.MainPage">
|
||||
|
||||
<skia:SKCanvasView x:Name="skiaView" PaintSurface="OnPaintSurface" />
|
||||
<skia:SKCanvasView x:Name="skiaView" PaintSurface="OnPaintSurface" IgnorePixelScaling="True" />
|
||||
|
||||
</ContentPage>
|
|
@ -17,12 +17,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)(e.Info.Width / skiaView.Width);
|
||||
|
||||
// handle the device screen density
|
||||
canvas.Scale(scale);
|
||||
|
||||
// make sure the canvas is blank
|
||||
canvas.Clear(SKColors.White);
|
||||
|
||||
|
@ -35,7 +29,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint((float)skiaView.Width / 2, ((float)skiaView.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
xmlns:skia="using:SkiaSharp.Views.UWP"
|
||||
mc:Ignorable="d">
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<skia:SKXamlCanvas PaintSurface="OnPaintSurface" />
|
||||
<skia:SKXamlCanvas PaintSurface="OnPaintSurface" IgnorePixelScaling="True" />
|
||||
</Grid>
|
||||
</Page>
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Windows.Graphics.Display;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.UWP;
|
||||
|
@ -18,14 +17,6 @@ namespace SkiaSharpSample
|
|||
// 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);
|
||||
|
||||
|
@ -38,7 +29,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:skia="using:SkiaSharp.Views.UWP"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<skia:SKXamlCanvas PaintSurface="OnPaintSurface" />
|
||||
<skia:SKXamlCanvas PaintSurface="OnPaintSurface" IgnorePixelScaling="True" />
|
||||
</Grid>
|
||||
|
||||
</Page>
|
||||
|
|
|
@ -18,14 +18,6 @@ namespace SkiaSharpSample
|
|||
// 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);
|
||||
|
||||
|
@ -38,7 +30,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
mc:Ignorable="d"
|
||||
Title="SkiaSharp" Height="350" Width="525" Icon="icon.ico">
|
||||
<Grid>
|
||||
<skia:SKElement PaintSurface="OnPaintSurface" />
|
||||
<skia:SKElement PaintSurface="OnPaintSurface" IgnorePixelScaling="True" />
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
@ -17,13 +17,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice.M11;
|
||||
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);
|
||||
|
||||
|
@ -36,7 +29,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31709.45
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharpSample", "SkiaSharpSample\SkiaSharpSample.csproj", "{71668276-ECDD-49EC-9406-27A9D2676139}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp", "..\..\..\..\binding\SkiaSharp\SkiaSharp.csproj", "{EA2AC287-6FEF-415D-BD33-01287DD11574}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.WinUI", "..\..\..\..\source\SkiaSharp.Views.WinUI\SkiaSharp.Views.WinUI\SkiaSharp.Views.WinUI.csproj", "{B9E319D8-0A0E-471C-BD01-8015655FBD99}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{71668276-ECDD-49EC-9406-27A9D2676139}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{71668276-ECDD-49EC-9406-27A9D2676139}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{71668276-ECDD-49EC-9406-27A9D2676139}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{71668276-ECDD-49EC-9406-27A9D2676139}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{71668276-ECDD-49EC-9406-27A9D2676139}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{71668276-ECDD-49EC-9406-27A9D2676139}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{EA2AC287-6FEF-415D-BD33-01287DD11574}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EA2AC287-6FEF-415D-BD33-01287DD11574}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EA2AC287-6FEF-415D-BD33-01287DD11574}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EA2AC287-6FEF-415D-BD33-01287DD11574}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B9E319D8-0A0E-471C-BD01-8015655FBD99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B9E319D8-0A0E-471C-BD01-8015655FBD99}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B9E319D8-0A0E-471C-BD01-8015655FBD99}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{B9E319D8-0A0E-471C-BD01-8015655FBD99}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B9E319D8-0A0E-471C-BD01-8015655FBD99}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B9E319D8-0A0E-471C-BD01-8015655FBD99}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F5AABA3E-0272-4E88-A2B4-BD422E83400E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
До Ширина: | Высота: | Размер: 1.4 KiB После Ширина: | Высота: | Размер: 1.4 KiB |
До Ширина: | Высота: | Размер: 7.5 KiB После Ширина: | Высота: | Размер: 7.5 KiB |
До Ширина: | Высота: | Размер: 2.9 KiB После Ширина: | Высота: | Размер: 2.9 KiB |
До Ширина: | Высота: | Размер: 1.6 KiB После Ширина: | Высота: | Размер: 1.6 KiB |
До Ширина: | Высота: | Размер: 1.2 KiB После Ширина: | Высота: | Размер: 1.2 KiB |
До Ширина: | Высота: | Размер: 1.4 KiB После Ширина: | Высота: | Размер: 1.4 KiB |
До Ширина: | Высота: | Размер: 3.1 KiB После Ширина: | Высота: | Размер: 3.1 KiB |
|
@ -8,6 +8,6 @@
|
|||
xmlns:skia="using:SkiaSharp.Views.Windows"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<skia:SKXamlCanvas PaintSurface="OnPaintSurface" />
|
||||
<skia:SKXamlCanvas PaintSurface="OnPaintSurface" IgnorePixelScaling="True" />
|
||||
|
||||
</Window>
|
|
@ -16,13 +16,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)((SKXamlCanvas)sender).XamlRoot.RasterizationScale;
|
||||
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);
|
||||
|
||||
|
@ -35,7 +28,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint(scaledSize.Width / 2, (scaledSize.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"profiles": {
|
||||
"Windows Machine": {
|
||||
"commandName": "MsixPackage",
|
||||
"nativeDebugging": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework>
|
||||
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||
<RootNamespace>SkiaSharpSample</RootNamespace>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
|
||||
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0-experimental1" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK.Foundation" Version="1.0.0-experimental1" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK.WinUI" Version="1.0.0-experimental1" />
|
||||
<Manifest Include="$(ApplicationManifest)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\..\binding\SkiaSharp\SkiaSharp.csproj" />
|
||||
<ProjectReference Include="..\..\..\..\..\source\SkiaSharp.Views.WinUI\SkiaSharp.Views.WinUI\SkiaSharp.Views.WinUI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\..\..\..\output\native\windows\x64\libSkiaSharp.dll" Condition="Exists('..\..\..\..\..\output\native\windows\x64\libSkiaSharp.dll')" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Images\LockScreenLogo.scale-200.png" />
|
||||
<Content Include="Images\SplashScreen.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>
|
||||
|
||||
</Project>
|
Двоичные данные
samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/Images/LockScreenLogo.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/Images/SplashScreen.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 7.5 KiB |
Двоичные данные
samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/Images/Square150x150Logo.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 2.9 KiB |
Двоичные данные
samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/Images/Square44x44Logo.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 1.6 KiB |
Двоичные данные
samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/Images/Square44x44Logo.targetsize-24_altform-unplated.png
Normal file
После Ширина: | Высота: | Размер: 1.2 KiB |
Двоичные данные
samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/Images/StoreLogo.png
Normal file
После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
samples/Basic/WinUI/WapProj/SkiaSharpSample.Package/Images/Wide310x150Logo.scale-200.png
Normal file
После Ширина: | Высота: | Размер: 3.1 KiB |
|
@ -0,0 +1,48 @@
|
|||
<?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="479d1110-d6ad-48a8-ac62-4af987a884d0"
|
||||
Publisher="CN=matthew"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<Properties>
|
||||
<DisplayName>SkiaSharpSample</DisplayName>
|
||||
<PublisherDisplayName>matthew</PublisherDisplayName>
|
||||
<Logo>Images\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate"/>
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App"
|
||||
Executable="$targetnametoken$.exe"
|
||||
EntryPoint="$targetentrypoint$">
|
||||
<uap:VisualElements
|
||||
DisplayName="SkiaSharpSample"
|
||||
Description="SkiaSharpSample"
|
||||
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>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
</Capabilities>
|
||||
</Package>
|
|
@ -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>
|
|
@ -0,0 +1,20 @@
|
|||
using Microsoft.UI.Xaml;
|
||||
|
||||
namespace SkiaSharpSample
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
private Window window;
|
||||
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||
{
|
||||
window = new MainWindow();
|
||||
window.Activate();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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.Windows"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<skia:SKXamlCanvas PaintSurface="OnPaintSurface" IgnorePixelScaling="True" />
|
||||
|
||||
</Window>
|
|
@ -0,0 +1,35 @@
|
|||
using Microsoft.UI.Xaml;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.Windows;
|
||||
|
||||
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;
|
||||
|
||||
// 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(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="SkiaSharpSample.app"/>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<!-- The combination of below two tags have the following effect:
|
||||
1) Per-Monitor for >= Windows 10 Anniversary Update
|
||||
2) System < Windows 10 Anniversary Update
|
||||
-->
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
|
@ -5,6 +5,8 @@
|
|||
x:Class="SkiaSharpSample.MainPage"
|
||||
Title="SkiaSharp">
|
||||
|
||||
<skia:SKCanvasView x:Name="skiaView" PaintSurface="OnPaintSurface" />
|
||||
<skia:SKCanvasView x:Name="skiaView" PaintSurface="OnPaintSurface"
|
||||
EnableTouchEvents="True" Touch="OnTouch"
|
||||
IgnorePixelScaling="True" />
|
||||
|
||||
</ContentPage>
|
|
@ -7,27 +7,35 @@ namespace SkiaSharpSample
|
|||
{
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
private SKPoint? touchLocation;
|
||||
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnTouch(object sender, SKTouchEventArgs e)
|
||||
{
|
||||
if (e.InContact)
|
||||
touchLocation = e.Location;
|
||||
else
|
||||
touchLocation = null;
|
||||
|
||||
skiaView.InvalidateSurface();
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OnPaintSurface(object sender, SKPaintSurfaceEventArgs e)
|
||||
{
|
||||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)(e.Info.Width / skiaView.Width);
|
||||
|
||||
// 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
|
||||
// decide what the text looks like
|
||||
using var paint = new SKPaint
|
||||
{
|
||||
Color = SKColors.Black,
|
||||
IsAntialias = true,
|
||||
|
@ -35,7 +43,13 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint((float)skiaView.Width / 2, ((float)skiaView.Height + paint.TextSize) / 2);
|
||||
|
||||
// adjust the location based on the pointer
|
||||
var coord = (touchLocation is SKPoint loc)
|
||||
? new SKPoint(loc.X, loc.Y)
|
||||
: new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
|
||||
// draw some text
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace SkiaSharpSample
|
|||
{
|
||||
base.ViewDidLoad();
|
||||
|
||||
skiaView.IgnorePixelScaling = true;
|
||||
skiaView.PaintSurface += OnPaintSurface;
|
||||
}
|
||||
|
||||
|
@ -25,12 +26,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)skiaView.ContentScaleFactor;
|
||||
|
||||
// handle the device screen density
|
||||
canvas.Scale(scale);
|
||||
|
||||
// make sure the canvas is blank
|
||||
canvas.Clear(SKColors.White);
|
||||
|
||||
|
@ -43,7 +38,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint((float)skiaView.Bounds.Width / 2, ((float)skiaView.Bounds.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace SkiaSharpSample
|
|||
{
|
||||
base.ViewDidLoad();
|
||||
|
||||
skiaView.IgnorePixelScaling = true;
|
||||
skiaView.PaintSurface += OnPaintSurface;
|
||||
}
|
||||
|
||||
|
@ -25,12 +26,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)skiaView.Window.BackingScaleFactor;
|
||||
|
||||
// handle the device screen density
|
||||
canvas.Scale(scale);
|
||||
|
||||
// make sure the canvas is blank
|
||||
canvas.Clear(SKColors.White);
|
||||
|
||||
|
@ -43,7 +38,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 24
|
||||
};
|
||||
var coord = new SKPoint((float)skiaView.Bounds.Width / 2, ((float)skiaView.Bounds.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace SkiaSharpSample
|
|||
{
|
||||
base.ViewDidLoad();
|
||||
|
||||
skiaView.IgnorePixelScaling = true;
|
||||
skiaView.PaintSurface += OnPaintSurface;
|
||||
}
|
||||
|
||||
|
@ -25,12 +26,6 @@ namespace SkiaSharpSample
|
|||
// the the canvas and properties
|
||||
var canvas = e.Surface.Canvas;
|
||||
|
||||
// get the screen density for scaling
|
||||
var scale = (float)skiaView.ContentScaleFactor;
|
||||
|
||||
// handle the device screen density
|
||||
canvas.Scale(scale);
|
||||
|
||||
// make sure the canvas is blank
|
||||
canvas.Clear(SKColors.White);
|
||||
|
||||
|
@ -43,7 +38,7 @@ namespace SkiaSharpSample
|
|||
TextAlign = SKTextAlign.Center,
|
||||
TextSize = 48
|
||||
};
|
||||
var coord = new SKPoint((float)skiaView.Bounds.Width / 2, ((float)skiaView.Bounds.Height + paint.TextSize) / 2);
|
||||
var coord = new SKPoint(e.Info.Width / 2, (e.Info.Height + paint.TextSize) / 2);
|
||||
canvas.DrawText("SkiaSharp", coord, paint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,12 +4,17 @@ set -e
|
|||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
VERSION_ARGS=""
|
||||
EMSCRIPTEN_VERSION=2.0.23
|
||||
if [ "$1" ]; then
|
||||
VERSION_ARGS="--build-arg EMSCRIPTEN_VERSION=$1"
|
||||
EMSCRIPTEN_VERSION=$1
|
||||
fi
|
||||
|
||||
(cd $DIR && docker build --tag skiasharp-wasm $VERSION_ARGS .)
|
||||
(cd $DIR/../../../ && \
|
||||
docker run --rm --name skiasharp-wasm --volume $(pwd):/work skiasharp-wasm /bin/bash -c "\
|
||||
dotnet tool restore && \
|
||||
dotnet cake --target=externals-wasm --emscriptenVersion=$1")
|
||||
dotnet cake --target=externals-wasm --emscriptenVersion=$EMSCRIPTEN_VERSION")
|
||||
|
||||
# sudo chown -R $(id -u):$(id -g) .
|
||||
# (cd samples/Basic/Uno/SkiaSharpSample.Wasm/bin/Debug/netstandard2.0/dist && python3 server.py)
|
||||
|
|
|
@ -273,7 +273,7 @@ namespace SkiaSharp.Views.Forms
|
|||
var controller = Element as ISKCanvasViewController;
|
||||
|
||||
// the control is being repainted, let the user know
|
||||
controller?.OnPaintSurface(new SKPaintSurfaceEventArgs(e.Surface, e.Info));
|
||||
controller?.OnPaintSurface(new SKPaintSurfaceEventArgs(e.Surface, e.Info, e.RawInfo));
|
||||
}
|
||||
|
||||
private void OnSurfaceInvalidated(object sender, EventArgs eventArgs)
|
||||
|
|
|
@ -15,13 +15,21 @@ namespace SkiaSharp.Views.Forms
|
|||
public class SKPaintSurfaceEventArgs : EventArgs
|
||||
{
|
||||
public SKPaintSurfaceEventArgs(SKSurface surface, SKImageInfo info)
|
||||
: this(surface, info, info)
|
||||
{
|
||||
}
|
||||
|
||||
public SKPaintSurfaceEventArgs(SKSurface surface, SKImageInfo info, SKImageInfo rawInfo)
|
||||
{
|
||||
Surface = surface;
|
||||
Info = info;
|
||||
RawInfo = rawInfo;
|
||||
}
|
||||
|
||||
public SKSurface Surface { get; private set; }
|
||||
public SKSurface Surface { get; }
|
||||
|
||||
public SKImageInfo Info { get; private set; }
|
||||
public SKImageInfo Info { get; }
|
||||
|
||||
public SKImageInfo RawInfo { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,33 +18,12 @@ namespace SkiaSharp.Views.UWP
|
|||
partial void DoUnloaded() =>
|
||||
surfaceFactory.Dispose();
|
||||
|
||||
private SKSize GetCanvasSize() =>
|
||||
surfaceFactory.Info.Size;
|
||||
|
||||
private void DoInvalidate()
|
||||
{
|
||||
UpdateCanvasSize((int)ActualWidth, (int)ActualHeight);
|
||||
surfaceFactory.UpdateCanvasSize((int)(ActualWidth * Dpi), (int)(ActualHeight * Dpi));
|
||||
base.Invalidate();
|
||||
}
|
||||
|
||||
private void UpdateCanvasSize(int w, int h)
|
||||
{
|
||||
if (designMode)
|
||||
return;
|
||||
|
||||
if (!IgnorePixelScaling)
|
||||
{
|
||||
var display = DisplayInformation.GetForCurrentView();
|
||||
var scale = display.LogicalDpi / 96.0f;
|
||||
|
||||
surfaceFactory.UpdateCanvasSize((int)(w * scale), (int)(h * scale));
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceFactory.UpdateCanvasSize(w, h);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDraw(Canvas canvas)
|
||||
{
|
||||
base.OnDraw(canvas);
|
||||
|
@ -62,10 +41,25 @@ namespace SkiaSharp.Views.UWP
|
|||
// create a skia surface
|
||||
var surface = surfaceFactory.CreateSurface(out var info);
|
||||
if (surface == null)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var userVisibleSize = IgnorePixelScaling
|
||||
? new SKSizeI((int)ActualWidth, (int)ActualHeight)
|
||||
: info.Size;
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var skiaCanvas = surface.Canvas;
|
||||
skiaCanvas.Scale((float)Dpi);
|
||||
skiaCanvas.Save();
|
||||
}
|
||||
|
||||
// draw using SkiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
|
||||
// draw the surface to the view
|
||||
surfaceFactory.DrawSurface(surface, canvas);
|
||||
|
|
|
@ -20,9 +20,6 @@ namespace SkiaSharp.Views.UWP
|
|||
partial void DoUnloaded() =>
|
||||
drawable?.Dispose();
|
||||
|
||||
private SKSize GetCanvasSize() =>
|
||||
drawable?.Info.Size ?? SKSize.Empty;
|
||||
|
||||
private void DoInvalidate() =>
|
||||
NeedsDisplay = true;
|
||||
|
||||
|
@ -34,14 +31,30 @@ namespace SkiaSharp.Views.UWP
|
|||
return;
|
||||
|
||||
// create the skia context
|
||||
using var surface = drawable.CreateSurface(Bounds, IgnorePixelScaling ? 1 : Window.BackingScaleFactor, out var info);
|
||||
using var surface = drawable.CreateSurface(Bounds, Window.BackingScaleFactor, out var info);
|
||||
if (info.Width == 0 || info.Height == 0)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var userVisibleSize = IgnorePixelScaling
|
||||
? new SKSizeI((int)Bounds.Width, (int)Bounds.Height)
|
||||
: info.Size;
|
||||
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var skiaCanvas = surface.Canvas;
|
||||
skiaCanvas.Scale((float)Window.BackingScaleFactor);
|
||||
skiaCanvas.Save();
|
||||
}
|
||||
|
||||
using var ctx = NSGraphicsContext.CurrentContext.CGContext;
|
||||
|
||||
// draw on the image using SKiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
|
||||
// draw the surface to the context
|
||||
drawable.DrawSurface(ctx, Bounds, info, surface);
|
||||
|
|
|
@ -13,8 +13,6 @@ namespace SkiaSharp.Views.UWP
|
|||
|
||||
partial void DoUnloaded() => throw new NotImplementedException();
|
||||
|
||||
private SKSize GetCanvasSize() => throw new NotImplementedException();
|
||||
|
||||
private void DoInvalidate() => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,6 @@ namespace SkiaSharp.Views.UWP
|
|||
partial void DoUnloaded() =>
|
||||
FreeBitmap();
|
||||
|
||||
private SKSize GetCanvasSize() =>
|
||||
new SKSize(pixelWidth, pixelHeight);
|
||||
|
||||
private void DoInvalidate()
|
||||
{
|
||||
if (designMode)
|
||||
|
@ -35,13 +32,26 @@ namespace SkiaSharp.Views.UWP
|
|||
return;
|
||||
|
||||
if (ActualWidth <= 0 || ActualHeight <= 0)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var info = CreateBitmap();
|
||||
var info = CreateBitmap(out var unscaledSize, out var dpi);
|
||||
|
||||
using (var surface = SKSurface.Create(info, pixelsHandle.AddrOfPinnedObject(), info.RowBytes))
|
||||
{
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
var userVisibleSize = IgnorePixelScaling ? unscaledSize : info.Size;
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var canvas = surface.Canvas;
|
||||
canvas.Scale(dpi);
|
||||
canvas.Save();
|
||||
}
|
||||
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
}
|
||||
|
||||
// This implementation is not fast enough, and providing the original pixel buffer
|
||||
|
@ -57,29 +67,9 @@ namespace SkiaSharp.Views.UWP
|
|||
bitmap.Invalidate();
|
||||
}
|
||||
|
||||
private SKSizeI CreateSize()
|
||||
private SKImageInfo CreateBitmap(out SKSizeI unscaledSize, out float dpi)
|
||||
{
|
||||
var w = ActualWidth;
|
||||
var h = ActualHeight;
|
||||
|
||||
if (!IsPositive(w) || !IsPositive(h))
|
||||
return SKSizeI.Empty;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
return new SKSizeI((int)w, (int)h);
|
||||
|
||||
var dpi = Dpi;
|
||||
return new SKSizeI((int)(w * dpi), (int)(h * dpi));
|
||||
|
||||
static bool IsPositive(double value)
|
||||
{
|
||||
return !double.IsNaN(value) && !double.IsInfinity(value) && value > 0;
|
||||
}
|
||||
}
|
||||
|
||||
private SKImageInfo CreateBitmap()
|
||||
{
|
||||
var size = CreateSize();
|
||||
var size = CreateSize(out unscaledSize, out dpi);
|
||||
var info = new SKImageInfo(size.Width, size.Height, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
|
||||
|
||||
if (bitmap?.PixelWidth != info.Width || bitmap?.PixelHeight != info.Height)
|
||||
|
@ -94,19 +84,9 @@ namespace SkiaSharp.Views.UWP
|
|||
ImageSource = bitmap,
|
||||
AlignmentX = AlignmentX.Left,
|
||||
AlignmentY = AlignmentY.Top,
|
||||
Stretch = Stretch.None
|
||||
Stretch = Stretch.Fill
|
||||
};
|
||||
|
||||
if (!IgnorePixelScaling)
|
||||
{
|
||||
var scale = 1.0 / Dpi;
|
||||
brush.Transform = new ScaleTransform
|
||||
{
|
||||
ScaleX = scale,
|
||||
ScaleY = scale
|
||||
};
|
||||
}
|
||||
|
||||
Background = brush;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,6 @@ namespace SkiaSharp.Views.UWP
|
|||
partial void DoUnloaded() =>
|
||||
FreeBitmap();
|
||||
|
||||
private SKSize GetCanvasSize() =>
|
||||
new SKSize(pixelWidth, pixelHeight);
|
||||
|
||||
private void DoInvalidate()
|
||||
{
|
||||
if (designMode)
|
||||
|
@ -34,33 +31,36 @@ namespace SkiaSharp.Views.UWP
|
|||
return;
|
||||
|
||||
if (ActualWidth <= 0 || ActualHeight <= 0)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
|
||||
int width, height;
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
width = (int)ActualWidth;
|
||||
height = (int)ActualHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = (int)(ActualWidth * Dpi);
|
||||
height = (int)(ActualHeight * Dpi);
|
||||
}
|
||||
|
||||
var info = new SKImageInfo(width, height, SKImageInfo.PlatformColorType, SKAlphaType.Opaque);
|
||||
CreateBitmap(info);
|
||||
var info = CreateBitmap(out var unscaledSize, out var dpi);
|
||||
|
||||
using (var surface = SKSurface.Create(info, pixelsHandle.AddrOfPinnedObject(), info.RowBytes))
|
||||
{
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
var userVisibleSize = IgnorePixelScaling ? unscaledSize : info.Size;
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var canvas = surface.Canvas;
|
||||
canvas.Scale(dpi);
|
||||
canvas.Save();
|
||||
}
|
||||
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
}
|
||||
|
||||
WebAssemblyRuntime.InvokeJS($"SkiaSharp.Views.UWP.SKXamlCanvas.invalidateCanvas({pixelsHandle.AddrOfPinnedObject()}, \"{this.GetHtmlId()}\", {info.Width}, {pixelHeight});");
|
||||
}
|
||||
|
||||
private unsafe void CreateBitmap(SKImageInfo info)
|
||||
private SKImageInfo CreateBitmap(out SKSizeI unscaledSize, out float dpi)
|
||||
{
|
||||
var size = CreateSize(out unscaledSize, out dpi);
|
||||
var info = new SKImageInfo(size.Width, size.Height, SKImageInfo.PlatformColorType, SKAlphaType.Opaque);
|
||||
|
||||
if (pixels == null || pixelWidth != info.Width || pixelHeight != info.Height)
|
||||
{
|
||||
FreeBitmap();
|
||||
|
@ -70,6 +70,8 @@ namespace SkiaSharp.Views.UWP
|
|||
pixelWidth = info.Width;
|
||||
pixelHeight = info.Height;
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
private void FreeBitmap()
|
||||
|
|
|
@ -20,9 +20,6 @@ namespace SkiaSharp.Views.UWP
|
|||
partial void DoUnloaded() =>
|
||||
drawable?.Dispose();
|
||||
|
||||
private SKSize GetCanvasSize() =>
|
||||
drawable?.Info.Size ?? SKSize.Empty;
|
||||
|
||||
private void DoInvalidate() =>
|
||||
SetNeedsDisplay();
|
||||
|
||||
|
@ -34,14 +31,30 @@ namespace SkiaSharp.Views.UWP
|
|||
return;
|
||||
|
||||
// create the skia context
|
||||
using var surface = drawable.CreateSurface(Bounds, IgnorePixelScaling ? 1 : ContentScaleFactor, out var info);
|
||||
using var surface = drawable.CreateSurface(Bounds, ContentScaleFactor, out var info);
|
||||
if (info.Width == 0 || info.Height == 0)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var userVisibleSize = IgnorePixelScaling
|
||||
? new SKSizeI((int)Bounds.Width, (int)Bounds.Height)
|
||||
: info.Size;
|
||||
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var skiaCanvas = surface.Canvas;
|
||||
skiaCanvas.Scale((float)ContentScaleFactor);
|
||||
skiaCanvas.Save();
|
||||
}
|
||||
|
||||
using var ctx = UIGraphics.GetCurrentContext();
|
||||
|
||||
// draw on the image using SKiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
|
||||
// draw the surface to the context
|
||||
drawable.DrawSurface(ctx, Bounds, info, surface);
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace SkiaSharp.Views.UWP
|
|||
{
|
||||
public partial class SKXamlCanvas : Canvas
|
||||
{
|
||||
private const float DpiBase = 96.0f;
|
||||
|
||||
private static readonly DependencyProperty ProxyVisibilityProperty =
|
||||
DependencyProperty.Register(
|
||||
"ProxyVisibility",
|
||||
|
@ -45,7 +47,7 @@ namespace SkiaSharp.Views.UWP
|
|||
SetBinding(ProxyVisibilityProperty, binding);
|
||||
}
|
||||
|
||||
public SKSize CanvasSize => GetCanvasSize();
|
||||
public SKSize CanvasSize { get; private set; }
|
||||
|
||||
public bool IgnorePixelScaling
|
||||
{
|
||||
|
@ -77,7 +79,7 @@ namespace SkiaSharp.Views.UWP
|
|||
|
||||
private void OnDpiChanged(DisplayInformation sender, object args = null)
|
||||
{
|
||||
Dpi = sender.LogicalDpi / 96.0f;
|
||||
Dpi = sender.LogicalDpi / DpiBase;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
@ -123,5 +125,26 @@ namespace SkiaSharp.Views.UWP
|
|||
partial void DoLoaded();
|
||||
|
||||
partial void DoUnloaded();
|
||||
|
||||
private SKSizeI CreateSize(out SKSizeI unscaledSize, out float dpi)
|
||||
{
|
||||
unscaledSize = SKSizeI.Empty;
|
||||
dpi = (float)Dpi;
|
||||
|
||||
var w = ActualWidth;
|
||||
var h = ActualHeight;
|
||||
|
||||
if (!IsPositive(w) || !IsPositive(h))
|
||||
return SKSizeI.Empty;
|
||||
|
||||
unscaledSize = new SKSizeI((int)w, (int)h);
|
||||
return new SKSizeI((int)(w * dpi), (int)(h * dpi));
|
||||
|
||||
static bool IsPositive(double value)
|
||||
{
|
||||
return !double.IsNaN(value) && !double.IsInfinity(value) && value > 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<declare-styleable name="SKCanvasView">
|
||||
<attr name="ignorePixelScaling" format="boolean"/>
|
||||
</declare-styleable>
|
||||
</resources>
|
|
@ -13,6 +13,7 @@ namespace SkiaSharp.Views.Android
|
|||
private bool ignorePixelScaling;
|
||||
private bool designMode;
|
||||
private SurfaceFactory surfaceFactory;
|
||||
private float density;
|
||||
|
||||
public SKCanvasView(Context context)
|
||||
: base(context)
|
||||
|
@ -23,13 +24,13 @@ namespace SkiaSharp.Views.Android
|
|||
public SKCanvasView(Context context, IAttributeSet attrs)
|
||||
: base(context, attrs)
|
||||
{
|
||||
Initialize();
|
||||
Initialize(attrs);
|
||||
}
|
||||
|
||||
public SKCanvasView(Context context, IAttributeSet attrs, int defStyleAttr)
|
||||
: base(context, attrs, defStyleAttr)
|
||||
{
|
||||
Initialize();
|
||||
Initialize(attrs);
|
||||
}
|
||||
|
||||
protected SKCanvasView(IntPtr javaReference, JniHandleOwnership transfer)
|
||||
|
@ -38,21 +39,37 @@ namespace SkiaSharp.Views.Android
|
|||
Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
private void Initialize(IAttributeSet attrs = null)
|
||||
{
|
||||
designMode = !Extensions.IsValidEnvironment;
|
||||
surfaceFactory = new SurfaceFactory();
|
||||
density = Resources.DisplayMetrics.Density;
|
||||
|
||||
if (attrs != null)
|
||||
{
|
||||
using var a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.SKCanvasView);
|
||||
|
||||
var N = a.IndexCount;
|
||||
for (var i = 0; i < N; ++i)
|
||||
{
|
||||
var attr = a.GetIndex(i);
|
||||
if (attr == Resource.Styleable.SKCanvasView_ignorePixelScaling)
|
||||
IgnorePixelScaling = a.GetBoolean(attr, false);
|
||||
}
|
||||
|
||||
a.Recycle();
|
||||
}
|
||||
}
|
||||
|
||||
public SKSize CanvasSize => surfaceFactory.Info.Size;
|
||||
public SKSize CanvasSize { get; private set; }
|
||||
|
||||
public bool IgnorePixelScaling
|
||||
{
|
||||
get { return ignorePixelScaling; }
|
||||
get => ignorePixelScaling;
|
||||
set
|
||||
{
|
||||
ignorePixelScaling = value;
|
||||
UpdateCanvasSize(Width, Height);
|
||||
surfaceFactory.UpdateCanvasSize(Width, Height);
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
@ -74,10 +91,26 @@ namespace SkiaSharp.Views.Android
|
|||
// create a skia surface
|
||||
var surface = surfaceFactory.CreateSurface(out var info);
|
||||
if (surface == null)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var userVisibleSize = IgnorePixelScaling
|
||||
? new SKSizeI((int)(info.Width / density), (int)(info.Height / density))
|
||||
: info.Size;
|
||||
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var skiaCanvas = surface.Canvas;
|
||||
skiaCanvas.Scale(density);
|
||||
skiaCanvas.Save();
|
||||
}
|
||||
|
||||
// draw using SkiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
OnDraw(surface, info);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
@ -91,7 +124,7 @@ namespace SkiaSharp.Views.Android
|
|||
base.OnSizeChanged(w, h, oldw, oldh);
|
||||
|
||||
// update the info with the new sizes
|
||||
UpdateCanvasSize(w, h);
|
||||
surfaceFactory.UpdateCanvasSize(w, h);
|
||||
}
|
||||
|
||||
public event EventHandler<SKPaintSurfaceEventArgs> PaintSurface;
|
||||
|
@ -118,7 +151,7 @@ namespace SkiaSharp.Views.Android
|
|||
{
|
||||
base.OnAttachedToWindow();
|
||||
|
||||
UpdateCanvasSize(Width, Height);
|
||||
surfaceFactory.UpdateCanvasSize(Width, Height);
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
|
@ -128,8 +161,5 @@ namespace SkiaSharp.Views.Android
|
|||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private void UpdateCanvasSize(int w, int h) =>
|
||||
surfaceFactory.UpdateCanvasSize(w, h, IgnorePixelScaling ? Resources.DisplayMetrics.Density : 1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,4 +12,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="..\SkiaSharp.Views.Shared\**\*.cs" Link="%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\*\*" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -30,11 +30,11 @@ namespace SkiaSharp.Views.Mac
|
|||
[Obsolete("Use PaintSurface instead.")]
|
||||
public ISKCanvasLayerDelegate SKDelegate { get; set; }
|
||||
|
||||
public SKSize CanvasSize => drawable.Info.Size;
|
||||
public SKSize CanvasSize { get; private set; }
|
||||
|
||||
public bool IgnorePixelScaling
|
||||
{
|
||||
get { return ignorePixelScaling; }
|
||||
get => ignorePixelScaling;
|
||||
set
|
||||
{
|
||||
ignorePixelScaling = value;
|
||||
|
@ -47,13 +47,29 @@ namespace SkiaSharp.Views.Mac
|
|||
base.DrawInContext(ctx);
|
||||
|
||||
// create the skia context
|
||||
using (var surface = drawable.CreateSurface(Bounds, IgnorePixelScaling ? 1 : ContentsScale, out var info))
|
||||
using (var surface = drawable.CreateSurface(Bounds, ContentsScale, out var info))
|
||||
{
|
||||
if (info.Width == 0 || info.Height == 0)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var userVisibleSize = IgnorePixelScaling
|
||||
? new SKSizeI((int)Bounds.Width, (int)Bounds.Height)
|
||||
: info.Size;
|
||||
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var skiaCanvas = surface.Canvas;
|
||||
skiaCanvas.Scale((float)ContentsScale);
|
||||
skiaCanvas.Save();
|
||||
}
|
||||
|
||||
// draw on the image using SKiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
DrawInSurface(surface, info);
|
||||
SKDelegate?.DrawInSurface(surface, info);
|
||||
|
|
|
@ -66,11 +66,11 @@ namespace SkiaSharp.Views.iOS
|
|||
drawable = new SKCGSurfaceFactory();
|
||||
}
|
||||
|
||||
public SKSize CanvasSize => drawable?.Info.Size ?? SKSize.Empty;
|
||||
public SKSize CanvasSize { get; private set; }
|
||||
|
||||
public bool IgnorePixelScaling
|
||||
{
|
||||
get { return ignorePixelScaling; }
|
||||
get => ignorePixelScaling;
|
||||
set
|
||||
{
|
||||
ignorePixelScaling = value;
|
||||
|
@ -86,15 +86,31 @@ namespace SkiaSharp.Views.iOS
|
|||
return;
|
||||
|
||||
// create the skia context
|
||||
using (var surface = drawable.CreateSurface(Bounds, IgnorePixelScaling ? 1 : ContentScaleFactor, out var info))
|
||||
using (var surface = drawable.CreateSurface(Bounds, ContentScaleFactor, out var info))
|
||||
{
|
||||
if (info.Width == 0 || info.Height == 0)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var userVisibleSize = IgnorePixelScaling
|
||||
? new SKSizeI((int)Bounds.Width, (int)Bounds.Height)
|
||||
: info.Size;
|
||||
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var skiaCanvas = surface.Canvas;
|
||||
skiaCanvas.Scale((float)ContentScaleFactor);
|
||||
skiaCanvas.Save();
|
||||
}
|
||||
|
||||
using (var ctx = UIGraphics.GetCurrentContext())
|
||||
{
|
||||
// draw on the image using SKiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
DrawInSurface(surface, info);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
|
|
@ -43,11 +43,11 @@ namespace SkiaSharp.Views.Mac
|
|||
drawable = new SKCGSurfaceFactory();
|
||||
}
|
||||
|
||||
public SKSize CanvasSize => drawable.Info.Size;
|
||||
public SKSize CanvasSize { get; private set; }
|
||||
|
||||
public bool IgnorePixelScaling
|
||||
{
|
||||
get { return ignorePixelScaling; }
|
||||
get => ignorePixelScaling;
|
||||
set
|
||||
{
|
||||
ignorePixelScaling = value;
|
||||
|
@ -73,15 +73,31 @@ namespace SkiaSharp.Views.Mac
|
|||
base.DrawRect(dirtyRect);
|
||||
|
||||
// create the skia context
|
||||
using (var surface = drawable.CreateSurface(Bounds, IgnorePixelScaling ? 1 : Window.BackingScaleFactor, out var info))
|
||||
using (var surface = drawable.CreateSurface(Bounds, Window.BackingScaleFactor, out var info))
|
||||
{
|
||||
if (info.Width == 0 || info.Height == 0)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var userVisibleSize = IgnorePixelScaling
|
||||
? new SKSizeI((int)Bounds.Width, (int)Bounds.Height)
|
||||
: info.Size;
|
||||
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var skiaCanvas = surface.Canvas;
|
||||
skiaCanvas.Scale((float)Window.BackingScaleFactor);
|
||||
skiaCanvas.Save();
|
||||
}
|
||||
|
||||
using (var ctx = NSGraphicsContext.CurrentContext.CGContext)
|
||||
{
|
||||
// draw on the image using SKiaSharp
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
DrawInSurface(surface, info);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
|
|
|
@ -23,13 +23,21 @@ namespace SkiaSharp.Views.Windows
|
|||
public class SKPaintSurfaceEventArgs : EventArgs
|
||||
{
|
||||
public SKPaintSurfaceEventArgs(SKSurface surface, SKImageInfo info)
|
||||
: this(surface, info, info)
|
||||
{
|
||||
}
|
||||
|
||||
public SKPaintSurfaceEventArgs(SKSurface surface, SKImageInfo info, SKImageInfo rawInfo)
|
||||
{
|
||||
Surface = surface;
|
||||
Info = info;
|
||||
RawInfo = rawInfo;
|
||||
}
|
||||
|
||||
public SKSurface Surface { get; private set; }
|
||||
public SKSurface Surface { get; }
|
||||
|
||||
public SKImageInfo Info { get; private set; }
|
||||
public SKImageInfo Info { get; }
|
||||
|
||||
public SKImageInfo RawInfo { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,8 @@ namespace SkiaSharp.Views.Tizen
|
|||
|
||||
protected abstract SKSizeI GetSurfaceSize();
|
||||
|
||||
protected virtual SKSizeI GetRawSurfaceSize() => GetSurfaceSize();
|
||||
|
||||
protected virtual void CreateDrawingSurface()
|
||||
{
|
||||
// empty on purpose
|
||||
|
@ -113,7 +115,7 @@ namespace SkiaSharp.Views.Tizen
|
|||
// recreate the drawing surface to match the new size
|
||||
DestroyDrawingSurface();
|
||||
|
||||
var size = GetSurfaceSize();
|
||||
var size = GetRawSurfaceSize();
|
||||
Evas.evas_object_image_size_set(evasImage, size.Width, size.Height);
|
||||
|
||||
CreateDrawingSurface();
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace SkiaSharp.Views.Tizen
|
|||
{
|
||||
private bool ignorePixelScaling;
|
||||
private SKImageInfo info;
|
||||
private SKSizeI canvasSize;
|
||||
|
||||
public SKCanvasView(EvasObject parent)
|
||||
: base(parent)
|
||||
|
@ -17,20 +18,23 @@ namespace SkiaSharp.Views.Tizen
|
|||
|
||||
public bool IgnorePixelScaling
|
||||
{
|
||||
get { return ignorePixelScaling; }
|
||||
get => ignorePixelScaling;
|
||||
set
|
||||
{
|
||||
if (ignorePixelScaling != value)
|
||||
{
|
||||
ignorePixelScaling = value;
|
||||
OnResized();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<SKPaintSurfaceEventArgs> PaintSurface;
|
||||
|
||||
protected override SKSizeI GetSurfaceSize() => info.Size;
|
||||
protected override SKSizeI GetSurfaceSize() => canvasSize;
|
||||
|
||||
protected override SKSizeI GetRawSurfaceSize() => info.Size;
|
||||
|
||||
protected virtual void OnDrawFrame(SKPaintSurfaceEventArgs e)
|
||||
{
|
||||
|
@ -45,8 +49,15 @@ namespace SkiaSharp.Views.Tizen
|
|||
// draw directly into the EFL image data
|
||||
using (var surface = SKSurface.Create(info, Evas.evas_object_image_data_get(evasImage, true), info.RowBytes))
|
||||
{
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var skiaCanvas = surface.Canvas;
|
||||
skiaCanvas.Scale((float)ScalingInfo.ScalingFactor);
|
||||
skiaCanvas.Save();
|
||||
}
|
||||
|
||||
// draw using SkiaSharp
|
||||
OnDrawFrame(new SKPaintSurfaceEventArgs(surface, info));
|
||||
OnDrawFrame(new SKPaintSurfaceEventArgs(surface, info.WithSize(canvasSize), info));
|
||||
surface.Canvas.Flush();
|
||||
}
|
||||
}
|
||||
|
@ -56,15 +67,18 @@ namespace SkiaSharp.Views.Tizen
|
|||
var w = info.Width;
|
||||
var h = info.Height;
|
||||
|
||||
info.Width = geometry.Width;
|
||||
info.Height = geometry.Height;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
info.Width = (int)ScalingInfo.FromPixel(geometry.Width);
|
||||
info.Height = (int)ScalingInfo.FromPixel(geometry.Height);
|
||||
canvasSize.Width = (int)ScalingInfo.FromPixel(geometry.Width);
|
||||
canvasSize.Height = (int)ScalingInfo.FromPixel(geometry.Height);
|
||||
}
|
||||
else
|
||||
{
|
||||
info.Width = geometry.Width;
|
||||
info.Height = geometry.Height;
|
||||
canvasSize.Width = geometry.Width;
|
||||
canvasSize.Height = geometry.Height;
|
||||
}
|
||||
|
||||
return (w != info.Width || h != info.Height);
|
||||
|
|
|
@ -23,14 +23,21 @@ namespace SkiaSharp.Views.Tizen
|
|||
// allows to convert pixels to Android-style device-independent pixels
|
||||
private static readonly Lazy<double> scalingFactor = new Lazy<double>(() => dpi.Value / 160.0);
|
||||
|
||||
private static double? scalingFactorOverride;
|
||||
|
||||
public static string Profile => profile.Value;
|
||||
|
||||
public static int Dpi => dpi.Value;
|
||||
|
||||
public static double ScalingFactor => scalingFactor.Value;
|
||||
public static double ScalingFactor => scalingFactorOverride ?? scalingFactor.Value;
|
||||
|
||||
public static double FromPixel(double v) => v / ScalingFactor;
|
||||
|
||||
public static double ToPixel(double v) => v * ScalingFactor;
|
||||
|
||||
public static void SetScalingFactor(double? scalingFactor)
|
||||
{
|
||||
scalingFactorOverride = scalingFactor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ namespace SkiaSharp.Views.UWP
|
|||
{
|
||||
public partial class SKXamlCanvas : Canvas
|
||||
{
|
||||
private const float DpiBase = 96.0f;
|
||||
|
||||
private static readonly DependencyProperty ProxyVisibilityProperty =
|
||||
DependencyProperty.Register(
|
||||
"ProxyVisibility",
|
||||
|
@ -65,7 +67,7 @@ namespace SkiaSharp.Views.UWP
|
|||
SetBinding(ProxyVisibilityProperty, binding);
|
||||
}
|
||||
|
||||
public SKSize CanvasSize => bitmap == null ? SKSize.Empty : new SKSize(bitmap.PixelWidth, bitmap.PixelHeight);
|
||||
public SKSize CanvasSize { get; private set; }
|
||||
|
||||
public bool IgnorePixelScaling
|
||||
{
|
||||
|
@ -105,7 +107,7 @@ namespace SkiaSharp.Views.UWP
|
|||
#else
|
||||
private void OnDpiChanged(DisplayInformation sender, object args = null)
|
||||
{
|
||||
Dpi = sender.LogicalDpi / 96.0f;
|
||||
Dpi = sender.LogicalDpi / DpiBase;
|
||||
Invalidate();
|
||||
}
|
||||
#endif
|
||||
|
@ -165,30 +167,43 @@ namespace SkiaSharp.Views.UWP
|
|||
if (!isVisible)
|
||||
return;
|
||||
|
||||
var info = CreateBitmap();
|
||||
var info = CreateBitmap(out var unscaledSize, out var dpi);
|
||||
|
||||
if (info.Width <= 0 || info.Height <= 0)
|
||||
{
|
||||
CanvasSize = SKSize.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
var userVisibleSize = IgnorePixelScaling ? unscaledSize : info.Size;
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
using (var surface = SKSurface.Create(info, pixels, info.RowBytes))
|
||||
{
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var canvas = surface.Canvas;
|
||||
canvas.Scale(dpi);
|
||||
canvas.Save();
|
||||
}
|
||||
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
}
|
||||
bitmap.Invalidate();
|
||||
}
|
||||
|
||||
private SKSizeI CreateSize()
|
||||
private SKSizeI CreateSize(out SKSizeI unscaledSize, out float dpi)
|
||||
{
|
||||
unscaledSize = SKSizeI.Empty;
|
||||
dpi = (float)Dpi;
|
||||
|
||||
var w = ActualWidth;
|
||||
var h = ActualHeight;
|
||||
|
||||
if (!IsPositive(w) || !IsPositive(h))
|
||||
return SKSizeI.Empty;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
return new SKSizeI((int)w, (int)h);
|
||||
|
||||
var dpi = Dpi;
|
||||
unscaledSize = new SKSizeI((int)w, (int)h);
|
||||
return new SKSizeI((int)(w * dpi), (int)(h * dpi));
|
||||
|
||||
static bool IsPositive(double value)
|
||||
|
@ -197,9 +212,9 @@ namespace SkiaSharp.Views.UWP
|
|||
}
|
||||
}
|
||||
|
||||
private SKImageInfo CreateBitmap()
|
||||
private SKImageInfo CreateBitmap(out SKSizeI unscaledSize, out float dpi)
|
||||
{
|
||||
var size = CreateSize();
|
||||
var size = CreateSize(out unscaledSize, out dpi);
|
||||
var info = new SKImageInfo(size.Width, size.Height, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
|
||||
|
||||
if (bitmap?.PixelWidth != info.Width || bitmap?.PixelHeight != info.Height)
|
||||
|
@ -215,17 +230,8 @@ namespace SkiaSharp.Views.UWP
|
|||
ImageSource = bitmap,
|
||||
AlignmentX = AlignmentX.Left,
|
||||
AlignmentY = AlignmentY.Top,
|
||||
Stretch = Stretch.None
|
||||
Stretch = Stretch.Fill
|
||||
};
|
||||
if (!IgnorePixelScaling)
|
||||
{
|
||||
var scale = 1.0 / Dpi;
|
||||
brush.Transform = new ScaleTransform
|
||||
{
|
||||
ScaleX = scale,
|
||||
ScaleY = scale
|
||||
};
|
||||
}
|
||||
Background = brush;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace SkiaSharp.Views.WPF
|
|||
[DefaultProperty("Name")]
|
||||
public class SKElement : FrameworkElement
|
||||
{
|
||||
private const double BitmapDpi = 96.0;
|
||||
|
||||
private readonly bool designMode;
|
||||
|
||||
private WriteableBitmap bitmap;
|
||||
|
@ -25,15 +27,11 @@ namespace SkiaSharp.Views.WPF
|
|||
designMode = DesignerProperties.GetIsInDesignMode(this);
|
||||
}
|
||||
|
||||
[Bindable(false)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public SKSize CanvasSize => bitmap == null ? SKSize.Empty : new SKSize(bitmap.PixelWidth, bitmap.PixelHeight);
|
||||
public SKSize CanvasSize { get; private set; }
|
||||
|
||||
public bool IgnorePixelScaling
|
||||
{
|
||||
get { return ignorePixelScaling; }
|
||||
get => ignorePixelScaling;
|
||||
set
|
||||
{
|
||||
ignorePixelScaling = value;
|
||||
|
@ -54,7 +52,11 @@ namespace SkiaSharp.Views.WPF
|
|||
if (Visibility != Visibility.Visible || PresentationSource.FromVisual(this) == null)
|
||||
return;
|
||||
|
||||
var size = CreateSize(out var scaleX, out var scaleY);
|
||||
var size = CreateSize(out var unscaledSize, out var scaleX, out var scaleY);
|
||||
var userVisibleSize = IgnorePixelScaling ? unscaledSize : size;
|
||||
|
||||
CanvasSize = userVisibleSize;
|
||||
|
||||
if (size.Width <= 0 || size.Height <= 0)
|
||||
return;
|
||||
|
||||
|
@ -63,14 +65,21 @@ namespace SkiaSharp.Views.WPF
|
|||
// reset the bitmap if the size has changed
|
||||
if (bitmap == null || info.Width != bitmap.PixelWidth || info.Height != bitmap.PixelHeight)
|
||||
{
|
||||
bitmap = new WriteableBitmap(info.Width, size.Height, 96 * scaleX, 96 * scaleY, PixelFormats.Pbgra32, null);
|
||||
bitmap = new WriteableBitmap(info.Width, size.Height, BitmapDpi * scaleX, BitmapDpi * scaleY, PixelFormats.Pbgra32, null);
|
||||
}
|
||||
|
||||
// draw on the bitmap
|
||||
bitmap.Lock();
|
||||
using (var surface = SKSurface.Create(info, bitmap.BackBuffer, bitmap.BackBufferStride))
|
||||
{
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info));
|
||||
if (IgnorePixelScaling)
|
||||
{
|
||||
var canvas = surface.Canvas;
|
||||
canvas.Scale(scaleX, scaleY);
|
||||
canvas.Save();
|
||||
}
|
||||
|
||||
OnPaintSurface(new SKPaintSurfaceEventArgs(surface, info.WithSize(userVisibleSize), info));
|
||||
}
|
||||
|
||||
// draw the bitmap to the screen
|
||||
|
@ -92,10 +101,11 @@ namespace SkiaSharp.Views.WPF
|
|||
InvalidateVisual();
|
||||
}
|
||||
|
||||
private SKSizeI CreateSize(out double scaleX, out double scaleY)
|
||||
private SKSizeI CreateSize(out SKSizeI unscaledSize, out float scaleX, out float scaleY)
|
||||
{
|
||||
scaleX = 1.0;
|
||||
scaleY = 1.0;
|
||||
unscaledSize = SKSizeI.Empty;
|
||||
scaleX = 1.0f;
|
||||
scaleY = 1.0f;
|
||||
|
||||
var w = ActualWidth;
|
||||
var h = ActualHeight;
|
||||
|
@ -103,12 +113,11 @@ namespace SkiaSharp.Views.WPF
|
|||
if (!IsPositive(w) || !IsPositive(h))
|
||||
return SKSizeI.Empty;
|
||||
|
||||
if (IgnorePixelScaling)
|
||||
return new SKSizeI((int)w, (int)h);
|
||||
unscaledSize = new SKSizeI((int)w, (int)h);
|
||||
|
||||
var m = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice;
|
||||
scaleX = m.M11;
|
||||
scaleY = m.M22;
|
||||
scaleX = (float)m.M11;
|
||||
scaleY = (float)m.M22;
|
||||
return new SKSizeI((int)(w * scaleX), (int)(h * scaleY));
|
||||
|
||||
bool IsPositive(double value)
|
||||
|
|
|
@ -22,10 +22,6 @@ namespace SkiaSharp.Views.Desktop
|
|||
designMode = DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime;
|
||||
}
|
||||
|
||||
[Bindable(false)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public SKSize CanvasSize => bitmap == null ? SKSize.Empty : new SKSize(bitmap.Width, bitmap.Height);
|
||||
|
||||
[Category("Appearance")]
|
||||
|
|
|
@ -49,16 +49,8 @@ namespace SkiaSharp.Views.Desktop
|
|||
ResizeRedraw = true;
|
||||
}
|
||||
|
||||
[Bindable(false)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public SKSize CanvasSize => lastSize;
|
||||
|
||||
[Bindable(false)]
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public GRContext GRContext => grContext;
|
||||
|
||||
[Category("Appearance")]
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
<None Include="..\SkiaSharp.Views.Mac\**\*.cs" Link="Platform\macOS\%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
<!-- Android -->
|
||||
<None Include="..\SkiaSharp.Views.Android\**\*.cs" Link="Platform\Android\%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
<None Include="..\SkiaSharp.Views.Android\Resources\*\*" Link="Platform\Android\Resources\%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
<!-- local platforms -->
|
||||
<Compile Remove="Platform\**" />
|
||||
<None Include="Platform\**\*.cs" />
|
||||
|
@ -69,6 +70,7 @@
|
|||
<!-- Android -->
|
||||
<Compile Include="..\SkiaSharp.Views.Android\**\*.cs" Link="Platform\Android\%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
<Compile Include="Platform\Android\**\*.cs" />
|
||||
<AndroidResource Include="..\SkiaSharp.Views.Android\Resources\*\*" Link="Platform\Android\Resources\%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="..\*\bin\**;..\*\obj\**" />
|
||||
|
|