Commit Graph

328 Commits

Author SHA1 Message Date
Olzhas Zhumabek
cf897c5969
Implementation of lanczos down scaling (#309)
* Simple implementation of lanczos scaling

* Simple implementation of lanczos scaling

* Refactor lanczos into separate header

This commit moves the algorithm
into its own header. It also provides
templated interface now, utilizing
a little bit of decltype and declval
to resolve types for lambdas and stuff

* Zero pixel at start of lanczos_at

This commit fixes a possible bug and
fixes some style incosistencies

* Improve documentation for Lanczos

This commit adds documentation which
describes when to use the algorithm,
a brief description of how it is
supposed to work, and some caution
on the quality of the output

* Address style issues and fix warnings

This commit fixes a style issue realted
to namespace declaration and
fixes a warning in added zeroing of
a pixel at start of lanczos

* text-realign function arguments

* fix formatting issues

* Implement handful of sanity tests

This commit introduces a couple of
sanity tests such as black image
scaling to black image, and lanczos
response being 0 at x = 0

* bracket on newline for for loops

* add lanczos scaling to tests

* more precision in lanczos calculation

This commit migrates integral values
to double precision and uses PI
provided by boost.Math. These changes
solve downscaled image being darker

* Simple implementation of lanczos scaling

* Refactor lanczos into separate header

This commit moves the algorithm
into its own header. It also provides
templated interface now, utilizing
a little bit of decltype and declval
to resolve types for lambdas and stuff

* Zero pixel at start of lanczos_at

This commit fixes a possible bug and
fixes some style incosistencies

* Improve documentation for Lanczos

This commit adds documentation which
describes when to use the algorithm,
a brief description of how it is
supposed to work, and some caution
on the quality of the output

* Address style issues and fix warnings

This commit fixes a style issue realted
to namespace declaration and
fixes a warning in added zeroing of
a pixel at start of lanczos

* text-realign function arguments

* fix formatting issues

* Implement handful of sanity tests

This commit introduces a couple of
sanity tests such as black image
scaling to black image, and lanczos
response being 0 at x = 0

* bracket on newline for for loops

* add lanczos scaling to tests

* more precision in lanczos calculation

This commit migrates integral values
to double precision and uses PI
provided by boost.Math. These changes
solve downscaled image being darker

* Add Jamfile for ip test directory

Add Jamfile for image_processing
test directory and build-project
from outer test directory

* Add IP test directory to ci build

This commit adds a line at the end
of .ci/build-and-test.sh to include
image processing tests in CI builds

* Remove redundant lines from Jamfile

Simplify Jamfile at
test/image_processing

* Rewrite range condition

x > -a && x < a exchange with
-a < x && x < a in lanczos

* Add newline at the end of files

* Add math and lexical_cast to get-boost

As math and lexical_cast are used
in lanczos scaling, both were added
to get-boost

* Revert "Add newline at the end of files"

Since Boost.Math.Constants is
overengineered for use case by
requiring Boost.lexical_cast or
a global define, it is removed

This reverts commit 0743ab072ff3455421853697f7f46aee7d22382c.

* Define pi and use in lanczos

Value of pi is moved out into detail
and used by lanczos

* Move image_processing to test/core

* formatting fixes

* Adjust CMakeLists for moved IP tests

This commit removes image_processing as
subdirectory from test/ and adds to
test/core's CMakeLists

* Remove unused from get-boost

Since lanczos scaling no longer uses
boost.math.constants, lexical_cast
has been removed as well

* Downgrade math to transitive dep

This is a stray change left from
my incorrect resetting of the HEAD
on lanczos branch

* Remove unnecessary includes

io includes are not used in lanczos
scaling test, and they break build

* Fix ambiguous overload issue for min

Since width() and height()  now return
std::ptrdiff_t, call to std::min needs
a cast. There was also shadowing of
pi declared in detail/math.hpp,
which is also fixed

* Apply mloskot's patch

The patch provided by Mateusz changes
all usages of long int into ptrdiff_t,
which is returned by width() and
height() functions of image_view

* Apply .editorconfig rules

This commit is a simple reformat of
affected files

* Use aliases x_coord_t and y_coord_t

The change converges integer handling
in arguments, using view' type aliases.
View arguments have to come first to
avoid non-deduced context problem.
Also replaced long int with ptrdiff_t
in lanczos, in numeric.hpp file

* Apply alias usage for rest of the code

Some places with ptrdiff_t were
left out from previous commit, so they
are changed in this one. Plus a fix for
max call being ambiguous.

* Replace all literals with casted vars

This commit takes extreme stance of
never using an integer literal due to
problems in ambiguity of deduction of
min and max functions

* Fix unenclosed foreach

During rebase of gsoc2019 onto develop,
I didn't enclose first foreach with
matching endforeach, hence tests failed
2019-06-23 13:14:23 +03:00
MIRAL SHAH
716fe9ad8c Implement algorithms for binary and binary inverse thresholding (#313)
Add public functions threshold_binary and threshold_truncate.
Add tests and example.
Closes #310
2019-06-18 21:42:43 +02:00
Mateusz Łoskot
3e043a41a2
Define WIN32 macro to make LibRaw happy (#303)
Apparently, for some not entirely clear reasons, possibly historical
use of `.vcproj`, LibRaw uses (not defines!) `WIN32` macro, instead of
C standard compliant `_WIN32` common to majority of compilers on Windows.

This patch is required if GIL IO is used with Boost.Build or custom
Makefile, without this custom `WIN32` hand-rolled in build configuration.

Hopefully, LibRaw may accept some clean up for this in near future:
https://github.com/LibRaw/LibRaw/pull/206
2019-05-31 22:41:22 +02:00
Mateusz Łoskot
d36a2c8edf
Add SFINAE-friendly version of std::common_type (#298)
It should help to improve uses of SFINAE like the one from #295
and fix #289 for MSVC 14.0 (VS2015) for good.

Copied from Boost.Hana.
2019-05-02 14:38:21 +02:00
Mateusz Łoskot
e0c27a337a
Disable free operator* of point<T> for non-arithmetic operand (#295)
Add Boost.Build-only test to verify compilation failure.

Fixes #289 as much better solution than #294 workaround.
Closes #294
2019-04-29 20:59:51 +02:00
Mateusz Łoskot
c9ccc83551
Officially drop support for GCC <= 4.8 (#296)
Although GCC 4.8 is labelled as C++11 compatible, the reasons are:

* GCC 4.8 is buggy enough to prevent reasonable use of Boost.MP11
* GCC 4.8 is dying

Closes #282
2019-04-28 15:50:56 +02:00
Mateusz Łoskot
3747846acb
GCC 4.8/4.9 define std::is_trivially_destructible (#292) 2019-04-20 14:33:50 +02:00
Mateusz Łoskot
a123653127
Add internal version of std::is_trivially_default_constructible (#291)
Add similar for std::is_trivially_destructible.
This should help to restore support for GCC<5 (credit to @pdimov).

Partially fixes #282
2019-04-18 17:30:49 +02:00
Mateusz Łoskot
5af7a959f8
Restore value_type access from std::iterator_traits
Lost in 5611bd5807 from #274 merge
Credit for catching this goes to @stefanseefeld
2019-04-18 12:30:37 +02:00
Mateusz Łoskot
555c4cc7b5
Fix UB due is_trivially_default_constructible specializations (#284)
C++11 / 20.11.2 Header <type_traits> synopsis
   1 The behavior of a program that adds specializations for any
   of the class templates defined in this subclause is undefined
   unless otherwise specified.

The specializations are not used anywhere, so they are safe to remove
without providing a replacement.

Fixes #283
2019-04-15 23:00:16 +02:00
Mateusz Łoskot
5611bd5807
Replace Boost.MPL with Boost.MP11 (#274)
Use type traits and features of C++11, then use Boost.MP11.
Remove unused and unnecessary metafunctions in `detail` namespace.
Remove explicit access to ::type as no longer necessary with MP11.
Clean up and reformat code according to the current guidelines.

Legacy tests have been updated where necessary to accommodate
switch to MP11.

Replace std::is_integral with gil::detail::is_channel_integral
Replacing boost::is_integral with std::is_integral is C++ UB:

    C++11 / 20.11.2 Header <type_traits> synopsis
    1 The behavior of a program that adds specializations for any
    of the class templates defined in this subclause is undefined
    unless otherwise specified.


Implements also proposal in #93
Closes #229
2019-04-14 22:13:45 +02:00
Mateusz Łoskot
c6c5336cc0
Value-initialize channel and pixel value members (#273)
Add tests to ensure member values of channel and pixel classes are
determined, zero-initialized.
Fixes #270

Tidy up formatting.
2019-04-01 17:19:22 +01:00
Mateusz Łoskot
89ce280c6f
Fix warning about unused variable 2019-03-29 23:33:21 +01:00
Mateusz Łoskot
fc70dafa9e
Fix warning: unused variable 'src_p' [-Wunused-variable] 2019-03-21 21:14:10 +01:00
Mateusz Łoskot
d9e7ff588f
Comment unused parameter of channel_premultiply call operator (#264)
Fix warning: unused parameter `c` [-Wunused-parameter].
Clean up typographic quotation marks.
2019-03-21 18:54:06 +01:00
Mateusz Łoskot
5427e60dcc
Add missing #include <sstream> 2019-03-21 18:41:24 +01:00
Nikita Kniazev
33d4ac05ae Use just ::value where is possible (#262)
The ::value member is common convention of all MPL and TypeTraits metafunctions.

Fixes VS2015 failures (#261)
2019-03-19 20:34:11 +01:00
Mateusz Łoskot
af8dcac47e
Add missing #include <boost/mpl/and.hpp> 2019-03-18 22:11:05 +01:00
Mateusz Łoskot
f81952e115
Fix gray_t and gray_color_t mismatch in default_color_converter_impl (#250)
Add number of static assertions to test indices used to access
elements of color mapping sequence are in range.

Fixes #249
2019-03-04 17:33:03 +01:00
Mateusz Łoskot
52ed09f0bc
Add missing #include <boost/config.hpp> 2019-02-21 00:41:30 +01:00
Mateusz Łoskot
21139476e5
Include all public headers in gil.hpp (#237) 2019-02-20 19:02:58 +00:00
Mateusz Łoskot
22baac5367
Add dynamic_step.hpp for base templates declaration (#238)
Replace all scattered around forward declarations of
`dynamic_{x,y,xy}_step_type` with this common header,
where the templates are also documented.

Refine documentation of `transposed_type` - this is kept
in locator.hpp as it is not just related to the dynamic step.
2019-02-19 16:34:20 +00:00
Mateusz Łoskot
b78a762fdd
Fix clang and GCC warning on unsequenced access 2019-02-06 22:26:09 +01:00
Mateusz Łoskot
545bd85677
Ignore warning -Wunused-but-set-variable in concepts 2019-02-06 22:24:11 +01:00
Mateusz Łoskot
f4133c8068
Ignore warning -Wuninitialized in concepts 2019-02-06 22:23:38 +01:00
Mateusz Łoskot
db28b19959
Ignore GCC warning -Wunused-but-set-variable 2019-02-06 22:02:08 +01:00
Mateusz Łoskot
6763a8cd98
Build core tests with BOOST_GIL_USE_CONCEPT_CHECK defined (#230)
when building tests with both, Boost.Build and CMake.

Disable concepts check for tests where range (e.g. std::array)
used as image pixel - not fully specialised as acceptable pixel type.

Ignore warnings from boost/concept_check.hpp
Rationalise uses of GCC and clang diagnostic push/pop,
with adding constraint for GCC 4.6+ as minimum version
where the pragma was introduced.

Closes #228
2019-02-05 22:19:35 +00:00
Samuel Debionne
2308a1a85a Use Boost.Variant instead of GIL's own variant implementation (#231)
Adds support C++11 decltype(auto)

Fixes #131
2019-02-05 00:47:08 +00:00
Mateusz Łoskot
cd2ad3b75b
Replace boost::is_pointer with std::is_pointer in static_assert 2019-01-27 23:37:39 +01:00
Mateusz Łoskot
12e68d4d2c
Tidy up uses of Boost.Filesystem in IO (#226)
Remove unused #include-s and leave io/test/paths.hpp as sole
place of #include <boost/filesystem.hpp> for IO tests.
Silence annoying -Wconversion or -Wshorten-64-to-32 warning
from Boost.SmartPtr via Boost.Filesystem:
  conversion to 'std::atomic<int>::__integral_type {aka int}'
    from 'long int' may alter its value
2019-01-27 22:11:03 +00:00
Mateusz Łoskot
45ca507ca3
Replace some uses of boost::is_same with std::is_same (#225)
Those are places boost::is_same can be replaced in non-intrusive way.
Remaining are types derived from boost::is_same, where the replacing
would affect all their uses - effectively switching from boost::true_/false_ types
to std::true_type and std::false_type.
Such change needs to come along with Boost.MPL to MP11 migration.
2019-01-27 10:54:05 +00:00
Mateusz Loskot
83a735a09c
Fix GCC -Wunused-parameter warnings (#221) 2019-01-20 09:37:31 +01:00
Mateusz Loskot
54f1817e99
Replace boost::enable_if with std::enable_if (#215)
Replace boost::disable_if with std::enable_if and negated condition.
Update mpl::and_ expressions to yield value convertible to bool, instead of type.
Format std::enable_if expressions and nearby code they are nested in.
Replace complex template-based leading return type of functions
  with auto and trailing return type for greater readability.
Replace some Boost type traits with <type_traits> features.
Replace 0 with nullptr where modernize-use-nullptr missed (updates #180).

Notice, boost::lazy_enable_if in extension/toolbox has not been replaced,
but it seems it could have been - need verification with number of compilers.
2019-01-18 09:31:58 +01:00
Mateusz Loskot
40e158b26b
Fix warning: suggest parentheses around assignment used as truth value (#214)
Tidy up around the fix.
2019-01-16 12:29:36 +01:00
Mateusz Łoskot
e3ef52bb80
Correct order of constexpr and type specifier
The constexpr belongs to the declaration specifiers (like static) and
not just the type specifiers (like cv-qualifiers), so it binds to
the declaration (like static), not the type (like const).

Refines #211
2019-01-15 00:42:20 +01:00
Mateusz Loskot
da6acc6cca
Remove uses of Boost.Function (#213)
Remove uses of boost::mem_fn (missing from Bind.Bind removal in #212).
2019-01-13 06:32:20 +01:00
Mateusz Loskot
78b7dcfeca
Remove uses of Boost.Bind and Boost.Lambda (#212)
Replace with std::bind and C++11 lambda functions.
The two Boost libraries should no longer be a direct
dependency of Boost.GIL.
2019-01-13 02:03:25 +01:00
Mateusz Loskot
a2b2ca977a
Replace BOOST_STATIC_CONSTANT with constexpr (#211)
Tidy up formatting of refactored parts of code.
2019-01-12 23:57:35 +01:00
Mateusz Loskot
f578a8be9c
Replace assert() macro with BOOST_ASSERT() macro (#208)
Add #include <boost/assert.hpp> where necessary.
Apply minor clean-up near the macro replacements.

Closes #96
2019-01-12 10:21:01 +01:00
Mateusz Loskot
6e3ccc00b1
Remove dependency on Boost.StaticAssert (#207)
Replaced BOOST_STATIC_ASSERT with C++11 binary static_assert,
with empty message.

In future, this should make it possible to automatically refactor
into C++17 unary static_assert using clang-tidy and
its modernize-unary-static-assert check.

Closes #106
2019-01-11 10:33:09 +01:00
Mateusz Loskot
a4185bcea2
Remove Boost.Bind from extension/dynamic_image (#202)
Replace boost::bind with std::bind from C++11.
Move template parameter comments to Doxygen \tparam-s,
so they are captured as proper documentation.
Tidy up code formatting.
2018-12-20 16:51:20 +01:00
Mateusz Loskot
2233fb166a
Remove Boost.Bind from io (#203)
Replace Boost.MPL boolean constants with C++11 equivalents.
Replace `throw()` with `noexcept`.
Replace empty constructor body with `default`.
Rename private class members to avoid leading underscore
(too easy to confuse as reserved identifier).
Tidy up with compact formatting.
2018-12-18 18:50:57 +01:00
Mateusz Loskot
06d1dbb066
Fix hard-wired use of Boost.Array static_size member (#200)
Fixes #142
2018-12-18 11:57:32 +01:00
Mateusz Łoskot
149b4c8605
Remove reference instantiation
Introduced in recent SHA-1 c065671e01
2018-12-17 23:47:07 +01:00
Mateusz Łoskot
c9d5ce6d43
Replace typedef with using in comments [ci skip]
Left-overs from previous modernize-use-using refactoring.
2018-12-17 19:35:13 +01:00
Mateusz Loskot
abfa519b00
Apply clang-tidy modernize-use-using to extension/toolbox (#198)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix` against
single TU with `#include <boost/gil/extension/toolbox/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the extension/toolbox/*.hpp should return no matches.
2018-12-17 19:25:19 +01:00
Mateusz Łoskot
c065671e01
Ignore warning: unused type alias [-Wunused-local-typedef]
Typically, in concepts, unused aliases are nothing uncommon.

Add TODO about some member aliaseis that perhaps should be concept-checked.
2018-12-17 14:33:46 +01:00
Mateusz Loskot
5340a352c4
Apply clang-tidy modernize-use-using to extension/io (#197)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix` against
single TU with `#include <boost/gil/extension/io/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the extension/io/*.hpp should return no matches.
2018-12-17 01:24:30 +01:00
Mateusz Loskot
fbd056baf0
Apply clang-tidy modernize-use-using to io (#195)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix`
against single TU with `#include <boost/gil/io/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all io/*.hpp should return no matches.
2018-12-17 00:48:58 +01:00
Mateusz Loskot
a33523f868
Apply clang-tidy modernize-use-using to extension/numeric (#196)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix` against
single TU with `#include <boost/gil/extension/numeric/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the extension/numeric/*.hpp should return no matches,
2018-12-17 00:17:23 +01:00
Mateusz Loskot
0e11759d4e
Apply clang-tidy modernize-use-using to extension/dynamic_image (#193)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix`
against single TU with `#include <boost/gil/concepts/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the extension/dynamic_image/*.hpp should return 5 matches,
in definitions of macros (TODO).
2018-12-16 01:25:12 +01:00
Mateusz Loskot
46939c7b29
Apply clang-tidy modernize-use-using to core headers (#192)
Run clang-tidy 7.0 with `-checks='-*,modernize-use-using' -fix`
against single TU with `#include <boost/gil/concepts/*.hpp>`.

Manually refactor numerous typedef-s
- where missed by modernize-use-using check, not uncommon
- in code snippets in comments

Outcome is that searching for lower-case whole word typedef
in all the top-level core headers should return no matches.
2018-12-15 19:10:30 +01:00
Mateusz Łoskot
4616dc1bdc [numeric] Remove unused type alias from detail::correlate_rows_imp
Fix warning: typedef kernel_type locally defined but not used
[-Wunused-local-typedefs]
2018-12-15 01:03:43 +01:00
Samuel Debionne
6b0b66c0f2 Remove deprecated unary/binary_function (#191)
std::unary_function and std::binary_function are deprecated in C++11
and removed in C++17.
2018-12-14 22:58:55 +01:00
Mateusz Loskot
230158bd66
Fix const on return type not applied to pointee type of typedef (#190)
Replace png_structp and png_infop aliases with regular pointers to
to prevent type qualifiers ignored on function return type.
2018-12-14 08:12:45 +01:00
Mateusz Loskot
2250b7159c
Fix conflicting definitions from io/dynamic_io_new.hpp and toolbox/dynamic_images.hpp (#185)
The problem appears to be due to the same definitions copied from one
part of the library to the other.
The definitions have been shuffled to fix the compilation,
but purely based on searching the code for what is used where,
thus without confidence where those belong by author's intention.

Fixes #183
2018-12-12 17:58:57 +01:00
Mateusz Loskot
e0288ece9e
Apply clang-tidy modernize-use-nullptr (#180)
Used clang-tidy 7.0 with the command:

  run-clang-tidy.py \
      -header-filter='boost\/gil\/.*' \
      -checks='-*,modernize-use-nullptr' -fix

Update CONTRIBUTING.md on how to generate compile command
database and run clang-tidy.
2018-12-10 09:58:37 +01:00
Mateusz Loskot
682a7264da
Include missing headers across boost/gil/extension/io (#179)
Missing headers revealed by compilation of self-contained header tests.
2018-12-09 23:40:38 +01:00
Mateusz Loskot
032a4786bb
Remove unnecessary extern C around libraw.h include (#178)
Since libraw is C++ library, not C, it is always built as C++ library.
2018-12-09 21:38:59 +01:00
Mateusz Loskot
057a02ad0a
Replace writer<Device,jpeg_tag> where writer_backend<Device,jpeg_tag> expected (#177)
The reference to `writer<Device,jpeg_tag>` is clearly incorrect:
- writer has no members `init_device`, `empty_buffer`, `closed_buffer`
- if use of writer was correct there, it would require
  `#include <boost/gil/extension/io/jpeg/detail/writer.hpp>`, but that
  would impose cyclic-dependency between writer.hpp and writer_backend.hpp.
2018-12-09 15:45:51 +01:00
Mateusz Łoskot
8c26143574
Add missing #include <boost/gil/extension/io/*/tags.hpp>
Fixes compilation error about undeclared *_tag.
2018-12-08 22:20:58 +01:00
Mateusz Łoskot
a0b5767392 Add missing #include <boost/gil/extension/io/raw/tags.hpp>
Fixes compilation error about undeclared raw_tag.
2018-12-08 12:10:59 +01:00
Mateusz Loskot
63e2a1a98a
Fix compile-time bugs subchroma_image.hpp definions (#164)
Add missing typename in mpl::if_ condition result.
Restore BOOST_CXX14_CONSTEXPR in boost::algorithm::clamp function
- apparently, GCC 5.5.0 does not compile it with C++11 constexpr.
Still not adding subchroma_image.cpp to toolbox test target
input sources due to run-time failure.

Depends on #176
2018-12-07 23:55:13 +01:00
Mateusz Loskot
443eaa5fae
Fix compilation of subchroma_image.hpp as self-contained headers (#176)
Rename `Scaling_Factors` to lower-case, as well as its template parameters.
Move `scaling_factors` to namespace `detail` and before it is use.
Fix access to `scaling_factors` members in derived classes.
Add missing `typename`.
Remove superfluous thus incorrect `typename`.
Remove `subchroma_image_view` implicit friends with self
- Fixes template parameter aliasing for Locator and Factors.

Subset of fixes from pending PR #164
2018-12-07 16:00:17 +01:00
Mateusz Loskot
9e9ed7c239
Add missing #include-s to ensure self-contained headers (#175) 2018-12-07 09:50:52 +01:00
Mateusz Loskot
40241a6efb
Reformat boost/gil/concepts/*.hpp to limit line length to 90 characters (#173)
Replace `typedef` with using declaration.
Replace complex return type declared for functions with trailing return type and `auto`.
Format complex metaprogramming constructs in clear and readable way.
Remove superfluous `public` access specifier from `struct` inheritance.
Rename ambiguous type aliases.
Make template parameters
- upper-case (if initials e.g. `CS`)
- camel-case if multi-word (e.g. `ColorSpace`).
2018-12-06 19:11:58 +01:00
Mateusz Loskot
66bb07d02b
Trim trailing whitespaces in all source code files (#171)
PowerShell script used to perform the trimming:

Get-ChildItem -Recurse -Include @("*.cpp", "*.hpp") |
  ForEach-Object { (Get-Content $_.FullName)
      | Foreach {$_.TrimEnd()} | Set-Content $_.FullName }
2018-12-05 08:51:33 +01:00
Mateusz Loskot
7b5b01ec14
Split single boost/gil/concepts.hpp into boost/gil/concepts/*.hpp (#169) 2018-11-17 23:36:29 +01:00
Mateusz Łoskot
28df5bc482
Clean up several warnings about unreferenced formal parameters
Add comment to premultiply.hpp:
- FIXME: Is c input paramater not used intentionally?
2018-10-29 15:26:53 +01:00
Mateusz Loskot
3947b798fb
Remove dependency on boost/algorithm/clamp.hpp (#159)
Copy boost::algorithm::clamp to where it was solely used in Toolbox.
Remove typename where not needed thus not allowed:
- fixes error: expected nested-name-specifier
- GCC and clang issue diagnostics; latest MSVC does not, seems not even
  parsing templates until they are used.
2018-10-29 13:48:15 +01:00
Mateusz Loskot
a1c966dd9b
Fix point<T> divide and multiply to not to hardcode result as point<double> (#157)
The free variants of operator/ and operator* now yield new
type of point<T> with T promoted to type common for both operands.

Add missing member operator*=, for symmetry.
Add template function iround(point<T>) as no-op sink for point
specialisations for T of integer types.
Add explicit casts of arithmetic intermediate results to avoid
compilation warnings.
Replace redundant point<T> construction in return statement with uniform
initialization.
Add static_assert validating range of axis_value integer template parameter.

Update test/point/point.cpp with basic checks of all point<T> members.

Fixes #153
2018-10-24 15:08:39 +02:00
Mateusz Loskot
c1e590591d
Remove dependency on boost/config/no_tr1/cmath.hpp (#162) 2018-10-24 10:53:47 +02:00
Mateusz Loskot
e286137e55
Remove dependency on boost/algorithm/string.hpp as unused (#158) 2018-10-24 09:42:17 +02:00
Mateusz Łoskot
3b8398f17c
Fix version.hpp include guard name [ci skip] 2018-10-22 15:05:21 +02:00
Mateusz Loskot
ce82941fa2
Rename point2<T> to point<T> (#155)
Add point2<T> alias template for backward compatibility with Boost <=1.68.
Replace multiple point_t aliases of point<ptrdiff_t> with single defined
in point.hpp. The point_t is common used to represent dimensions.
Replace many uses of point<ptrdiff_t> with point_t.

Apply reformatting around point2 changes to respect the line length limit.

Follows up discussion in #154
2018-10-19 09:32:23 +02:00
Mateusz Loskot
b4c3a69479
Extract point2<T> from utilities.hpp to point.hpp (#154)
The point belongs to core basic concepts in GIL, not an optional
utility. The tutorial starts with description of point.
Such core concepts are defined in dedicated headers which is quite
a useful convention that also makes the code structure clearer.

Remove from trivial point2 class superfluous empty destructor,
copy constructor, assignment operator.

Clean up point.hpp formatting (eg. respect line length limit).

Co-authored-by: Nikita Kniazev @Kojoley
2018-10-18 21:38:14 +02:00
Mateusz Łoskot
875136885a
Fix conflict with std::fill_n and boost::range::fill_n (Trac 7189)
Add minimal test for the std::fill and boost::array or std::array as
pixel type.
2018-10-12 18:34:28 +02:00
Mateusz Loskot
aa323e1dc6
Merge pull request #146 from mloskot/ml/fix-some-gcc-warnings
Fix some gcc warnings
2018-10-04 20:29:44 +02:00
Mateusz Łoskot
244be70c1d
Add #include directives with missing headers
Make core and io headers self-contained.
Required by test to verify headers are self-contained in #147.
2018-10-03 23:27:57 +02:00
Mateusz Łoskot
ed96c9cdf1
Use GCC pragma to disable -Wconversion and -Wfloat-equal
Fixes warnings where equality or assignment operators
applied to operands of different signedness or float-point.
2018-09-28 23:36:27 +02:00
Mateusz Łoskot
4bd625ff31
Replace unsigned with signed for int as compile-time index 2018-09-28 23:30:35 +02:00
Mateusz Łoskot
32fec9f05b
Refactor library includes to #include <boost/gil/...>
Group include directives, sort within group:
* In headers of GIL core and extensions:
  1. boost/gil/extension/*
  2. boost/gil/*
  3. boost/*
  4. C++ standard library headers
* In programs:
  1. boost/gil/*
  2. boost/*
  3. C++ standard library headers
  4. "xxx.hpp" for local headers
Add basic guidelines to CONTRIBUTING.md.
Add/Remove #include <boost/config.hpp> or std headers un/necessary.
Rename gil_concept.hpp to concepts.hpp.
Remove gil_all.hpp - we already have all-in-one boost/gil.hpp.
Tidy up and unify copyright and license header.
Tidy up formatting and excessive whitespaces in some comments.
Remove Doxygen block with file description, author, date, etc.
Remove dead or commented pragmas and directives.
Trim trailing whitespaces.
2018-09-28 16:26:34 +02:00
Mateusz Łoskot
c3bb2e1a94
Remove gil_config.hpp as unnecessary
Move BOOST_GIL_CONFIG_HAS_UNALIGNED_ACCESS define setting and
documentation comment to channel.hpp where solely used.

Trim trailing whitespaces.
2018-09-27 15:38:40 +02:00
Mateusz Loskot
7f0c223ddc
Merge pull request #128 from mloskot/ml/trac-ticket-2979
Correct description of image_is_basic metafunction (Trac 2979)
2018-09-24 20:29:36 +02:00
Mateusz Loskot
7a5bd6986e
Merge pull request #139 from mloskot/ml/trac-ticket-7092
Remove re-assignment of functor from for_each_pixel (Trac 7092)
2018-09-23 21:26:07 +02:00
Mateusz Loskot
dd862cefb9
Merge pull request #138 from mloskot/ml/fix-toolbox-get_num_bits-as-unsigned
Base get_num_bits metafunction for T on mpl::size_t instead of mpl::int_
2018-09-23 21:08:28 +02:00
Mateusz Loskot
11a84bf05c
Merge pull request #134 from mloskot/ml/fix-warning-float-equal
Fix warning: comparing floating point with == is unsafe
2018-09-23 21:07:23 +02:00
Mateusz Łoskot
f613cc4088
Remove re-assignment of functor from for_each_pixel (Trac 7092)
The assignment was superfluous in general case and incorrect in specific
case when the algorithm was given a lambda expression.
The copy assignment operator is defined as deleted for lambda
expressions.

Add minimal test for for_each_pixel algorithm to verify it compiles with
lambda expression.
2018-09-21 18:50:40 +02:00
Mateusz Łoskot
79f01a4d35 Fix warning: comparing floating point with == is unsafe
Trick compiler by using >= instead of ==,
where LHS color is guaranteed to never be greater than RHS color value.
2018-09-19 18:58:29 +02:00
Mateusz Łoskot
5d189679fb Base get_num_bits metafunction for T on mpl::size_t instead of mpl::int_
Previously used mpl::int_ assumes signed integer, while sizeof(T) is
unsigned and compiler issues warning.
2018-09-19 18:58:06 +02:00
Mateusz Łoskot
18d5ecb7a8 Rename JPEG-s reader_backend::buffer member array to buffer_
The previous name is too generic and prone to variable shadowing,
causing compilation warnings (eg. vector named buffer in JPEG-s
reader::read_rows method).
2018-09-19 18:53:52 +02:00
Mateusz Łoskot
b1eaa7ea90 Update image_view to model Collection concept (Trac 2222)
* Applies patch from John Femiani submitted via Trac
  https://svn.boost.org/trac10/ticket/2222 description:
  It would be convenient if GIL views modeled ReversibleCollection concept.
  In fact they almost do already. Without modeling this concept, it is
  hard to use an image view with boost::range algorithms.
* Add related image_view concepts for Collection, ForwardCollection,
  ReversibleCollection.
* Add tests for the new concepts.
* Add run-time tests for the new image_view methods.
2018-08-29 22:10:18 +02:00
Mateusz Loskot
ee4d239513
Merge pull request #132 from mloskot/ml/fix-warning-unused-variable
Fix warning about assigned but unused variable num_elements
2018-08-27 09:12:06 +02:00
Mateusz Łoskot
871b7b6897 Fix warning about assigned but unused variable num_elements 2018-08-25 22:54:29 +02:00
Mateusz Łoskot
4500543a74 Add missing template keyword prior to dependent name axis_iterator (Trac 8896)
* Apply patch from https://svn.boost.org/trac10/ticket/8896
* Add compile-time test of RandomAccessNDImageViewConcept
  * Confirms the reported failure (tested with GCC 7.3 and clang 5.0)
  * Verifies correctness of the patch
2018-08-23 16:05:38 +02:00
Mateusz Łoskot
cff6966020 Correct description of image_is_basic metafunction (Trac 2979) [ci skip]
https://svn.boost.org/trac10/ticket/2979 description:

The description of the metafunction boost::gil::image_is_basic says that
it will return mpl::true_ if the image uses a basic view and
std::allocator<unsigned char>, however the implementation returns true
for any kind images that use any kind of allocator.
2018-08-23 11:38:18 +02:00
Mikhail Gorbushin
eebe183375 remove std::bind2nd 2018-08-21 09:40:55 -04:00
Stefan Seefeld
56c2389500 Fix (some) warnings. 2018-07-29 13:50:25 -04:00
Jan Beich
48643aa038 Don't use non-standard header for alloca()
In file included from /usr/local/include/boost/gil/extension/io/png/read.hpp:29:
In file included from /usr/local/include/boost/gil/io/get_reader.hpp:22:
In file included from /usr/local/include/boost/gil/io/get_read_device.hpp:26:
In file included from /usr/local/include/boost/gil/io/path_spec.hpp:23:
/usr/include/malloc.h:3:2: error: "<malloc.h> has been replaced by <stdlib.h>"
2018-07-20 14:17:23 +00:00
chhenning
e4af4fc2d6
Merge pull request #118 from adrianbroher/fix-png-grayalpha-load
Fix png grayalpha load
2018-07-18 17:37:49 -04:00