Skip to content

Commit

Permalink
Use clang-format for formatting
Browse files Browse the repository at this point in the history
Uses the clang-format configuration provided in the latest commit of PR boostorg#596. Formatting is applied to test file and example file as well. I have made no changes whatsoever after using the clang-format.
  • Loading branch information
harshitpant1 committed Jun 23, 2021
1 parent 76c6410 commit bd907af
Show file tree
Hide file tree
Showing 3 changed files with 1,126 additions and 535 deletions.
74 changes: 53 additions & 21 deletions example/euclidean_distance_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <boost/gil/extension/io/png.hpp>
#include <boost/gil/image.hpp>
#include <boost/gil/image_view.hpp>
#include <boost/gil/image_processing/distance_transform.hpp>
#include <boost/gil/extension/io/png.hpp>
#include <boost/gil/image_view.hpp>

#include <iostream>

Expand All @@ -20,8 +20,9 @@ int main(int argc, char* argv[])
{
if (argc != 6)
{
std::cerr << "usage: " << argv[0] << " <input.png> <output.png>"
" <distance_from> <distance_type> <mask_size>";
std::cerr << "usage: " << argv[0]
<< " <input.png> <output.png>"
" <distance_from> <distance_type> <mask_size>";
return -1;
}

Expand All @@ -35,43 +36,74 @@ int main(int argc, char* argv[])

if (dist_from == "on_pixels" && dist_type == "euclidean_approximation" && mask_size == "three")
{
distance_transform(view(input), view(output), gil::distance_from::on_pixels,
gil::distance_type::euclidean_approximation, gil::mask_size::three);
distance_transform(
view(input),
view(output),
gil::distance_from::on_pixels,
gil::distance_type::euclidean_approximation,
gil::mask_size::three);
gil::write_view(argv[2], view(output), gil::png_tag{});
}

else if (dist_from == "off_pixels" && dist_type == "euclidean_approximation" && mask_size == "three")
else if (
dist_from == "off_pixels" && dist_type == "euclidean_approximation" && mask_size == "three")
{
distance_transform(view(input), view(output), gil::distance_from::off_pixels,
gil::distance_type::euclidean_approximation, gil::mask_size::three);
distance_transform(
view(input),
view(output),
gil::distance_from::off_pixels,
gil::distance_type::euclidean_approximation,
gil::mask_size::three);
gil::write_view(argv[2], view(output), gil::png_tag{});
}

else if (dist_from == "on_pixels" && dist_type == "euclidean_approximation" && mask_size == "five")
else if (
dist_from == "on_pixels" && dist_type == "euclidean_approximation" && mask_size == "five")
{
distance_transform(view(input), view(output), gil::distance_from::on_pixels,
gil::distance_type::euclidean_approximation, gil::mask_size::five);
distance_transform(
view(input),
view(output),
gil::distance_from::on_pixels,
gil::distance_type::euclidean_approximation,
gil::mask_size::five);
gil::write_view(argv[2], view(output), gil::png_tag{});
}

else if (dist_from == "off_pixels" && dist_type == "euclidean_approximation" && mask_size == "five")
else if (
dist_from == "off_pixels" && dist_type == "euclidean_approximation" && mask_size == "five")
{
distance_transform(view(input), view(output), gil::distance_from::off_pixels,
gil::distance_type::euclidean_approximation, gil::mask_size::five);
distance_transform(
view(input),
view(output),
gil::distance_from::off_pixels,
gil::distance_type::euclidean_approximation,
gil::mask_size::five);
gil::write_view(argv[2], view(output), gil::png_tag{});
}

else if (dist_from == "on_pixels" && dist_type == "precise_euclidean" && mask_size == "not_applicable")
else if (
dist_from == "on_pixels" && dist_type == "precise_euclidean"
&& mask_size == "not_applicable")
{
distance_transform(view(input), view(output), gil::distance_from::on_pixels,
gil::distance_type::precise_euclidean, gil::mask_size::not_applicable);
distance_transform(
view(input),
view(output),
gil::distance_from::on_pixels,
gil::distance_type::precise_euclidean,
gil::mask_size::not_applicable);
gil::write_view(argv[2], view(output), gil::png_tag{});
}

else if (dist_from == "off_pixels" && dist_type == "precise_euclidean" && mask_size == "not_applicable")
else if (
dist_from == "off_pixels" && dist_type == "precise_euclidean"
&& mask_size == "not_applicable")
{
distance_transform(view(input), view(output), gil::distance_from::off_pixels,
gil::distance_type::precise_euclidean, gil::mask_size::not_applicable);
distance_transform(
view(input),
view(output),
gil::distance_from::off_pixels,
gil::distance_type::precise_euclidean,
gil::mask_size::not_applicable);
gil::write_view(argv[2], view(output), gil::png_tag{});
}
else
Expand Down
Loading

0 comments on commit bd907af

Please sign in to comment.