Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add color_spaces_are_compatible requirement as static_assert to thres…
…hold (#329) Since use of `gil_function_requires` check is optional, it can be disabled by not defining `BOOST_GIL_USE_CONCEPT_CHECK`, we need a mandatory form of the check. Add compile-time test verifying the static assertion. Closes #323
- Loading branch information
Showing
3 changed files
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
test/core/image_processing/threshold_color_spaces_not_compatible_fail.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// Copyright 2019 Mateusz Loskot <mateusz at loskot dot net> | ||
// | ||
// Distributed under the Boost Software License, Version 1.0 | ||
// See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt | ||
// | ||
#include <boost/gil/image_processing/threshold.hpp> | ||
|
||
namespace gil = boost::gil; | ||
|
||
int main() | ||
{ | ||
// Source and destination views must have pixels with the same (compatible) color space | ||
{ | ||
gil::rgb8_image_t src; | ||
gil::gray8_image_t dst; | ||
gil::threshold_binary(const_view(src), view(dst), 0, 255); | ||
} | ||
{ | ||
gil::gray8_image_t src; | ||
gil::rgb8_image_t dst; | ||
gil::threshold_binary(const_view(src), view(dst), 0, 255); | ||
} | ||
} |