diff --git a/.gitignore b/.gitignore index 3e759b75..109cd325 100644 --- a/.gitignore +++ b/.gitignore @@ -328,3 +328,6 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ + +# Sample bokeh blur image +**/*_bokeh.jpg diff --git a/samples/ComputeSharp.BokehBlur/ComputeSharp.BokehBlur.csproj b/samples/ComputeSharp.BokehBlur/ComputeSharp.BokehBlur.csproj index 4d935707..4e012e0c 100644 --- a/samples/ComputeSharp.BokehBlur/ComputeSharp.BokehBlur.csproj +++ b/samples/ComputeSharp.BokehBlur/ComputeSharp.BokehBlur.csproj @@ -5,6 +5,16 @@ netcoreapp3.0 + + + + + + + PreserveNewest + + + diff --git a/samples/ComputeSharp.BokehBlur/Program.cs b/samples/ComputeSharp.BokehBlur/Program.cs index 94bac893..3240f439 100644 --- a/samples/ComputeSharp.BokehBlur/Program.cs +++ b/samples/ComputeSharp.BokehBlur/Program.cs @@ -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 { - /// - /// The path of the image to process (the modified version will be saved as a copy) - /// - private const string ImagePath = @""; - /// /// The radius of the bokeh blur effect to apply /// - private const int Radius = 32; + private const int Radius = 48; /// /// 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 image = Image.Load(ImagePath); + string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "city.jpg"); + using Image 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); } } diff --git a/samples/ComputeSharp.BokehBlur/city.jpg b/samples/ComputeSharp.BokehBlur/city.jpg new file mode 100644 index 00000000..ba594bed Binary files /dev/null and b/samples/ComputeSharp.BokehBlur/city.jpg differ