Refactored code to use file scoped using declarations
このコミットが含まれているのは:
1 親
52ec5a79b0
コミット
d5e3114f7c
275ファイル変更
+91970
-92271
検索条件に一致するファイルはありません
@@ -7,32 +7,31 @@ using SixLabors.ImageSharp.Processing;
|
||||
using SixLabors.ImageSharp.Processing.Processors;
|
||||
using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32;
|
||||
|
||||
namespace ComputeSharp.ImageProcessing
|
||||
namespace ComputeSharp.ImageProcessing;
|
||||
|
||||
class Program
|
||||
{
|
||||
class Program
|
||||
static void Main()
|
||||
{
|
||||
static void Main()
|
||||
Console.WriteLine(">> Loading image");
|
||||
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "city.jpg");
|
||||
using Image<ImageSharpRgba32> image = Image.Load<ImageSharpRgba32>(path);
|
||||
|
||||
// Apply a series of processors and save the results
|
||||
foreach (var effect in new (string Name, IImageProcessor Processor)[]
|
||||
{
|
||||
Console.WriteLine(">> Loading image");
|
||||
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "city.jpg");
|
||||
using Image<ImageSharpRgba32> image = Image.Load<ImageSharpRgba32>(path);
|
||||
("bokeh", new HlslBokehBlurProcessor(80, 2)),
|
||||
("gaussian", new HlslGaussianBlurProcessor(80))
|
||||
})
|
||||
{
|
||||
Console.WriteLine($">> Applying {effect.Name}");
|
||||
using Image copy = image.Clone(c => c.ApplyProcessor(effect.Processor));
|
||||
|
||||
// Apply a series of processors and save the results
|
||||
foreach (var effect in new (string Name, IImageProcessor Processor)[]
|
||||
{
|
||||
("bokeh", new HlslBokehBlurProcessor(80, 2)),
|
||||
("gaussian", new HlslGaussianBlurProcessor(80))
|
||||
})
|
||||
{
|
||||
Console.WriteLine($">> Applying {effect.Name}");
|
||||
using Image copy = image.Clone(c => c.ApplyProcessor(effect.Processor));
|
||||
|
||||
Console.WriteLine($">> Saving {effect.Name} to disk");
|
||||
string targetPath = Path.Combine(
|
||||
Path.GetRelativePath(Path.GetDirectoryName(path)!, @"..\..\..\"),
|
||||
$"{Path.GetFileNameWithoutExtension(path)}_{effect.Name}{Path.GetExtension(path)}");
|
||||
copy.Save(targetPath);
|
||||
}
|
||||
Console.WriteLine($">> Saving {effect.Name} to disk");
|
||||
string targetPath = Path.Combine(
|
||||
Path.GetRelativePath(Path.GetDirectoryName(path)!, @"..\..\..\"),
|
||||
$"{Path.GetFileNameWithoutExtension(path)}_{effect.Name}{Path.GetExtension(path)}");
|
||||
copy.Save(targetPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする