Implemented ShareX sample
このコミットが含まれているのは:
1 親
1861fe3218
コミット
2dd0549eec
2ファイル変更
+47
-2
検索条件に一致するファイルはありません
@@ -8,7 +8,20 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\ComputeSharp.ImageProcessing\city.jpg" Link="city.jpg" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.2" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj"
|
||||
OutputItemType="Analyzer"
|
||||
ReferenceOutputAssembly="false"
|
||||
PrivateAssets="contentfiles;build" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,12 +1,44 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using ShareX.HelpersLib;
|
||||
|
||||
namespace ComputeSharp.ShareX
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
static void Main()
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
Console.WriteLine(">> Loading image");
|
||||
|
||||
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "city.jpg");
|
||||
|
||||
using Bitmap sourceBitmap = new(path);
|
||||
|
||||
Console.WriteLine(">> Blurring on CPU");
|
||||
|
||||
using Bitmap resultBitmapCpu = ConvolutionMatrixManager.GaussianBlur(60, 60, 10).Apply(sourceBitmap);
|
||||
|
||||
string resultPathCpu = Path.Combine(
|
||||
Path.GetRelativePath(Path.GetDirectoryName(path)!, @"..\..\..\"),
|
||||
$"{Path.GetFileNameWithoutExtension(path)}_cpu{Path.GetExtension(path)}");
|
||||
|
||||
Console.WriteLine(">> Saving image");
|
||||
|
||||
resultBitmapCpu.Save(resultPathCpu);
|
||||
|
||||
Console.WriteLine(">> Blurring on GPU");
|
||||
|
||||
using Bitmap resultBitmapGpu = HlslConvolutionManager.Create(60, 10).Apply(sourceBitmap);
|
||||
|
||||
string resultPathGpu = Path.Combine(
|
||||
Path.GetRelativePath(Path.GetDirectoryName(path)!, @"..\..\..\"),
|
||||
$"{Path.GetFileNameWithoutExtension(path)}_gpu{Path.GetExtension(path)}");
|
||||
|
||||
Console.WriteLine(">> Saving image");
|
||||
|
||||
resultBitmapGpu.Save(resultPathGpu);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする