Included sample image for the bokeh blur effect
このコミットが含まれているのは:
1 親
741d9e833b
コミット
3b40f815fd
4ファイル変更
+19
-9
検索条件に一致するファイルはありません
@@ -328,3 +328,6 @@ ASALocalRun/
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Sample bokeh blur image
|
||||
**/*_bokeh.jpg
|
||||
@@ -5,6 +5,16 @@
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="city.jpg" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="city.jpg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0006" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using ComputeSharp.Graphics.Buffers;
|
||||
@@ -12,15 +13,10 @@ namespace ComputeSharp.BokehBlur
|
||||
{
|
||||
class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The path of the image to process (the modified version will be saved as a copy)
|
||||
/// </summary>
|
||||
private const string ImagePath = @"";
|
||||
|
||||
/// <summary>
|
||||
/// The radius of the bokeh blur effect to apply
|
||||
/// </summary>
|
||||
private const int Radius = 32;
|
||||
private const int Radius = 48;
|
||||
|
||||
/// <summary>
|
||||
/// The gamma exposure value to use when applying the effect
|
||||
@@ -31,7 +27,8 @@ namespace ComputeSharp.BokehBlur
|
||||
{
|
||||
// Load the input image
|
||||
Console.WriteLine(">> Loading image");
|
||||
using Image<Rgba32> image = Image.Load(ImagePath);
|
||||
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "city.jpg");
|
||||
using Image<Rgba32> image = Image.Load(path);
|
||||
var (height, width) = (image.Height, image.Width);
|
||||
|
||||
// Get the vector buffer
|
||||
@@ -135,8 +132,8 @@ namespace ComputeSharp.BokehBlur
|
||||
// Save the resulting image
|
||||
Console.WriteLine(">> Saving to disk");
|
||||
string targetPath = Path.Combine(
|
||||
Path.GetDirectoryName(ImagePath),
|
||||
$"{Path.GetFileNameWithoutExtension(ImagePath)}_bokeh{Path.GetExtension(ImagePath)}");
|
||||
Path.GetRelativePath(Path.GetDirectoryName(path), @"..\..\..\"),
|
||||
$"{Path.GetFileNameWithoutExtension(path)}_bokeh{Path.GetExtension(path)}");
|
||||
image.Save(targetPath);
|
||||
}
|
||||
}
|
||||
|
||||
バイナリファイルは表示されません。
|
変更後 幅: | 高さ: | サイズ: 1.3 MiB |
新しいイシューから参照
ユーザーをブロックする