зеркало из https://github.com/mono/SkiaSharp.git
[Tests] [Build] Added a test for Mac OS (Console)
- also copy native files into the output folder
This commit is contained in:
Родитель
17a1c6bfbb
Коммит
d2aa025de8
|
@ -44,8 +44,10 @@ namespace SkiaSharp
|
|||
const string SKIA = "liblibskia_osx.dylib";
|
||||
#elif WINDOWS_DESKTOP
|
||||
const string SKIA = "libskia_windows.dll";
|
||||
#elif MAC_DESKTOP
|
||||
const string SKIA = "liblibskia_osx.dylib";
|
||||
#else
|
||||
const string SKIA = "/tmp/libskia.dylib";
|
||||
const string SKIA = "path_to_native.library";
|
||||
#endif
|
||||
|
||||
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
|
||||
|
|
|
@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.OSX", "SkiaSharp.
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.Portable", "SkiaSharp.Portable\SkiaSharp.Portable.csproj", "{7AA90628-2FDD-4585-AF2F-CC51CFA8B52A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.MacDesktop", "SkiaSharp.MacDesktop\SkiaSharp.MacDesktop.csproj", "{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
|
@ -33,5 +35,9 @@ Global
|
|||
{C737DC80-5B71-4B26-A2DC-DA30421788B0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{C737DC80-5B71-4B26-A2DC-DA30421788B0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{C737DC80-5B71-4B26-A2DC-DA30421788B0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>SkiaSharp</RootNamespace>
|
||||
<AssemblyName>SkiaSharp</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;MAC_DESKTOP</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<DefineConstants>MAC_DESKTOP</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="SkiaSharp.MacDesktop.targets">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="..\..\native-builds\lib\osx\liblibskia_osx.dylib">
|
||||
<Link>liblibskia_osx.dylib</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="..\Binding\Binding.projitems" Label="Shared" Condition="Exists('..\Binding\Binding.projitems')" />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="$(MSBuildThisFileDirectory)liblibskia_osx.dylib">
|
||||
<Link>liblibskia_osx.dylib</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
38
build.cake
38
build.cake
|
@ -53,6 +53,14 @@ CakeSpec.Libs = new ISolutionBuilder [] {
|
|||
FromFile = "./binding/SkiaSharp.Portable/bin/Release/SkiaSharp.dll",
|
||||
ToDirectory = "./output/portable/"
|
||||
},
|
||||
new OutputFileCopy {
|
||||
FromFile = "./binding/SkiaSharp.MacDesktop/bin/Release/SkiaSharp.dll",
|
||||
ToDirectory = "./output/mac/"
|
||||
},
|
||||
new OutputFileCopy {
|
||||
FromFile = "./binding/SkiaSharp.MacDesktop/bin/Release/SkiaSharp.MacDesktop.targets",
|
||||
ToDirectory = "./output/mac/"
|
||||
},
|
||||
}
|
||||
},
|
||||
new DefaultSolutionBuilder {
|
||||
|
@ -134,12 +142,37 @@ CakeSpec.Tests = new SolutionTestRunner [] {
|
|||
},
|
||||
TestAssembly = "./tests/SkiaSharp.WindowsDesktop.Tests/bin/x64/Release/SkiaSharp.WindowsDesktop.Tests.dll",
|
||||
},
|
||||
new SolutionTestRunner {
|
||||
SolutionBuilder = new DefaultSolutionBuilder {
|
||||
IsWindowsCompatible = false,
|
||||
IsMacCompatible = true,
|
||||
SolutionPath = "./tests/SkiaSharp.MacDesktop.Tests/SkiaSharp.MacDesktop.Tests.sln",
|
||||
},
|
||||
TestAssembly = "./tests/SkiaSharp.MacDesktop.Tests/bin/Release/SkiaSharp.MacDesktop.Tests.dll",
|
||||
},
|
||||
};
|
||||
|
||||
CakeSpec.NuSpecs = new [] {
|
||||
"./nuget/Xamarin.SkiaSharp.nuspec"
|
||||
};
|
||||
|
||||
Task ("libs")
|
||||
.IsDependentOn ("externals")
|
||||
.IsDependentOn ("libs-base")
|
||||
.Does (() =>
|
||||
{
|
||||
if (IsRunningOnUnix ()) {
|
||||
CopyFileToDirectory ("./native-builds/lib/osx/liblibskia_osx.dylib", "./output/osx/");
|
||||
CopyFileToDirectory ("./native-builds/lib/osx/liblibskia_osx.dylib", "./output/mac/");
|
||||
}
|
||||
if (IsRunningOnWindows ()) {
|
||||
CopyFileToDirectory ("./native-builds/lib/windows/x86/libskia_windows.dll", "./output/windows/x86/");
|
||||
CopyFileToDirectory ("./native-builds/lib/windows/x86/libskia_windows.pdb", "./output/windows/x86/");
|
||||
CopyFileToDirectory ("./native-builds/lib/windows/x64/libskia_windows.dll", "./output/windows/x64/");
|
||||
CopyFileToDirectory ("./native-builds/lib/windows/x64/libskia_windows.pdb", "./output/windows/x64/");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Task ("externals")
|
||||
.IsDependentOn ("externals-windows")
|
||||
|
@ -148,6 +181,10 @@ Task ("externals")
|
|||
.IsDependentOn ("externals-android")
|
||||
.Does (() =>
|
||||
{
|
||||
// copy all the native files into the output
|
||||
CopyDirectory ("./native-builds/lib/", "./output/native/");
|
||||
|
||||
// build the dummy project
|
||||
var generic = new DefaultSolutionBuilder {
|
||||
SolutionPath = "binding/SkiaSharp.Generic.sln",
|
||||
IsWindowsCompatible = true,
|
||||
|
@ -155,6 +192,7 @@ Task ("externals")
|
|||
};
|
||||
generic.BuildSolution ();
|
||||
|
||||
// generate the PCL
|
||||
FilePath input = "binding/SkiaSharp.Generic/bin/Release/SkiaSharp.dll";
|
||||
var libPath = "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/,.";
|
||||
StartProcess (CakeStealer.GenApiToolPath, new ProcessSettings {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
<EnableCodeSigning>false</EnableCodeSigning>
|
||||
<EnablePackageSigning>false</EnablePackageSigning>
|
||||
<XamMacArch>x86_64</XamMacArch>
|
||||
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
|
@ -43,11 +44,12 @@
|
|||
<UseSGen>true</UseSGen>
|
||||
<IncludeMonoRuntime>true</IncludeMonoRuntime>
|
||||
<CreatePackage>true</CreatePackage>
|
||||
<CodeSigningKey>Developer ID Application</CodeSigningKey>
|
||||
<CodeSigningKey>Mac Developer</CodeSigningKey>
|
||||
<EnableCodeSigning>true</EnableCodeSigning>
|
||||
<EnablePackageSigning>false</EnablePackageSigning>
|
||||
<XamMacArch>x86_64</XamMacArch>
|
||||
<LinkMode>Full</LinkMode>
|
||||
<PackageSigningKey>Developer ID Installer</PackageSigningKey>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("SkiaSharp.MacDesktop.Tests")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("matthew")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B44897AA-6538-40F0-A69A-AEB4906A00D5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>SkiaSharp.Tests</RootNamespace>
|
||||
<AssemblyName>SkiaSharp.MacDesktop.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="..\Tests\SKManagedStreamTest.cs">
|
||||
<Link>SKManagedStreamTest.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Tests\SKSurfaceTest.cs">
|
||||
<Link>SKSurfaceTest.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Tests\SKTest.cs">
|
||||
<Link>SKTest.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\binding\SkiaSharp.MacDesktop\SkiaSharp.MacDesktop.csproj">
|
||||
<Project>{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}</Project>
|
||||
<Name>SkiaSharp.MacDesktop</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\binding\SkiaSharp.MacDesktop\bin\$(Configuration)\SkiaSharp.MacDesktop.targets" />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.MacDesktop.Tests", "SkiaSharp.MacDesktop.Tests.csproj", "{B44897AA-6538-40F0-A69A-AEB4906A00D5}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Binding", "..\..\binding\Binding\Binding.shproj", "{9C502B9A-25D4-473F-89BD-5A13DDE16354}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.MacDesktop", "..\..\binding\SkiaSharp.MacDesktop\SkiaSharp.MacDesktop.csproj", "{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B44897AA-6538-40F0-A69A-AEB4906A00D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B44897AA-6538-40F0-A69A-AEB4906A00D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B44897AA-6538-40F0-A69A-AEB4906A00D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B44897AA-6538-40F0-A69A-AEB4906A00D5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFB0E2C4-93FE-42C8-BDFA-9C94251CF1A5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
||||
</packages>
|
|
@ -7,7 +7,7 @@
|
|||
<ProjectGuid>{F0179CDB-9435-4FB4-8E52-DBF191079491}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SkiaSharp.WindowsDesktop.Tests</RootNamespace>
|
||||
<RootNamespace>SkiaSharp.Tests</RootNamespace>
|
||||
<AssemblyName>SkiaSharp.WindowsDesktop.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
|
@ -82,9 +82,15 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SKManagedStreamTest.cs" />
|
||||
<Compile Include="SKTest.cs" />
|
||||
<Compile Include="SKSurfaceTest.cs" />
|
||||
<Compile Include="..\Tests\SKManagedStreamTest.cs">
|
||||
<Link>SKManagedStreamTest.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Tests\SKSurfaceTest.cs">
|
||||
<Link>SKSurfaceTest.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Tests\SKTest.cs">
|
||||
<Link>SKTest.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace SkiaSharp.WindowsDesktop.Tests
|
||||
namespace SkiaSharp.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SKManagedStreamTest : SKTest
|
|
@ -1,13 +1,9 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace SkiaSharp.WindowsDesktop.Tests
|
||||
namespace SkiaSharp.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class SKSurfaceTest : SKTest
|
||||
|
@ -35,8 +31,8 @@ namespace SkiaSharp.WindowsDesktop.Tests
|
|||
{
|
||||
var data = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, bitmap.PixelFormat);
|
||||
|
||||
var surface1 = SKSurface.Create(width, height, SKColorType.Bgra_8888, SKAlphaType.Premul, data.Scan0, width * 4);
|
||||
var surface2 = SKSurface.Create(width, height, SKColorType.Bgra_8888, SKAlphaType.Premul, data.Scan0, width * 4);
|
||||
var surface1 = SKSurface.Create(width, height, SKColorType.N_32, SKAlphaType.Premul, data.Scan0, data.Stride);
|
||||
var surface2 = SKSurface.Create(width, height, SKColorType.N_32, SKAlphaType.Premul, data.Scan0, data.Stride);
|
||||
|
||||
Assert.IsNotNull(surface1);
|
||||
Assert.IsNotNull(surface2);
|
||||
|
@ -55,7 +51,7 @@ namespace SkiaSharp.WindowsDesktop.Tests
|
|||
{
|
||||
var data = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, bitmap.PixelFormat);
|
||||
|
||||
var surface = SKSurface.Create(width, height, SKColorType.Bgra_8888, SKAlphaType.Premul, data.Scan0, width * 4);
|
||||
var surface = SKSurface.Create(width, height, SKColorType.N_32, SKAlphaType.Premul, data.Scan0, data.Stride);
|
||||
|
||||
Assert.IsNotNull(surface);
|
||||
Assert.AreNotEqual(IntPtr.Zero, surface.Handle);
|
|
@ -1,13 +1,9 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace SkiaSharp.WindowsDesktop.Tests
|
||||
namespace SkiaSharp.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public abstract class SKTest
|
||||
|
@ -34,7 +30,7 @@ namespace SkiaSharp.WindowsDesktop.Tests
|
|||
{
|
||||
var data = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, bitmap.PixelFormat);
|
||||
|
||||
using (var surface = SKSurface.Create(width, height, SKColorType.Bgra_8888, SKAlphaType.Premul, data.Scan0, width * 4))
|
||||
using (var surface = SKSurface.Create(width, height, SKColorType.N_32, SKAlphaType.Premul, data.Scan0, data.Stride))
|
||||
{
|
||||
draw(surface);
|
||||
}
|
Загрузка…
Ссылка в новой задаче