diff --git a/develop/doc/html/design/basics.html b/develop/doc/html/design/basics.html index 27cc978ec..072da0ab3 100644 --- a/develop/doc/html/design/basics.html +++ b/develop/doc/html/design/basics.html @@ -114,7 +114,7 @@ read the sections in order.

diff --git a/develop/doc/html/design/channel.html b/develop/doc/html/design/channel.html index a5aac8e5d..9141363fc 100644 --- a/develop/doc/html/design/channel.html +++ b/develop/doc/html/design/channel.html @@ -263,7 +263,7 @@ channel-level algorithms that GIL provides:

diff --git a/develop/doc/html/design/color_base.html b/develop/doc/html/design/color_base.html index a51f57d4b..d347d2e7d 100644 --- a/develop/doc/html/design/color_base.html +++ b/develop/doc/html/design/color_base.html @@ -310,7 +310,7 @@ color base require that they all have the same color space.

diff --git a/develop/doc/html/design/color_space.html b/develop/doc/html/design/color_space.html index 84bf9dfb9..4cc02023a 100644 --- a/develop/doc/html/design/color_space.html +++ b/develop/doc/html/design/color_space.html @@ -165,7 +165,7 @@ A color space and its associated mapping are often used together.

diff --git a/develop/doc/html/design/concepts.html b/develop/doc/html/design/concepts.html index 9484c3368..ac6c1c149 100644 --- a/develop/doc/html/design/concepts.html +++ b/develop/doc/html/design/concepts.html @@ -143,7 +143,7 @@ Most of them are defined at the diff --git a/develop/doc/html/design/conclusions.html b/develop/doc/html/design/conclusions.html index b7b0c7a8d..e7e8af579 100644 --- a/develop/doc/html/design/conclusions.html +++ b/develop/doc/html/design/conclusions.html @@ -121,7 +121,7 @@ raw pixel data from another image library.

diff --git a/develop/doc/html/design/dynamic_image.html b/develop/doc/html/design/dynamic_image.html index f78bff383..c6d745982 100644 --- a/develop/doc/html/design/dynamic_image.html +++ b/develop/doc/html/design/dynamic_image.html @@ -274,7 +274,7 @@ uniformly as a collection and store them in the same container.

diff --git a/develop/doc/html/design/examples.html b/develop/doc/html/design/examples.html index 9a8d72118..b61fe0ab7 100644 --- a/develop/doc/html/design/examples.html +++ b/develop/doc/html/design/examples.html @@ -264,7 +264,7 @@ channel depth. They could be either planar or interleaved.

diff --git a/develop/doc/html/design/extending.html b/develop/doc/html/design/extending.html index 7c2f46d2b..296fa9457 100644 --- a/develop/doc/html/design/extending.html +++ b/develop/doc/html/design/extending.html @@ -234,7 +234,7 @@ defines the Mandelbrot set.

diff --git a/develop/doc/html/design/image.html b/develop/doc/html/design/image.html index 6de350ae2..c3f7f04ac 100644 --- a/develop/doc/html/design/image.html +++ b/develop/doc/html/design/image.html @@ -175,7 +175,7 @@ there are no padding bits at the end of rows of packed images.

diff --git a/develop/doc/html/design/image_view.html b/develop/doc/html/design/image_view.html index 1f5ed8f25..89a6fea0b 100644 --- a/develop/doc/html/design/image_view.html +++ b/develop/doc/html/design/image_view.html @@ -487,7 +487,7 @@ development and is not optimized for speed

diff --git a/develop/doc/html/design/index.html b/develop/doc/html/design/index.html index 7e7e80485..bcb2d6021 100644 --- a/develop/doc/html/design/index.html +++ b/develop/doc/html/design/index.html @@ -102,7 +102,7 @@ structure and basic elements of the Generic Image Library (GIL).

diff --git a/develop/doc/html/design/metafunctions.html b/develop/doc/html/design/metafunctions.html index a90e2aa28..f4ba3cc11 100644 --- a/develop/doc/html/design/metafunctions.html +++ b/develop/doc/html/design/metafunctions.html @@ -302,7 +302,7 @@ is basic, but a color converted view or a virtual view is not.

diff --git a/develop/doc/html/design/pixel.html b/develop/doc/html/design/pixel.html index 1c0525457..ee7fa3e53 100644 --- a/develop/doc/html/design/pixel.html +++ b/develop/doc/html/design/pixel.html @@ -348,7 +348,7 @@ different color spaces and channel types:

diff --git a/develop/doc/html/design/pixel_iterator.html b/develop/doc/html/design/pixel_iterator.html index 3c75cb08c..62155aa05 100644 --- a/develop/doc/html/design/pixel_iterator.html +++ b/develop/doc/html/design/pixel_iterator.html @@ -372,7 +372,7 @@ but not MemoryBased diff --git a/develop/doc/html/design/pixel_locator.html b/develop/doc/html/design/pixel_locator.html index bee59b1bf..5611a5c6d 100644 --- a/develop/doc/html/design/pixel_locator.html +++ b/develop/doc/html/design/pixel_locator.html @@ -358,7 +358,7 @@ using the x-iterators directly.

diff --git a/develop/doc/html/design/point.html b/develop/doc/html/design/point.html index 21d113dd8..7cc1d1c04 100644 --- a/develop/doc/html/design/point.html +++ b/develop/doc/html/design/point.html @@ -134,7 +134,7 @@ coordinate type.

diff --git a/develop/doc/html/design/technicalities.html b/develop/doc/html/design/technicalities.html index 1595a8c39..00dfc4b58 100644 --- a/develop/doc/html/design/technicalities.html +++ b/develop/doc/html/design/technicalities.html @@ -159,7 +159,7 @@ suggesting the above solution.

diff --git a/develop/doc/html/genindex.html b/develop/doc/html/genindex.html index ffbfa975f..8c77a4d2e 100644 --- a/develop/doc/html/genindex.html +++ b/develop/doc/html/genindex.html @@ -75,7 +75,7 @@ diff --git a/develop/doc/html/image_processing/affine-region-detectors.html b/develop/doc/html/image_processing/affine-region-detectors.html index e71a544cb..0086f5887 100644 --- a/develop/doc/html/image_processing/affine-region-detectors.html +++ b/develop/doc/html/image_processing/affine-region-detectors.html @@ -162,7 +162,7 @@ detector.” In Alvey vision conference, vol. 15, no. 50, pp. 10-5244. diff --git a/develop/doc/html/image_processing/basics.html b/develop/doc/html/image_processing/basics.html index cc874cdaf..5ef795cea 100644 --- a/develop/doc/html/image_processing/basics.html +++ b/develop/doc/html/image_processing/basics.html @@ -123,7 +123,7 @@ gets sharper depending on it’s sigma value.

diff --git a/develop/doc/html/image_processing/index.html b/develop/doc/html/image_processing/index.html index 03025b5c9..7a45fec16 100644 --- a/develop/doc/html/image_processing/index.html +++ b/develop/doc/html/image_processing/index.html @@ -99,7 +99,7 @@ features, structures and algorithms, for image processing and analysis.

diff --git a/develop/doc/html/image_processing/overview.html b/develop/doc/html/image_processing/overview.html index 90d61e866..36e077e0d 100644 --- a/develop/doc/html/image_processing/overview.html +++ b/develop/doc/html/image_processing/overview.html @@ -88,7 +88,7 @@ projects run in frame of the Google Summer of Code 2019:

diff --git a/develop/doc/html/index.html b/develop/doc/html/index.html index b5b9367cf..c5696bc45 100644 --- a/develop/doc/html/index.html +++ b/develop/doc/html/index.html @@ -178,7 +178,7 @@ Blurring images (requires the optional Numeric extension)

diff --git a/develop/doc/html/installation.html b/develop/doc/html/installation.html index 4d3c48668..9d1c62abb 100644 --- a/develop/doc/html/installation.html +++ b/develop/doc/html/installation.html @@ -90,7 +90,7 @@ where to find Boost and GIL headers should be sufficient for most projects.

diff --git a/develop/doc/html/io.html b/develop/doc/html/io.html index bbb7d8a43..d719c29e4 100644 --- a/develop/doc/html/io.html +++ b/develop/doc/html/io.html @@ -736,7 +736,7 @@ to enable the tests:

diff --git a/develop/doc/html/naming.html b/develop/doc/html/naming.html index ab86f63d3..deec601f9 100644 --- a/develop/doc/html/naming.html +++ b/develop/doc/html/naming.html @@ -114,7 +114,7 @@ pixel.

diff --git a/develop/doc/html/numeric.html b/develop/doc/html/numeric.html index fd677373e..e787235d3 100644 --- a/develop/doc/html/numeric.html +++ b/develop/doc/html/numeric.html @@ -79,7 +79,7 @@ diff --git a/develop/doc/html/reference/algorithm_8hpp_source.html b/develop/doc/html/reference/algorithm_8hpp_source.html index 388e96007..1ec3c80e0 100644 --- a/develop/doc/html/reference/algorithm_8hpp_source.html +++ b/develop/doc/html/reference/algorithm_8hpp_source.html @@ -74,7 +74,7 @@
BOOST_FORCEINLINE bool equal(boost::gil::iterator_from_2d< Loc1 > first, boost::gil::iterator_from_2d< Loc1 > last, boost::gil::iterator_from_2d< Loc2 > first2)
std::equal(I1,I1,I2) with I1 and I2 being a iterator_from_2d
Definition: algorithm.hpp:1029
A generic binary operation on viewsUse this class as a convenience superclass when defining an operat...
Definition: algorithm.hpp:81
struct to do std::fill
Definition: algorithm.hpp:381
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
BOOST_FORCEINLINE F transform_pixel_positions(const View1 &src1, const View2 &src2, const View3 &dst, F fun)
transform_pixel_positions with two sources
Definition: algorithm.hpp:1116
class for color-converting one pixel to another
Definition: color_convert.hpp:325
Returns the number of channels of a pixel-based GIL construct.
Definition: locator.hpp:38
diff --git a/develop/doc/html/reference/any__image__view_8hpp_source.html b/develop/doc/html/reference/any__image__view_8hpp_source.html index ef0f4ff69..a80f822e7 100644 --- a/develop/doc/html/reference/any__image__view_8hpp_source.html +++ b/develop/doc/html/reference/any__image__view_8hpp_source.html @@ -58,7 +58,7 @@
Returns the type of a view that has a dynamic step along both X and Y.
Definition: dynamic_step.hpp:27
Base template for types that model HasDynamicYStepTypeConcept.
Definition: dynamic_step.hpp:21
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:74
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
Returns an integral constant type specifying the number of elements in a color base.
Definition: color_base_algorithm.hpp:42
Returns the number of channels of a pixel-based GIL construct.
Definition: locator.hpp:38
diff --git a/develop/doc/html/reference/classboost_1_1gil_1_1image-members.html b/develop/doc/html/reference/classboost_1_1gil_1_1image-members.html index f196964ed..f06541955 100644 --- a/develop/doc/html/reference/classboost_1_1gil_1_1image-members.html +++ b/develop/doc/html/reference/classboost_1_1gil_1_1image-members.html @@ -74,26 +74,27 @@ image(x_coord_t width, y_coord_t height, const Pixel &p_in, std::size_t alignment=0, const Alloc alloc_in=Alloc()) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline image(const image &img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline image(const image< P2, IP2, Alloc2 > &img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - image(image &&img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - operator=(const image &img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - operator=(const Img &img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - operator=(image &&img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - point_t typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > - recreate(const point_t &dims, std::size_t alignment=0) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - recreate(x_coord_t width, y_coord_t height, std::size_t alignment=0) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - recreate(const point_t &dims, const Pixel &p_in, std::size_t alignment=0) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - recreate(x_coord_t width, y_coord_t height, const Pixel &p_in, std::size_t alignment=0) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - recreate(const point_t &dims, std::size_t alignment, const Alloc alloc_in) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - recreate(x_coord_t width, y_coord_t height, std::size_t alignment, const Alloc alloc_in) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - recreate(const point_t &dims, const Pixel &p_in, std::size_t alignment, const Alloc alloc_in) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - recreate(x_coord_t width, y_coord_t height, const Pixel &p_in, std::size_t alignment, const Alloc alloc_in) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - swap(image &img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - value_type typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > - view_t typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > - width() const (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline - x_coord_t typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > - y_coord_t typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > - ~image() (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + image(const image_view< Loc > &view, std::size_t alignment=0, const Alloc alloc_in=Alloc()) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + image(image &&img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + operator=(const image &img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + operator=(const Img &img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + operator=(image &&img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + point_t typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > + recreate(const point_t &dims, std::size_t alignment=0) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + recreate(x_coord_t width, y_coord_t height, std::size_t alignment=0) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + recreate(const point_t &dims, const Pixel &p_in, std::size_t alignment=0) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + recreate(x_coord_t width, y_coord_t height, const Pixel &p_in, std::size_t alignment=0) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + recreate(const point_t &dims, std::size_t alignment, const Alloc alloc_in) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + recreate(x_coord_t width, y_coord_t height, std::size_t alignment, const Alloc alloc_in) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + recreate(const point_t &dims, const Pixel &p_in, std::size_t alignment, const Alloc alloc_in) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + recreate(x_coord_t width, y_coord_t height, const Pixel &p_in, std::size_t alignment, const Alloc alloc_in) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + swap(image &img) (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + value_type typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > + view_t typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > + width() const (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline + x_coord_t typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > + y_coord_t typedef (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc > + ~image() (defined in image< Pixel, IsPlanar, Alloc >)image< Pixel, IsPlanar, Alloc >inline diff --git a/develop/doc/html/reference/classboost_1_1gil_1_1image.html b/develop/doc/html/reference/classboost_1_1gil_1_1image.html index 0bb9bfea7..d4a1d0b36 100644 --- a/develop/doc/html/reference/classboost_1_1gil_1_1image.html +++ b/develop/doc/html/reference/classboost_1_1gil_1_1image.html @@ -127,6 +127,10 @@ y_coord_t height () co template<typename P2 , bool IP2, typename Alloc2 >  image (const image< P2, IP2, Alloc2 > &img)   + +template<typename Loc , typename std::enable_if< pixels_are_compatible< typename Loc::value_type, Pixel >::value, int >::type = 0> + image (const image_view< Loc > &view, std::size_t alignment=0, const Alloc alloc_in=Alloc()) +   image (image &&img)   diff --git a/develop/doc/html/reference/concepts_2image_8hpp_source.html b/develop/doc/html/reference/concepts_2image_8hpp_source.html index 90513ce51..e18bb98a0 100644 --- a/develop/doc/html/reference/concepts_2image_8hpp_source.html +++ b/develop/doc/html/reference/concepts_2image_8hpp_source.html @@ -57,8 +57,8 @@
2-dimensional image whose value type models PixelValueConcept
Definition: concepts/image.hpp:144
container interface over image view. Models ImageConcept, PixelBasedConcept
Definition: image.hpp:41
2-dimensional container of values
Definition: concepts/image.hpp:109
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
-
const image< Pixel, IsPlanar, Alloc >::const_view_t const_view(const image< Pixel, IsPlanar, Alloc > &img)
Returns the constant-pixel view of an image.
Definition: image.hpp:542
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
+
const image< Pixel, IsPlanar, Alloc >::const_view_t const_view(const image< Pixel, IsPlanar, Alloc > &img)
Returns the constant-pixel view of an image.
Definition: image.hpp:552
Returns the number of channels of a pixel-based GIL construct.
Definition: locator.hpp:38
diff --git a/develop/doc/html/reference/concepts_2image__view_8hpp_source.html b/develop/doc/html/reference/concepts_2image__view_8hpp_source.html index 82cc9e85b..86fe0639c 100644 --- a/develop/doc/html/reference/concepts_2image__view_8hpp_source.html +++ b/develop/doc/html/reference/concepts_2image__view_8hpp_source.html @@ -64,7 +64,7 @@
GIL&#39;s 2-dimensional view over mutable GIL pixels.
Definition: concepts/image_view.hpp:504
Returns whether two pixels are compatible Pixels are compatible if their channels and color space typ...
Definition: concepts/pixel.hpp:226
GIL&#39;s 2-dimensional view over immutable GIL pixels.
Definition: concepts/image_view.hpp:375
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
2-dimensional view over immutable values
Definition: concepts/image_view.hpp:221
GIL view as ForwardCollection.
Definition: concepts/image_view.hpp:313
Views are compatible if they have the same color spaces and compatible channel values.
Definition: concepts/image_view.hpp:539
diff --git a/develop/doc/html/reference/dynamic__io__new_8hpp_source.html b/develop/doc/html/reference/dynamic__io__new_8hpp_source.html index 25d50f512..cafd7b4cf 100644 --- a/develop/doc/html/reference/dynamic__io__new_8hpp_source.html +++ b/develop/doc/html/reference/dynamic__io__new_8hpp_source.html @@ -53,7 +53,7 @@
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_IO_DYNAMIC_IO_NEW_HPP
9 #define BOOST_GIL_IO_DYNAMIC_IO_NEW_HPP
10 
11 #include <boost/gil/extension/dynamic_image/dynamic_image_all.hpp>
12 
13 #include <boost/gil/detail/mp11.hpp>
14 #include <boost/gil/io/error.hpp>
15 
16 #include <type_traits>
17 
18 namespace boost { namespace gil {
19 
20 namespace detail {
21 
22 template <long N>
23 struct construct_matched_t
24 {
25  template <typename ...Images,typename Pred>
26  static bool apply(any_image<Images...>& img, Pred pred)
27  {
28  if (pred.template apply<mp11::mp_at_c<any_image<Images...>, N-1>>())
29  {
30  using image_t = mp11::mp_at_c<any_image<Images...>, N-1>;
31  image_t x;
32  img = std::move(x);
33  return true;
34  }
35  else
36  return construct_matched_t<N-1>::apply(img, pred);
37  }
38 };
39 template <>
40 struct construct_matched_t<0>
41 {
42  template <typename ...Images,typename Pred>
43  static bool apply(any_image<Images...>&,Pred) { return false; }
44 };
45 
46 // A function object that can be passed to apply_operation.
47 // Given a predicate IsSupported taking a view type and returning an boolean integral coonstant,
48 // calls the apply method of OpClass with the view if the given view IsSupported, or throws an exception otherwise
49 template <typename IsSupported, typename OpClass>
50 class dynamic_io_fnobj
51 {
52 private:
53  OpClass* _op;
54 
55  template <typename View>
56  void apply(View const& view, std::true_type) { _op->apply(view); }
57 
58  template <typename View, typename Info>
59  void apply(View const& view, Info const & info, const std::true_type) { _op->apply(view, info); }
60 
61  template <typename View>
62  void apply(View const& /* view */, std::false_type)
63  {
64  io_error("dynamic_io: unsupported view type for the given file format");
65  }
66 
67  template <typename View, typename Info >
68  void apply(View const& /* view */, Info const& /* info */, const std::false_type)
69  {
70  io_error("dynamic_io: unsupported view type for the given file format");
71  }
72 
73 public:
74  dynamic_io_fnobj(OpClass* op) : _op(op) {}
75 
76  using result_type = void;
77 
78  template <typename View>
79  void operator()(View const& view)
80  {
81  apply(view, typename IsSupported::template apply<View>::type());
82  }
83 
84  template< typename View, typename Info >
85  void operator()(View const& view, Info const& info)
86  {
87  apply(view, info, typename IsSupported::template apply<View>::type());
88  }
89 };
90 
91 } // namespace detail
92 
95 template <typename ...Images,typename Pred>
96 inline bool construct_matched(any_image<Images...>& img, Pred pred)
97 {
98  constexpr auto size = mp11::mp_size<any_image<Images...>>::value;
99  return detail::construct_matched_t<size>::apply(img, pred);
100 }
101 
102 } } // namespace boost::gil
103 
104 #endif
Definition: algorithm.hpp:30
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
diff --git a/develop/doc/html/reference/extension_2dynamic__image_2algorithm_8hpp_source.html b/develop/doc/html/reference/extension_2dynamic__image_2algorithm_8hpp_source.html index 2f61186fa..22b36718f 100644 --- a/develop/doc/html/reference/extension_2dynamic__image_2algorithm_8hpp_source.html +++ b/develop/doc/html/reference/extension_2dynamic__image_2algorithm_8hpp_source.html @@ -59,7 +59,7 @@
void copy_and_convert_pixels(any_image_view< Types1... > const &src, any_image_view< Types2... > const &dst)
Definition: extension/dynamic_image/algorithm.hpp:175
Returns whether two pixels are compatible Pixels are compatible if their channels and color space typ...
Definition: concepts/pixel.hpp:226
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:74
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
void fill_pixels(any_image_view< Types... > const &view, Value const &val)
fill_pixels for any image view. The pixel to fill with must be compatible with the current view ...
Definition: extension/dynamic_image/algorithm.hpp:228
class for color-converting one pixel to another
Definition: color_convert.hpp:325
bool equal_pixels(any_image_view< Types1... > const &src, any_image_view< Types2... > const &dst)
Definition: extension/dynamic_image/algorithm.hpp:68
diff --git a/develop/doc/html/reference/filter_8hpp_source.html b/develop/doc/html/reference/filter_8hpp_source.html index 49db0834c..44b4d8f80 100644 --- a/develop/doc/html/reference/filter_8hpp_source.html +++ b/develop/doc/html/reference/filter_8hpp_source.html @@ -53,7 +53,7 @@
1 //
2 // Copyright 2019 Miral Shah <miralshah2211@gmail.com>
3 //
4 // Use, modification and distribution are subject to the Boost Software License,
5 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 
9 #ifndef BOOST_GIL_IMAGE_PROCESSING_FILTER_HPP
10 #define BOOST_GIL_IMAGE_PROCESSING_FILTER_HPP
11 
12 #include <boost/gil/extension/numeric/algorithm.hpp>
13 #include <boost/gil/extension/numeric/kernel.hpp>
14 #include <boost/gil/extension/numeric/convolve.hpp>
15 
16 #include <boost/gil/image.hpp>
17 #include <boost/gil/image_view.hpp>
18 
19 #include <cstddef>
20 #include <vector>
21 
22 
23 
24 
25 namespace boost { namespace gil {
26 
27 template <typename SrcView, typename DstView>
28 void box_filter(
29  SrcView const& src_view,
30  DstView const& dst_view,
31  std::size_t kernel_size,
32  long int anchor = -1,
33  bool normalize=true,
34  boundary_option option = boundary_option::extend_zero
35 )
36 {
37  gil_function_requires<ImageViewConcept<SrcView>>();
38  gil_function_requires<MutableImageViewConcept<DstView>>();
39  static_assert(color_spaces_are_compatible
40  <
41  typename color_space_type<SrcView>::type,
42  typename color_space_type<DstView>::type
43  >::value, "Source and destination views must have pixels with the same color space");
44 
45  std::vector<float> kernel_values;
46  if (normalize) { kernel_values.resize(kernel_size, 1.0f / float(kernel_size)); }
47  else { kernel_values.resize(kernel_size, 1.0f); }
48 
49  if (anchor == -1) anchor = static_cast<int>(kernel_size / 2);
50  kernel_1d<float> kernel(kernel_values.begin(), kernel_size, anchor);
51 
52  detail::convolve_1d
53  <
54  pixel<float, typename SrcView::value_type::layout_t>
55  >(src_view, kernel, dst_view, option);
56 }
57 
58 template <typename SrcView, typename DstView>
59 void blur(
60  SrcView const& src_view,
61  DstView const& dst_view,
62  std::size_t kernel_size,
63  long int anchor = -1,
64  boundary_option option = boundary_option::extend_zero
65 )
66 {
67  box_filter(src_view, dst_view, kernel_size, anchor, true, option);
68 }
69 
70 
71 namespace detail
72 {
73 template <typename SrcView, typename DstView>
74 void filter_median_impl(SrcView const& src_view, DstView const& dst_view, std::size_t kernel_size)
75 {
76  std::size_t half_kernel_size = kernel_size / 2;
77 
78  // deciding output channel type and creating functor
79  using src_channel_t = typename channel_type<SrcView>::type;
80 
81  std::vector<src_channel_t> values;
82  values.reserve(kernel_size * kernel_size);
83 
84  for (std::ptrdiff_t y = 0; y < src_view.height(); y++)
85  {
86  typename DstView::x_iterator dst_it = dst_view.row_begin(y);
87 
88  for (std::ptrdiff_t x = 0; x < src_view.width(); x++)
89  {
90  auto sub_view = subimage_view(
91  src_view,
92  x - half_kernel_size, y - half_kernel_size,
93  kernel_size,
94  kernel_size
95  );
96  values.assign(sub_view.begin(), sub_view.end());
97 
98  std::nth_element(values.begin(), values.begin() + (values.size() / 2), values.end());
99  dst_it[x] = values[values.size() / 2];
100  }
101  }
102 }
103 } // namespace detail
104 
105 template <typename SrcView, typename DstView>
106 void median_filter(SrcView const& src_view, DstView const& dst_view, std::size_t kernel_size)
107 {
108  static_assert(color_spaces_are_compatible
109  <
110  typename color_space_type<SrcView>::type,
111  typename color_space_type<DstView>::type
112  >::value, "Source and destination views must have pixels with the same color space");
113 
114  std::size_t half_kernel_size = kernel_size / 2;
115  auto extended_img = extend_boundary(
116  src_view,
117  half_kernel_size,
118  boundary_option::extend_constant
119  );
120  auto extended_view = subimage_view(
121  view(extended_img),
122  half_kernel_size,
123  half_kernel_size,
124  src_view.width(),
125  src_view.height()
126  );
127 
128  for (std::size_t channel = 0; channel < extended_view.num_channels(); channel++)
129  {
130  detail::filter_median_impl(
131  nth_channel_view(extended_view, channel),
132  nth_channel_view(dst_view, channel),
133  kernel_size
134  );
135  }
136 }
137 
138 }} //namespace boost::gil
139 
140 #endif // !BOOST_GIL_IMAGE_PROCESSING_FILTER_HPP
Definition: algorithm.hpp:30
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
diff --git a/develop/doc/html/reference/image_8hpp_source.html b/develop/doc/html/reference/image_8hpp_source.html index d284980de..b70e8fe24 100644 --- a/develop/doc/html/reference/image_8hpp_source.html +++ b/develop/doc/html/reference/image_8hpp_source.html @@ -52,9 +52,10 @@
image.hpp
-
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_IMAGE_HPP
9 #define BOOST_GIL_IMAGE_HPP
10 
11 #include <boost/gil/algorithm.hpp>
12 #include <boost/gil/image_view.hpp>
13 #include <boost/gil/metafunctions.hpp>
14 #include <boost/gil/detail/mp11.hpp>
15 
16 #include <boost/assert.hpp>
17 #include <boost/core/exchange.hpp>
18 
19 #include <cstddef>
20 #include <memory>
21 #include <utility>
22 #include <type_traits>
23 
24 namespace boost { namespace gil {
25 
39 
40 template< typename Pixel, bool IsPlanar = false, typename Alloc=std::allocator<unsigned char> >
41 class image
42 {
43 public:
44 #if defined(BOOST_NO_CXX11_ALLOCATOR)
45  using allocator_type = typename Alloc::template rebind<unsigned char>::other;
46 #else
47  using allocator_type = typename std::allocator_traits<Alloc>::template rebind_alloc<unsigned char>;
48 #endif
49  using view_t = typename view_type_from_pixel<Pixel, IsPlanar>::type;
50  using const_view_t = typename view_t::const_t;
51  using point_t = typename view_t::point_t;
52  using coord_t = typename view_t::coord_t;
53  using value_type = typename view_t::value_type;
54  using x_coord_t = coord_t;
55  using y_coord_t = coord_t;
56 
57  const point_t& dimensions() const { return _view.dimensions(); }
58  x_coord_t width() const { return _view.width(); }
59  y_coord_t height() const { return _view.height(); }
60 
61  explicit image(std::size_t alignment=0,
62  const Alloc alloc_in = Alloc()) :
63  _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in), _allocated_bytes( 0 ) {}
64 
65  // Create with dimensions and optional initial value and alignment
66  image(const point_t& dimensions,
67  std::size_t alignment=0,
68  const Alloc alloc_in = Alloc()) : _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in)
69  , _allocated_bytes( 0 )
70  {
71  allocate_and_default_construct(dimensions);
72  }
73 
74  image(x_coord_t width, y_coord_t height,
75  std::size_t alignment=0,
76  const Alloc alloc_in = Alloc()) : _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in)
77  , _allocated_bytes( 0 )
78  {
79  allocate_and_default_construct(point_t(width,height));
80  }
81 
82  image(const point_t& dimensions,
83  const Pixel& p_in,
84  std::size_t alignment = 0,
85  const Alloc alloc_in = Alloc()) : _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in)
86  , _allocated_bytes( 0 )
87  {
88  allocate_and_fill(dimensions, p_in);
89  }
90 
91  image(x_coord_t width, y_coord_t height,
92  const Pixel& p_in,
93  std::size_t alignment = 0,
94  const Alloc alloc_in = Alloc()) : _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in)
95  , _allocated_bytes ( 0 )
96  {
97  allocate_and_fill(point_t(width,height),p_in);
98  }
99 
100  image(const image& img) : _memory(nullptr), _align_in_bytes(img._align_in_bytes), _alloc(img._alloc)
101  , _allocated_bytes( img._allocated_bytes )
102  {
103  allocate_and_copy(img.dimensions(),img._view);
104  }
105 
106  template <typename P2, bool IP2, typename Alloc2>
107  image(const image<P2,IP2,Alloc2>& img) : _memory(nullptr), _align_in_bytes(img._align_in_bytes), _alloc(img._alloc)
108  , _allocated_bytes( img._allocated_bytes )
109  {
110  allocate_and_copy(img.dimensions(),img._view);
111  }
112 
113  // TODO Optimization: use noexcept (requires _view to be nothrow copy constructible)
114  image(image&& img) :
115  _view(img._view),
116  _memory(img._memory),
117  _align_in_bytes(img._align_in_bytes),
118  _alloc(std::move(img._alloc)),
119  _allocated_bytes(img._allocated_bytes)
120  {
121  img._view = view_t();
122  img._memory = nullptr;
123  img._align_in_bytes = 0;
124  img._allocated_bytes = 0;
125  }
126 
127  image& operator=(const image& img)
128  {
129  if (dimensions() == img.dimensions())
130  copy_pixels(img._view,_view);
131  else
132  {
133  image tmp(img);
134  swap(tmp);
135  }
136  return *this;
137  }
138 
139  template <typename Img>
140  image& operator=(const Img& img)
141  {
142  if (dimensions() == img.dimensions())
143  copy_pixels(img._view,_view);
144  else
145  {
146  image tmp(img);
147  swap(tmp);
148  }
149  return *this;
150  }
151 
152  private:
153  using propagate_allocators = std::true_type;
154  using no_propagate_allocators = std::false_type;
155 
156  template <class Alloc2>
157  using choose_pocma = typename std::conditional<
158  // TODO: Use std::allocator_traits<Allocator>::is_always_equal if available
159  std::is_empty<Alloc2>::value,
160  std::true_type,
161  typename std::allocator_traits<Alloc2>::propagate_on_container_move_assignment::type
162  >::type;
163 
164  static void exchange_memory(image& lhs, image& rhs)
165  {
166  lhs._memory = boost::exchange(rhs._memory, nullptr);
167  lhs._align_in_bytes = boost::exchange(rhs._align_in_bytes, 0);
168  lhs._allocated_bytes = boost::exchange(rhs._allocated_bytes, 0);
169  lhs._view = boost::exchange(rhs._view, image::view_t{});
170  };
171 
172  void move_assign(image& img, propagate_allocators) noexcept {
173  // non-sticky allocator, can adopt the memory, fast
174  destruct_pixels(_view);
175  this->deallocate();
176  this->_alloc = img._alloc;
177  exchange_memory(*this, img);
178  }
179 
180  void move_assign(image& img, no_propagate_allocators) {
181  if (_alloc == img._alloc) {
182  // allocator stuck to the rhs, but it's equivalent of ours, we can still adopt the memory
183  destruct_pixels(_view);
184  this->deallocate();
185  exchange_memory(*this, img);
186  } else {
187  // cannot propagate the allocator and cannot adopt the memory
188  if (img._memory)
189  {
190  allocate_and_copy(img.dimensions(), img._view);
191  destruct_pixels(img._view);
192  img.deallocate();
193  img._view = image::view_t{};
194  }
195  else
196  {
197  destruct_pixels(this->_view);
198  this->deallocate();
199  this->_view = view_t{};
200  }
201  }
202  }
203 
204  public:
205  // TODO: Use noexcept(noexcept(move_assign(img, choose_pocma<allocator_type>{})))
206  // But https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869 prevents it (fixed in GCC > 9)
207  image& operator=(image&& img) {
208  if (this != std::addressof(img))
209  // Use rebinded alloc to choose pocma
210  move_assign(img, choose_pocma<allocator_type>{});
211 
212  return *this;
213  }
214 
215  ~image()
216  {
217  destruct_pixels(_view);
218  deallocate();
219  }
220 
221  Alloc& allocator() { return _alloc; }
222  Alloc const& allocator() const { return _alloc; }
223 
224  void swap(image& img) // required by MutableContainerConcept
225  {
226  using std::swap;
227  swap(_align_in_bytes, img._align_in_bytes);
228  swap(_memory, img._memory);
229  swap(_view, img._view);
230  swap(_alloc, img._alloc);
231  swap(_allocated_bytes, img._allocated_bytes );
232  }
233 
235  // recreate
237 
238  // without Allocator
239  void recreate(const point_t& dims, std::size_t alignment = 0)
240  {
241  if (dims == _view.dimensions() && _align_in_bytes == alignment)
242  return;
243 
244  _align_in_bytes = alignment;
245 
246  if (_allocated_bytes >= total_allocated_size_in_bytes(dims))
247  {
248  destruct_pixels(_view);
249  create_view(dims, std::integral_constant<bool, IsPlanar>());
251  }
252  else
253  {
254  image tmp(dims, alignment);
255  swap(tmp);
256  }
257  }
258 
259  void recreate(x_coord_t width, y_coord_t height, std::size_t alignment = 0)
260  {
261  recreate(point_t(width, height), alignment);
262  }
263 
264  void recreate(const point_t& dims, const Pixel& p_in, std::size_t alignment = 0)
265  {
266  if (dims == _view.dimensions() && _align_in_bytes == alignment)
267  return;
268 
269  _align_in_bytes = alignment;
270 
271  if (_allocated_bytes >= total_allocated_size_in_bytes(dims))
272  {
273  destruct_pixels(_view);
274  create_view(dims, typename std::integral_constant<bool, IsPlanar>());
275  uninitialized_fill_pixels(_view, p_in);
276  }
277  else
278  {
279  image tmp(dims, p_in, alignment);
280  swap(tmp);
281  }
282  }
283 
284  void recreate( x_coord_t width, y_coord_t height, const Pixel& p_in, std::size_t alignment = 0 )
285  {
286  recreate( point_t( width, height ), p_in, alignment );
287  }
288 
289  // with Allocator
290  void recreate(const point_t& dims, std::size_t alignment, const Alloc alloc_in)
291  {
292  if (dims == _view.dimensions() && _align_in_bytes == alignment && alloc_in == _alloc)
293  return;
294 
295  _align_in_bytes = alignment;
296 
297  if (_allocated_bytes >= total_allocated_size_in_bytes(dims))
298  {
299  destruct_pixels(_view);
300  create_view(dims, std::integral_constant<bool, IsPlanar>());
302  }
303  else
304  {
305  image tmp(dims, alignment, alloc_in);
306  swap(tmp);
307  }
308  }
309 
310  void recreate(x_coord_t width, y_coord_t height, std::size_t alignment, const Alloc alloc_in)
311  {
312  recreate(point_t(width, height), alignment, alloc_in);
313  }
314 
315  void recreate(const point_t& dims, const Pixel& p_in, std::size_t alignment, const Alloc alloc_in)
316  {
317  if (dims == _view.dimensions() && _align_in_bytes == alignment && alloc_in == _alloc)
318  return;
319 
320  _align_in_bytes = alignment;
321 
322  if (_allocated_bytes >= total_allocated_size_in_bytes(dims))
323  {
324  destruct_pixels(_view);
325  create_view(dims, std::integral_constant<bool, IsPlanar>());
326  uninitialized_fill_pixels(_view, p_in);
327  }
328  else
329  {
330  image tmp(dims, p_in, alignment, alloc_in);
331  swap(tmp);
332  }
333  }
334 
335  void recreate(x_coord_t width, y_coord_t height, const Pixel& p_in, std::size_t alignment, const Alloc alloc_in )
336  {
337  recreate(point_t(width, height), p_in, alignment, alloc_in);
338  }
339 
340  view_t _view; // contains pointer to the pixels, the image size and ways to navigate pixels
341 
342  // for construction from other type
343  template <typename P2, bool IP2, typename Alloc2> friend class image;
344 private:
345  unsigned char* _memory;
346  std::size_t _align_in_bytes;
347  allocator_type _alloc;
348 
349  std::size_t _allocated_bytes;
350 
351  void allocate_and_default_construct(point_t const& dimensions)
352  {
353  try
354  {
355  allocate_(dimensions, std::integral_constant<bool, IsPlanar>());
357  }
358  catch (...) { deallocate(); throw; }
359  }
360 
361  void allocate_and_fill(const point_t& dimensions, Pixel const& p_in)
362  {
363  try
364  {
365  allocate_(dimensions, std::integral_constant<bool, IsPlanar>());
366  uninitialized_fill_pixels(_view, p_in);
367  }
368  catch(...) { deallocate(); throw; }
369  }
370 
371  template <typename View>
372  void allocate_and_copy(const point_t& dimensions, View const& v)
373  {
374  try
375  {
376  allocate_(dimensions, std::integral_constant<bool, IsPlanar>());
377  uninitialized_copy_pixels(v, _view);
378  }
379  catch(...) { deallocate(); throw; }
380  }
381 
382  void deallocate()
383  {
384  if (_memory && _allocated_bytes > 0)
385  _alloc.deallocate(_memory, _allocated_bytes);
386  }
387 
388  std::size_t is_planar_impl(
389  std::size_t const size_in_units,
390  std::size_t const channels_in_image,
391  std::true_type) const
392  {
393  return size_in_units * channels_in_image;
394  }
395 
396  std::size_t is_planar_impl(
397  std::size_t const size_in_units,
398  std::size_t const,
399  std::false_type) const
400  {
401  return size_in_units;
402  }
403 
404  std::size_t total_allocated_size_in_bytes(point_t const& dimensions) const
405  {
406  using x_iterator = typename view_t::x_iterator;
407 
408  // when value_type is a non-pixel, like int or float, num_channels< ... > doesn't work.
409  constexpr std::size_t _channels_in_image =
410  std::conditional
411  <
412  is_pixel<value_type>::value,
414  std::integral_constant<std::size_t, 1>
415  >::type::value;
416 
417  std::size_t size_in_units = is_planar_impl(
418  get_row_size_in_memunits(dimensions.x) * dimensions.y,
419  _channels_in_image,
420  std::integral_constant<bool, IsPlanar>());
421 
422  // return the size rounded up to the nearest byte
423  return ( size_in_units + byte_to_memunit< x_iterator >::value - 1 )
425  + ( _align_in_bytes > 0 ? _align_in_bytes - 1 : 0 ); // add extra padding in case we need to align the first image pixel
426  }
427 
428  std::size_t get_row_size_in_memunits(x_coord_t width) const { // number of units per row
429  std::size_t size_in_memunits = width*memunit_step(typename view_t::x_iterator());
430  if (_align_in_bytes>0) {
431  std::size_t alignment_in_memunits=_align_in_bytes*byte_to_memunit<typename view_t::x_iterator>::value;
432  return align(size_in_memunits, alignment_in_memunits);
433  }
434  return size_in_memunits;
435  }
436 
437  void allocate_(point_t const& dimensions, std::false_type)
438  {
439  // if it throws and _memory!=0 the client must deallocate _memory
440  _allocated_bytes = total_allocated_size_in_bytes(dimensions);
441  _memory=_alloc.allocate( _allocated_bytes );
442 
443  unsigned char* tmp=(_align_in_bytes>0) ? (unsigned char*)align((std::size_t)_memory,_align_in_bytes) : _memory;
444  _view=view_t(dimensions,typename view_t::locator(typename view_t::x_iterator(tmp), get_row_size_in_memunits(dimensions.x)));
445 
446  BOOST_ASSERT(_view.width() == dimensions.x);
447  BOOST_ASSERT(_view.height() == dimensions.y);
448  }
449 
450  void allocate_(point_t const& dimensions, std::true_type)
451  {
452  // if it throws and _memory!=0 the client must deallocate _memory
453  std::size_t row_size=get_row_size_in_memunits(dimensions.x);
454  std::size_t plane_size=row_size*dimensions.y;
455 
456  _allocated_bytes = total_allocated_size_in_bytes( dimensions );
457 
458  _memory = _alloc.allocate( _allocated_bytes );
459 
460  unsigned char* tmp=(_align_in_bytes>0) ? (unsigned char*)align((std::size_t)_memory,_align_in_bytes) : _memory;
461  typename view_t::x_iterator first;
462  for (std::size_t i = 0; i < num_channels<view_t>::value; ++i)
463  {
464  dynamic_at_c(first, i) = (typename channel_type<view_t>::type*)tmp;
465  memunit_advance(dynamic_at_c(first, i), static_cast<std::ptrdiff_t>(plane_size * i));
466  }
467  _view=view_t(dimensions, typename view_t::locator(first, row_size));
468 
469  BOOST_ASSERT(_view.width() == dimensions.x);
470  BOOST_ASSERT(_view.height() == dimensions.y);
471  }
472 
473  void create_view(point_t const& dims, std::true_type) // is planar
474  {
475  std::size_t row_size=get_row_size_in_memunits(dims.x);
476  std::size_t plane_size=row_size*dims.y;
477 
478  unsigned char* tmp = ( _align_in_bytes > 0 ) ? (unsigned char*) align( (std::size_t) _memory
479  ,_align_in_bytes
480  )
481  : _memory;
482  typename view_t::x_iterator first;
483 
484  for (std::size_t i = 0; i < num_channels<view_t>::value; ++i)
485  {
486  dynamic_at_c(first, i) = (typename channel_type<view_t>::type*)tmp;
487  memunit_advance(dynamic_at_c(first, i), static_cast<std::ptrdiff_t>(plane_size * i));
488  }
489 
490  _view = view_t(dims, typename view_t::locator(first, row_size));
491 
492  BOOST_ASSERT(_view.width() == dims.x);
493  BOOST_ASSERT(_view.height() == dims.y);
494  }
495 
496  void create_view(point_t const& dims, std::false_type) // is planar
497  {
498  unsigned char* tmp = ( _align_in_bytes > 0 ) ? ( unsigned char* ) align( (std::size_t) _memory
499  , _align_in_bytes
500  )
501  : _memory;
502 
503  _view = view_t( dims
504  , typename view_t::locator( typename view_t::x_iterator( tmp )
505  , get_row_size_in_memunits( dims.x )
506  )
507  );
508 
509  BOOST_ASSERT(_view.width() == dims.x);
510  BOOST_ASSERT(_view.height() == dims.y);
511  }
512 };
513 
514 template <typename Pixel, bool IsPlanar, typename Alloc>
516 {
517  im1.swap(im2);
518 }
519 
520 template <typename Pixel1, bool IsPlanar1, typename Alloc1, typename Pixel2, bool IsPlanar2, typename Alloc2>
521 bool operator==(const image<Pixel1,IsPlanar1,Alloc1>& im1,const image<Pixel2,IsPlanar2,Alloc2>& im2)
522 {
523  if ((void*)(&im1)==(void*)(&im2)) return true;
524  if (const_view(im1).dimensions()!=const_view(im2).dimensions()) return false;
525  return equal_pixels(const_view(im1),const_view(im2));
526 }
527 template <typename Pixel1, bool IsPlanar1, typename Alloc1, typename Pixel2, bool IsPlanar2, typename Alloc2>
528 bool operator!=(const image<Pixel1,IsPlanar1,Alloc1>& im1,const image<Pixel2,IsPlanar2,Alloc2>& im2) {return !(im1==im2);}
529 
533 
535 
537 template <typename Pixel, bool IsPlanar, typename Alloc> inline
538 const typename image<Pixel,IsPlanar,Alloc>::view_t& view(image<Pixel,IsPlanar,Alloc>& img) { return img._view; }
539 
541 template <typename Pixel, bool IsPlanar, typename Alloc> inline
542 const typename image<Pixel,IsPlanar,Alloc>::const_view_t const_view(const image<Pixel,IsPlanar,Alloc>& img)
543 {
544  return static_cast<const typename image<Pixel,IsPlanar,Alloc>::const_view_t>(img._view);
545 }
547 
549 // PixelBasedConcept
551 
552 template <typename Pixel, bool IsPlanar, typename Alloc>
553 struct channel_type<image<Pixel, IsPlanar, Alloc>> : channel_type<Pixel> {};
554 
555 template <typename Pixel, bool IsPlanar, typename Alloc>
556 struct color_space_type<image<Pixel, IsPlanar, Alloc>> : color_space_type<Pixel> {};
557 
558 template <typename Pixel, bool IsPlanar, typename Alloc>
559 struct channel_mapping_type<image<Pixel, IsPlanar, Alloc>> : channel_mapping_type<Pixel> {};
560 
561 template <typename Pixel, bool IsPlanar, typename Alloc>
562 struct is_planar<image<Pixel, IsPlanar, Alloc>> : std::integral_constant<bool, IsPlanar> {};
563 
564 }} // namespace boost::gil
565 
566 #endif
Definition: pixel_iterator.hpp:124
+
1 //
2 // Copyright 2005-2007 Adobe Systems Incorporated
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_IMAGE_HPP
9 #define BOOST_GIL_IMAGE_HPP
10 
11 #include <boost/gil/algorithm.hpp>
12 #include <boost/gil/image_view.hpp>
13 #include <boost/gil/metafunctions.hpp>
14 #include <boost/gil/detail/mp11.hpp>
15 
16 #include <boost/assert.hpp>
17 #include <boost/core/exchange.hpp>
18 
19 #include <cstddef>
20 #include <memory>
21 #include <utility>
22 #include <type_traits>
23 
24 namespace boost { namespace gil {
25 
39 
40 template< typename Pixel, bool IsPlanar = false, typename Alloc=std::allocator<unsigned char> >
41 class image
42 {
43 public:
44 #if defined(BOOST_NO_CXX11_ALLOCATOR)
45  using allocator_type = typename Alloc::template rebind<unsigned char>::other;
46 #else
47  using allocator_type = typename std::allocator_traits<Alloc>::template rebind_alloc<unsigned char>;
48 #endif
49  using view_t = typename view_type_from_pixel<Pixel, IsPlanar>::type;
50  using const_view_t = typename view_t::const_t;
51  using point_t = typename view_t::point_t;
52  using coord_t = typename view_t::coord_t;
53  using value_type = typename view_t::value_type;
54  using x_coord_t = coord_t;
55  using y_coord_t = coord_t;
56 
57  const point_t& dimensions() const { return _view.dimensions(); }
58  x_coord_t width() const { return _view.width(); }
59  y_coord_t height() const { return _view.height(); }
60 
61  explicit image(std::size_t alignment=0,
62  const Alloc alloc_in = Alloc()) :
63  _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in), _allocated_bytes( 0 ) {}
64 
65  // Create with dimensions and optional initial value and alignment
66  image(const point_t& dimensions,
67  std::size_t alignment=0,
68  const Alloc alloc_in = Alloc()) : _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in)
69  , _allocated_bytes( 0 )
70  {
71  allocate_and_default_construct(dimensions);
72  }
73 
74  image(x_coord_t width, y_coord_t height,
75  std::size_t alignment=0,
76  const Alloc alloc_in = Alloc()) : _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in)
77  , _allocated_bytes( 0 )
78  {
79  allocate_and_default_construct(point_t(width,height));
80  }
81 
82  image(const point_t& dimensions,
83  const Pixel& p_in,
84  std::size_t alignment = 0,
85  const Alloc alloc_in = Alloc()) : _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in)
86  , _allocated_bytes( 0 )
87  {
88  allocate_and_fill(dimensions, p_in);
89  }
90 
91  image(x_coord_t width, y_coord_t height,
92  const Pixel& p_in,
93  std::size_t alignment = 0,
94  const Alloc alloc_in = Alloc()) : _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in)
95  , _allocated_bytes ( 0 )
96  {
97  allocate_and_fill(point_t(width,height),p_in);
98  }
99 
100  image(const image& img) : _memory(nullptr), _align_in_bytes(img._align_in_bytes), _alloc(img._alloc)
101  , _allocated_bytes( img._allocated_bytes )
102  {
103  allocate_and_copy(img.dimensions(),img._view);
104  }
105 
106  template <typename P2, bool IP2, typename Alloc2>
107  image(const image<P2,IP2,Alloc2>& img) : _memory(nullptr), _align_in_bytes(img._align_in_bytes), _alloc(img._alloc)
108  , _allocated_bytes( img._allocated_bytes )
109  {
110  allocate_and_copy(img.dimensions(),img._view);
111  }
112 
113  template <typename Loc,
114  typename std::enable_if<pixels_are_compatible<typename Loc::value_type, Pixel>::value, int>::type = 0>
115  image(const image_view<Loc>& view,
116  std::size_t alignment = 0,
117  const Alloc alloc_in = Alloc()) : _memory(nullptr), _align_in_bytes(alignment), _alloc(alloc_in)
118  , _allocated_bytes( 0 )
119  {
120  allocate_and_copy(view.dimensions(),view);
121  }
122 
123  // TODO Optimization: use noexcept (requires _view to be nothrow copy constructible)
124  image(image&& img) :
125  _view(img._view),
126  _memory(img._memory),
127  _align_in_bytes(img._align_in_bytes),
128  _alloc(std::move(img._alloc)),
129  _allocated_bytes(img._allocated_bytes)
130  {
131  img._view = view_t();
132  img._memory = nullptr;
133  img._align_in_bytes = 0;
134  img._allocated_bytes = 0;
135  }
136 
137  image& operator=(const image& img)
138  {
139  if (dimensions() == img.dimensions())
140  copy_pixels(img._view,_view);
141  else
142  {
143  image tmp(img);
144  swap(tmp);
145  }
146  return *this;
147  }
148 
149  template <typename Img>
150  image& operator=(const Img& img)
151  {
152  if (dimensions() == img.dimensions())
153  copy_pixels(img._view,_view);
154  else
155  {
156  image tmp(img);
157  swap(tmp);
158  }
159  return *this;
160  }
161 
162  private:
163  using propagate_allocators = std::true_type;
164  using no_propagate_allocators = std::false_type;
165 
166  template <class Alloc2>
167  using choose_pocma = typename std::conditional<
168  // TODO: Use std::allocator_traits<Allocator>::is_always_equal if available
169  std::is_empty<Alloc2>::value,
170  std::true_type,
171  typename std::allocator_traits<Alloc2>::propagate_on_container_move_assignment::type
172  >::type;
173 
174  static void exchange_memory(image& lhs, image& rhs)
175  {
176  lhs._memory = boost::exchange(rhs._memory, nullptr);
177  lhs._align_in_bytes = boost::exchange(rhs._align_in_bytes, 0);
178  lhs._allocated_bytes = boost::exchange(rhs._allocated_bytes, 0);
179  lhs._view = boost::exchange(rhs._view, image::view_t{});
180  };
181 
182  void move_assign(image& img, propagate_allocators) noexcept {
183  // non-sticky allocator, can adopt the memory, fast
184  destruct_pixels(_view);
185  this->deallocate();
186  this->_alloc = img._alloc;
187  exchange_memory(*this, img);
188  }
189 
190  void move_assign(image& img, no_propagate_allocators) {
191  if (_alloc == img._alloc) {
192  // allocator stuck to the rhs, but it's equivalent of ours, we can still adopt the memory
193  destruct_pixels(_view);
194  this->deallocate();
195  exchange_memory(*this, img);
196  } else {
197  // cannot propagate the allocator and cannot adopt the memory
198  if (img._memory)
199  {
200  allocate_and_copy(img.dimensions(), img._view);
201  destruct_pixels(img._view);
202  img.deallocate();
203  img._view = image::view_t{};
204  }
205  else
206  {
207  destruct_pixels(this->_view);
208  this->deallocate();
209  this->_view = view_t{};
210  }
211  }
212  }
213 
214  public:
215  // TODO: Use noexcept(noexcept(move_assign(img, choose_pocma<allocator_type>{})))
216  // But https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869 prevents it (fixed in GCC > 9)
217  image& operator=(image&& img) {
218  if (this != std::addressof(img))
219  // Use rebinded alloc to choose pocma
220  move_assign(img, choose_pocma<allocator_type>{});
221 
222  return *this;
223  }
224 
225  ~image()
226  {
227  destruct_pixels(_view);
228  deallocate();
229  }
230 
231  Alloc& allocator() { return _alloc; }
232  Alloc const& allocator() const { return _alloc; }
233 
234  void swap(image& img) // required by MutableContainerConcept
235  {
236  using std::swap;
237  swap(_align_in_bytes, img._align_in_bytes);
238  swap(_memory, img._memory);
239  swap(_view, img._view);
240  swap(_alloc, img._alloc);
241  swap(_allocated_bytes, img._allocated_bytes );
242  }
243 
245  // recreate
247 
248  // without Allocator
249  void recreate(const point_t& dims, std::size_t alignment = 0)
250  {
251  if (dims == _view.dimensions() && _align_in_bytes == alignment)
252  return;
253 
254  _align_in_bytes = alignment;
255 
256  if (_allocated_bytes >= total_allocated_size_in_bytes(dims))
257  {
258  destruct_pixels(_view);
259  create_view(dims, std::integral_constant<bool, IsPlanar>());
261  }
262  else
263  {
264  image tmp(dims, alignment);
265  swap(tmp);
266  }
267  }
268 
269  void recreate(x_coord_t width, y_coord_t height, std::size_t alignment = 0)
270  {
271  recreate(point_t(width, height), alignment);
272  }
273 
274  void recreate(const point_t& dims, const Pixel& p_in, std::size_t alignment = 0)
275  {
276  if (dims == _view.dimensions() && _align_in_bytes == alignment)
277  return;
278 
279  _align_in_bytes = alignment;
280 
281  if (_allocated_bytes >= total_allocated_size_in_bytes(dims))
282  {
283  destruct_pixels(_view);
284  create_view(dims, typename std::integral_constant<bool, IsPlanar>());
285  uninitialized_fill_pixels(_view, p_in);
286  }
287  else
288  {
289  image tmp(dims, p_in, alignment);
290  swap(tmp);
291  }
292  }
293 
294  void recreate( x_coord_t width, y_coord_t height, const Pixel& p_in, std::size_t alignment = 0 )
295  {
296  recreate( point_t( width, height ), p_in, alignment );
297  }
298 
299  // with Allocator
300  void recreate(const point_t& dims, std::size_t alignment, const Alloc alloc_in)
301  {
302  if (dims == _view.dimensions() && _align_in_bytes == alignment && alloc_in == _alloc)
303  return;
304 
305  _align_in_bytes = alignment;
306 
307  if (_allocated_bytes >= total_allocated_size_in_bytes(dims))
308  {
309  destruct_pixels(_view);
310  create_view(dims, std::integral_constant<bool, IsPlanar>());
312  }
313  else
314  {
315  image tmp(dims, alignment, alloc_in);
316  swap(tmp);
317  }
318  }
319 
320  void recreate(x_coord_t width, y_coord_t height, std::size_t alignment, const Alloc alloc_in)
321  {
322  recreate(point_t(width, height), alignment, alloc_in);
323  }
324 
325  void recreate(const point_t& dims, const Pixel& p_in, std::size_t alignment, const Alloc alloc_in)
326  {
327  if (dims == _view.dimensions() && _align_in_bytes == alignment && alloc_in == _alloc)
328  return;
329 
330  _align_in_bytes = alignment;
331 
332  if (_allocated_bytes >= total_allocated_size_in_bytes(dims))
333  {
334  destruct_pixels(_view);
335  create_view(dims, std::integral_constant<bool, IsPlanar>());
336  uninitialized_fill_pixels(_view, p_in);
337  }
338  else
339  {
340  image tmp(dims, p_in, alignment, alloc_in);
341  swap(tmp);
342  }
343  }
344 
345  void recreate(x_coord_t width, y_coord_t height, const Pixel& p_in, std::size_t alignment, const Alloc alloc_in )
346  {
347  recreate(point_t(width, height), p_in, alignment, alloc_in);
348  }
349 
350  view_t _view; // contains pointer to the pixels, the image size and ways to navigate pixels
351 
352  // for construction from other type
353  template <typename P2, bool IP2, typename Alloc2> friend class image;
354 private:
355  unsigned char* _memory;
356  std::size_t _align_in_bytes;
357  allocator_type _alloc;
358 
359  std::size_t _allocated_bytes;
360 
361  void allocate_and_default_construct(point_t const& dimensions)
362  {
363  try
364  {
365  allocate_(dimensions, std::integral_constant<bool, IsPlanar>());
367  }
368  catch (...) { deallocate(); throw; }
369  }
370 
371  void allocate_and_fill(const point_t& dimensions, Pixel const& p_in)
372  {
373  try
374  {
375  allocate_(dimensions, std::integral_constant<bool, IsPlanar>());
376  uninitialized_fill_pixels(_view, p_in);
377  }
378  catch(...) { deallocate(); throw; }
379  }
380 
381  template <typename View>
382  void allocate_and_copy(const point_t& dimensions, View const& v)
383  {
384  try
385  {
386  allocate_(dimensions, std::integral_constant<bool, IsPlanar>());
387  uninitialized_copy_pixels(v, _view);
388  }
389  catch(...) { deallocate(); throw; }
390  }
391 
392  void deallocate()
393  {
394  if (_memory && _allocated_bytes > 0)
395  _alloc.deallocate(_memory, _allocated_bytes);
396  }
397 
398  std::size_t is_planar_impl(
399  std::size_t const size_in_units,
400  std::size_t const channels_in_image,
401  std::true_type) const
402  {
403  return size_in_units * channels_in_image;
404  }
405 
406  std::size_t is_planar_impl(
407  std::size_t const size_in_units,
408  std::size_t const,
409  std::false_type) const
410  {
411  return size_in_units;
412  }
413 
414  std::size_t total_allocated_size_in_bytes(point_t const& dimensions) const
415  {
416  using x_iterator = typename view_t::x_iterator;
417 
418  // when value_type is a non-pixel, like int or float, num_channels< ... > doesn't work.
419  constexpr std::size_t _channels_in_image =
420  std::conditional
421  <
422  is_pixel<value_type>::value,
424  std::integral_constant<std::size_t, 1>
425  >::type::value;
426 
427  std::size_t size_in_units = is_planar_impl(
428  get_row_size_in_memunits(dimensions.x) * dimensions.y,
429  _channels_in_image,
430  std::integral_constant<bool, IsPlanar>());
431 
432  // return the size rounded up to the nearest byte
433  return ( size_in_units + byte_to_memunit< x_iterator >::value - 1 )
435  + ( _align_in_bytes > 0 ? _align_in_bytes - 1 : 0 ); // add extra padding in case we need to align the first image pixel
436  }
437 
438  std::size_t get_row_size_in_memunits(x_coord_t width) const { // number of units per row
439  std::size_t size_in_memunits = width*memunit_step(typename view_t::x_iterator());
440  if (_align_in_bytes>0) {
441  std::size_t alignment_in_memunits=_align_in_bytes*byte_to_memunit<typename view_t::x_iterator>::value;
442  return align(size_in_memunits, alignment_in_memunits);
443  }
444  return size_in_memunits;
445  }
446 
447  void allocate_(point_t const& dimensions, std::false_type)
448  {
449  // if it throws and _memory!=0 the client must deallocate _memory
450  _allocated_bytes = total_allocated_size_in_bytes(dimensions);
451  _memory=_alloc.allocate( _allocated_bytes );
452 
453  unsigned char* tmp=(_align_in_bytes>0) ? (unsigned char*)align((std::size_t)_memory,_align_in_bytes) : _memory;
454  _view=view_t(dimensions,typename view_t::locator(typename view_t::x_iterator(tmp), get_row_size_in_memunits(dimensions.x)));
455 
456  BOOST_ASSERT(_view.width() == dimensions.x);
457  BOOST_ASSERT(_view.height() == dimensions.y);
458  }
459 
460  void allocate_(point_t const& dimensions, std::true_type)
461  {
462  // if it throws and _memory!=0 the client must deallocate _memory
463  std::size_t row_size=get_row_size_in_memunits(dimensions.x);
464  std::size_t plane_size=row_size*dimensions.y;
465 
466  _allocated_bytes = total_allocated_size_in_bytes( dimensions );
467 
468  _memory = _alloc.allocate( _allocated_bytes );
469 
470  unsigned char* tmp=(_align_in_bytes>0) ? (unsigned char*)align((std::size_t)_memory,_align_in_bytes) : _memory;
471  typename view_t::x_iterator first;
472  for (std::size_t i = 0; i < num_channels<view_t>::value; ++i)
473  {
474  dynamic_at_c(first, i) = (typename channel_type<view_t>::type*)tmp;
475  memunit_advance(dynamic_at_c(first, i), static_cast<std::ptrdiff_t>(plane_size * i));
476  }
477  _view=view_t(dimensions, typename view_t::locator(first, row_size));
478 
479  BOOST_ASSERT(_view.width() == dimensions.x);
480  BOOST_ASSERT(_view.height() == dimensions.y);
481  }
482 
483  void create_view(point_t const& dims, std::true_type) // is planar
484  {
485  std::size_t row_size=get_row_size_in_memunits(dims.x);
486  std::size_t plane_size=row_size*dims.y;
487 
488  unsigned char* tmp = ( _align_in_bytes > 0 ) ? (unsigned char*) align( (std::size_t) _memory
489  ,_align_in_bytes
490  )
491  : _memory;
492  typename view_t::x_iterator first;
493 
494  for (std::size_t i = 0; i < num_channels<view_t>::value; ++i)
495  {
496  dynamic_at_c(first, i) = (typename channel_type<view_t>::type*)tmp;
497  memunit_advance(dynamic_at_c(first, i), static_cast<std::ptrdiff_t>(plane_size * i));
498  }
499 
500  _view = view_t(dims, typename view_t::locator(first, row_size));
501 
502  BOOST_ASSERT(_view.width() == dims.x);
503  BOOST_ASSERT(_view.height() == dims.y);
504  }
505 
506  void create_view(point_t const& dims, std::false_type) // is planar
507  {
508  unsigned char* tmp = ( _align_in_bytes > 0 ) ? ( unsigned char* ) align( (std::size_t) _memory
509  , _align_in_bytes
510  )
511  : _memory;
512 
513  _view = view_t( dims
514  , typename view_t::locator( typename view_t::x_iterator( tmp )
515  , get_row_size_in_memunits( dims.x )
516  )
517  );
518 
519  BOOST_ASSERT(_view.width() == dims.x);
520  BOOST_ASSERT(_view.height() == dims.y);
521  }
522 };
523 
524 template <typename Pixel, bool IsPlanar, typename Alloc>
526 {
527  im1.swap(im2);
528 }
529 
530 template <typename Pixel1, bool IsPlanar1, typename Alloc1, typename Pixel2, bool IsPlanar2, typename Alloc2>
531 bool operator==(const image<Pixel1,IsPlanar1,Alloc1>& im1,const image<Pixel2,IsPlanar2,Alloc2>& im2)
532 {
533  if ((void*)(&im1)==(void*)(&im2)) return true;
534  if (const_view(im1).dimensions()!=const_view(im2).dimensions()) return false;
535  return equal_pixels(const_view(im1),const_view(im2));
536 }
537 template <typename Pixel1, bool IsPlanar1, typename Alloc1, typename Pixel2, bool IsPlanar2, typename Alloc2>
538 bool operator!=(const image<Pixel1,IsPlanar1,Alloc1>& im1,const image<Pixel2,IsPlanar2,Alloc2>& im2) {return !(im1==im2);}
539 
543 
545 
547 template <typename Pixel, bool IsPlanar, typename Alloc> inline
548 const typename image<Pixel,IsPlanar,Alloc>::view_t& view(image<Pixel,IsPlanar,Alloc>& img) { return img._view; }
549 
551 template <typename Pixel, bool IsPlanar, typename Alloc> inline
552 const typename image<Pixel,IsPlanar,Alloc>::const_view_t const_view(const image<Pixel,IsPlanar,Alloc>& img)
553 {
554  return static_cast<const typename image<Pixel,IsPlanar,Alloc>::const_view_t>(img._view);
555 }
557 
559 // PixelBasedConcept
561 
562 template <typename Pixel, bool IsPlanar, typename Alloc>
563 struct channel_type<image<Pixel, IsPlanar, Alloc>> : channel_type<Pixel> {};
564 
565 template <typename Pixel, bool IsPlanar, typename Alloc>
566 struct color_space_type<image<Pixel, IsPlanar, Alloc>> : color_space_type<Pixel> {};
567 
568 template <typename Pixel, bool IsPlanar, typename Alloc>
569 struct channel_mapping_type<image<Pixel, IsPlanar, Alloc>> : channel_mapping_type<Pixel> {};
570 
571 template <typename Pixel, bool IsPlanar, typename Alloc>
572 struct is_planar<image<Pixel, IsPlanar, Alloc>> : std::integral_constant<bool, IsPlanar> {};
573 
574 }} // namespace boost::gil
575 
576 #endif
Definition: pixel_iterator.hpp:124
Definition: algorithm.hpp:30
void default_construct_pixels(View const &view)
Invokes the in-place default constructor on every pixel of the (uninitialized) view. Does not support planar heterogeneous views. If an exception is thrown destructs any in-place default-constructed pixels.
Definition: algorithm.hpp:714
+
A lightweight object that interprets memory as a 2D array of pixels. Models ImageViewConcept,PixelBasedConcept,HasDynamicXStepTypeConcept,HasDynamicYStepTypeConcept,HasTransposedTypeConcept.
Definition: image_view.hpp:53
void uninitialized_copy_pixels(View1 const &view1, View2 const &view2)
std::uninitialized_copy for image views. Does not support planar heterogeneous views. If an exception is thrown destructs any in-place copy-constructed objects
Definition: algorithm.hpp:778
BOOST_FORCEINLINE bool equal_pixels(const View1 &v1, const View2 &v2)
std::equal for image views
Definition: algorithm.hpp:1051
BOOST_FORCEINLINE void copy_pixels(const View1 &src, const View2 &dst)
std::copy for image views
Definition: algorithm.hpp:282
@@ -62,8 +63,8 @@
void uninitialized_fill_pixels(const View &view, const Value &val)
std::uninitialized_fill for image views. Does not support planar heterogeneous views. If an exception is thrown destructs any in-place copy-constructed pixels
Definition: algorithm.hpp:577
void swap(boost::gil::packed_channel_reference< BF, FB, NB, M > const x, R &y)
swap for packed_channel_reference
Definition: channel.hpp:529
Definition: color_convert.hpp:31
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
-
const image< Pixel, IsPlanar, Alloc >::const_view_t const_view(const image< Pixel, IsPlanar, Alloc > &img)
Returns the constant-pixel view of an image.
Definition: image.hpp:542
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
+
const image< Pixel, IsPlanar, Alloc >::const_view_t const_view(const image< Pixel, IsPlanar, Alloc > &img)
Returns the constant-pixel view of an image.
Definition: image.hpp:552
Returns the number of channels of a pixel-based GIL construct.
Definition: locator.hpp:38
Returns the type of a view the pixel type, whether it operates on planar data and whether it has a st...
Definition: metafunctions.hpp:556
BOOST_FORCEINLINE void destruct_pixels(View const &view)
Invokes the in-place destructor on every pixel of the view.
Definition: algorithm.hpp:508
diff --git a/develop/doc/html/reference/image__view_8hpp_source.html b/develop/doc/html/reference/image__view_8hpp_source.html index 1fcb3c638..d6c919457 100644 --- a/develop/doc/html/reference/image__view_8hpp_source.html +++ b/develop/doc/html/reference/image__view_8hpp_source.html @@ -62,7 +62,7 @@
Base template for types that model HasDynamicYStepTypeConcept.
Definition: dynamic_step.hpp:21
void swap(boost::gil::packed_channel_reference< BF, FB, NB, M > const x, R &y)
swap for packed_channel_reference
Definition: channel.hpp:529
Definition: color_convert.hpp:31
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
Returns an integral constant type specifying the number of elements in a color base.
Definition: color_base_algorithm.hpp:42
Returns the number of channels of a pixel-based GIL construct.
Definition: locator.hpp:38
Base template for types that model HasDynamicXStepTypeConcept.
Definition: dynamic_step.hpp:17
diff --git a/develop/doc/html/reference/image__view__factory_8hpp_source.html b/develop/doc/html/reference/image__view__factory_8hpp_source.html index ce67a7e37..4b212b616 100644 --- a/develop/doc/html/reference/image__view__factory_8hpp_source.html +++ b/develop/doc/html/reference/image__view__factory_8hpp_source.html @@ -78,7 +78,7 @@
Determines if the given view is mutable (i.e. its pixels can be changed)
Definition: metafunctions.hpp:242
Definition: color_convert.hpp:31
GIL&#39;s 2-dimensional view over immutable GIL pixels.
Definition: concepts/image_view.hpp:375
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
color_converted_view_type< View, DstP >::type color_converted_view(const View &src)
overload of generic color_converted_view with the default color-converter
Definition: image_view_factory.hpp:178
Given a model of a pixel, determines whether the model represents a pixel reference (as opposed to pi...
Definition: metafunctions.hpp:216
class for color-converting one pixel to another
Definition: color_convert.hpp:325
diff --git a/develop/doc/html/reference/read__and__convert__image_8hpp_source.html b/develop/doc/html/reference/read__and__convert__image_8hpp_source.html index eb55a8753..081fc08cb 100644 --- a/develop/doc/html/reference/read__and__convert__image_8hpp_source.html +++ b/develop/doc/html/reference/read__and__convert__image_8hpp_source.html @@ -55,7 +55,7 @@
1 //
2 // Copyright 2007-2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_IO_READ_AND_CONVERT_IMAGE_HPP
9 #define BOOST_GIL_IO_READ_AND_CONVERT_IMAGE_HPP
10 
11 #include <boost/gil/io/base.hpp>
12 #include <boost/gil/io/conversion_policies.hpp>
13 #include <boost/gil/io/device.hpp>
14 #include <boost/gil/io/get_reader.hpp>
15 #include <boost/gil/io/path_spec.hpp>
16 #include <boost/gil/detail/mp11.hpp>
17 
18 #include <type_traits>
19 
20 namespace boost{ namespace gil {
21 
23 
30 template <typename Reader, typename Image>
31 inline
32 void read_and_convert_image(Reader& reader, Image& img,
33  typename std::enable_if
34  <
35  mp11::mp_and
36  <
37  detail::is_reader<Reader>,
38  is_format_tag<typename Reader::format_tag_t>
39  >::value
40  >::type* /*dummy*/ = nullptr)
41 {
42  reader.init_image(img, reader._settings);
43  reader.apply(view(img));
44 }
45 
52 template <typename Device, typename Image, typename ColorConverter, typename FormatTag>
53 inline
55  Device& device,
56  Image& img,
57  image_read_settings<FormatTag> const& settings,
58  ColorConverter const& cc,
59  typename std::enable_if
60  <
61  mp11::mp_and
62  <
64  is_format_tag<FormatTag>
65  >::value
66  >::type* /*dummy*/ = nullptr)
67 {
68  using read_and_convert_t = detail::read_and_convert<ColorConverter>;
70 
71  reader_t reader = make_reader(device, settings, read_and_convert_t{cc});
72  read_and_convert_image(reader, img);
73 }
74 
81 template <typename String, typename Image, typename ColorConverter, typename FormatTag>
82 inline
84  String const& file_name,
85  Image& img,
86  image_read_settings<FormatTag> const& settings,
87  ColorConverter const& cc,
88  typename std::enable_if
89  <
90  mp11::mp_and
91  <
92  is_format_tag<FormatTag>,
93  detail::is_supported_path_spec<String>
94  >::value
95  >::type* /*dummy*/ = nullptr)
96 {
97  using read_and_convert_t = detail::read_and_convert<ColorConverter>;
99 
100  reader_t reader = make_reader(file_name, settings, read_and_convert_t{cc});
101  read_and_convert_image(reader, img);
102 }
103 
110 template <typename String, typename Image, typename ColorConverter, typename FormatTag>
111 inline
113  String const& file_name,
114  Image& img,
115  ColorConverter const& cc,
116  FormatTag const& tag,
117  typename std::enable_if
118  <
119  mp11::mp_and
120  <
121  is_format_tag<FormatTag>,
122  detail::is_supported_path_spec<String>
123  >::value
124  >::type* /*dummy*/ = nullptr)
125 {
126  using read_and_convert_t = detail::read_and_convert<ColorConverter>;
128 
129  reader_t reader = make_reader(file_name, tag, read_and_convert_t{cc});
130  read_and_convert_image(reader, img);
131 }
132 
139 template <typename Device, typename Image, typename ColorConverter, typename FormatTag>
140 inline
142  Device& device,
143  Image& img,
144  ColorConverter const& cc,
145  FormatTag const& tag,
146  typename std::enable_if
147  <
148  mp11::mp_and
149  <
151  is_format_tag<FormatTag>
152  >::value
153  >::type* /*dummy*/ = nullptr)
154 {
155  using read_and_convert_t = detail::read_and_convert<ColorConverter>;
157 
158  reader_t reader = make_reader(device, tag, read_and_convert_t{cc});
159  read_and_convert_image(reader, img);
160 }
161 
167 template <typename String, typename Image, typename FormatTag>
168 inline void read_and_convert_image(
169  String const& file_name,
170  Image& img,
171  image_read_settings<FormatTag> const& settings,
172  typename std::enable_if
173  <
174  mp11::mp_and
175  <
176  is_format_tag<FormatTag>,
177  detail::is_supported_path_spec<String>
178  >::value
179  >::type* /*dummy*/ = nullptr)
180 {
181  using read_and_convert_t = detail::read_and_convert<default_color_converter>;
183 
184  reader_t reader = make_reader(file_name, settings, read_and_convert_t{});
185  read_and_convert_image(reader, img);
186 }
187 
193 template <typename Device, typename Image, typename FormatTag>
194 inline void read_and_convert_image(
195  Device& device,
196  Image& img,
197  image_read_settings<FormatTag> const& settings,
198  typename std::enable_if
199  <
200  mp11::mp_and
201  <
203  is_format_tag<FormatTag>
204  >::value
205  >::type* /*dummy*/ = nullptr)
206 {
207  using read_and_convert_t = detail::read_and_convert<default_color_converter>;
209 
210  reader_t reader = make_reader(device, settings, read_and_convert_t{});
211  read_and_convert_image(reader, img);
212 }
213 
219 template <typename String, typename Image, typename FormatTag>
220 inline
222  String const& file_name,
223  Image& img,
224  FormatTag const& tag,
225  typename std::enable_if
226  <
227  mp11::mp_and
228  <
229  is_format_tag<FormatTag>,
230  detail::is_supported_path_spec<String>
231  >::value
232  >::type* /*dummy*/ = nullptr)
233 {
234  using read_and_convert_t = detail::read_and_convert<default_color_converter>;
236 
237  reader_t reader = make_reader(file_name, tag, read_and_convert_t{});
238  read_and_convert_image(reader, img);
239 }
240 
246 template <typename Device, typename Image, typename FormatTag>
247 inline void read_and_convert_image(
248  Device& device,
249  Image& img,
250  FormatTag const& tag,
251  typename std::enable_if
252  <
253  mp11::mp_and
254  <
256  is_format_tag<FormatTag>
257  >::value
258  >::type* /*dummy*/ = nullptr)
259 {
260  using read_and_convert_t = detail::read_and_convert<default_color_converter>;
262 
263  reader_t reader = make_reader(device, tag, read_and_convert_t{});
264  read_and_convert_image(reader, img);
265 }
266 
267 }} // namespace boost::gil
268 
269 #endif
Definition: algorithm.hpp:30
void read_and_convert_image(Reader &reader, Image &img, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t > >::value >::type *=nullptr)
Reads and color-converts an image. Image memory is allocated.
Definition: read_and_convert_image.hpp:32
Definition: device.hpp:575
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
Helper metafunction to generate image reader type.
Definition: get_reader.hpp:26
diff --git a/develop/doc/html/reference/read__and__convert__view_8hpp_source.html b/develop/doc/html/reference/read__and__convert__view_8hpp_source.html index af6e6c674..3bc9b31f9 100644 --- a/develop/doc/html/reference/read__and__convert__view_8hpp_source.html +++ b/develop/doc/html/reference/read__and__convert__view_8hpp_source.html @@ -55,7 +55,7 @@
1 //
2 // Copyright 2007-2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_IO_READ_AND_CONVERT_VIEW_HPP
9 #define BOOST_GIL_IO_READ_AND_CONVERT_VIEW_HPP
10 
11 #include <boost/gil/io/base.hpp>
12 #include <boost/gil/io/conversion_policies.hpp>
13 #include <boost/gil/io/device.hpp>
14 #include <boost/gil/io/get_reader.hpp>
15 #include <boost/gil/io/path_spec.hpp>
16 #include <boost/gil/detail/mp11.hpp>
17 
18 #include <type_traits>
19 
20 namespace boost{ namespace gil {
21 
23 
30 template <typename Reader, typename View>
31 inline
32 void read_and_convert_view(Reader& reader, View const& view,
33  typename std::enable_if
34  <
35  mp11::mp_and
36  <
37  detail::is_reader<Reader>,
38  is_format_tag<typename Reader::format_tag_t>
39  >::value
40  >::type* /*dummy*/ = nullptr)
41 {
42  reader.check_image_size(view.dimensions());
43  reader.init_view(view, reader._settings);
44  reader.apply(view);
45 }
46 
53 template <typename Device, typename View, typename ColorConverter, typename FormatTag>
54 inline
56  Device& device,
57  View const& view,
58  image_read_settings<FormatTag> const& settings,
59  ColorConverter const& cc,
60  typename std::enable_if
61  <
62  mp11::mp_and
63  <
65  is_format_tag<FormatTag>
66  >::value
67  >::type* /*dummy*/ = nullptr)
68 {
69  using read_and_convert_t = detail::read_and_convert<ColorConverter>;
71 
72  reader_t reader = make_reader(device, settings, read_and_convert_t{cc});
73  read_and_convert_view(reader, view);
74 }
75 
82 template <typename String, typename View, typename ColorConverter, typename FormatTag>
83 inline
85  String const& file_name,
86  View const& view,
87  image_read_settings<FormatTag> const& settings,
88  ColorConverter const& cc,
89  typename std::enable_if
90  <
91  mp11::mp_and
92  <
93  is_format_tag<FormatTag>,
94  detail::is_supported_path_spec<String>
95  >::value
96  >::type* /*dummy*/ = nullptr)
97 {
98  using read_and_convert_t = detail::read_and_convert<ColorConverter>;
100 
101  reader_t reader = make_reader(file_name, settings, read_and_convert_t{cc});
102  read_and_convert_view(reader, view);
103 }
104 
111 template <typename String, typename View, typename ColorConverter, typename FormatTag>
112 inline
114  String const& file_name,
115  View const& view,
116  ColorConverter const& cc,
117  FormatTag const& tag,
118  typename std::enable_if
119  <
120  mp11::mp_and
121  <
122  is_format_tag<FormatTag>,
123  detail::is_supported_path_spec<String>
124  >::value
125  >::type* /*dummy*/ = nullptr)
126 {
127  using read_and_convert_t = detail::read_and_convert<ColorConverter>;
129 
130  reader_t reader = make_reader(file_name, tag, read_and_convert_t{cc});
131  read_and_convert_view(reader, view);
132 }
133 
140 template <typename Device, typename View, typename ColorConverter, typename FormatTag>
141 inline
143  Device& device,
144  View const& view,
145  ColorConverter const& cc,
146  FormatTag const& tag,
147  typename std::enable_if
148  <
149  mp11::mp_and
150  <
152  is_format_tag<FormatTag>
153  >::value
154  >::type* /*dummy*/ = nullptr)
155 {
156  using read_and_convert_t = detail::read_and_convert<ColorConverter>;
158 
159  reader_t reader = make_reader(device, tag, read_and_convert_t{cc});
160  read_and_convert_view(reader, view);
161 }
162 
168 template <typename String, typename View, typename FormatTag>
169 inline
171  String const& file_name,
172  View const& view,
173  image_read_settings<FormatTag> const& settings,
174  typename std::enable_if
175  <
176  mp11::mp_and
177  <
178  is_format_tag<FormatTag>,
179  detail::is_supported_path_spec<String>
180  >::value
181  >::type* /*dummy*/ = nullptr)
182 {
183  using read_and_convert_t = detail::read_and_convert<default_color_converter>;
185 
186  reader_t reader = make_reader(file_name, settings, read_and_convert_t{});
187  read_and_convert_view(reader, view);
188 }
189 
195 template <typename Device, typename View, typename FormatTag>
196 inline
198  Device& device,
199  View const& view,
200  image_read_settings<FormatTag> const& settings,
201  typename std::enable_if
202  <
203  mp11::mp_and
204  <
206  is_format_tag<FormatTag>
207  >::value
208  >::type* /*dummy*/ = nullptr)
209 {
210  using read_and_convert_t = detail::read_and_convert<default_color_converter>;
212 
213  reader_t reader = make_reader(device, settings, read_and_convert_t{});
214  read_and_convert_view(reader, view);
215 }
216 
222 template <typename String, typename View, typename FormatTag>
223 inline
225  String const& file_name,
226  View const& view,
227  FormatTag const& tag,
228  typename std::enable_if
229  <
230  mp11::mp_and
231  <
232  is_format_tag<FormatTag>,
233  detail::is_supported_path_spec<String>
234  >::value
235  >::type* /*dummy*/ = nullptr)
236 {
237  using read_and_convert_t = detail::read_and_convert<default_color_converter>;
239 
240  reader_t reader = make_reader(file_name, tag, read_and_convert_t{});
241  read_and_convert_view(reader, view);
242 }
243 
249 template <typename Device, typename View, typename FormatTag>
250 inline
252  Device& device,
253  View const& view,
254  FormatTag const& tag,
255  typename std::enable_if
256  <
257  mp11::mp_and
258  <
260  is_format_tag<FormatTag>
261  >::value
262  >::type* /*dummy*/ = nullptr)
263 {
264  using read_and_convert_t = detail::read_and_convert<default_color_converter>;
266 
267  reader_t reader = make_reader(device, tag, read_and_convert_t{});
268  read_and_convert_view(reader, view);
269 }
270 
271 }} // namespace boost::gill
272 
273 #endif
Definition: algorithm.hpp:30
Definition: device.hpp:575
void read_and_convert_view(Reader &reader, View const &view, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t > >::value >::type *=nullptr)
Reads and color-converts an image view. No memory is allocated.
Definition: read_and_convert_view.hpp:32
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
Helper metafunction to generate image reader type.
Definition: get_reader.hpp:26
diff --git a/develop/doc/html/reference/read__image_8hpp_source.html b/develop/doc/html/reference/read__image_8hpp_source.html index 2fea4b051..3ebf2cb15 100644 --- a/develop/doc/html/reference/read__image_8hpp_source.html +++ b/develop/doc/html/reference/read__image_8hpp_source.html @@ -57,7 +57,7 @@
Represents a run-time specified image. Note it does NOT model ImageConcept.
Definition: any_image.hpp:89
Definition: base.hpp:78
Definition: device.hpp:575
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
Helper metafunction to generate image reader type.
Definition: get_reader.hpp:26
void read_image(Reader reader, Image &img, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, is_format_tag< typename Reader::format_tag_t >, is_read_supported< typename get_pixel_type< typename Image::view_t >::type, typename Reader::format_tag_t > >::value >::type *=nullptr)
Reads an image without conversion. Image memory is allocated.
Definition: read_image.hpp:32
diff --git a/develop/doc/html/reference/read__view_8hpp_source.html b/develop/doc/html/reference/read__view_8hpp_source.html index 3c03ed03c..0191c06e2 100644 --- a/develop/doc/html/reference/read__view_8hpp_source.html +++ b/develop/doc/html/reference/read__view_8hpp_source.html @@ -56,7 +56,7 @@
Definition: base.hpp:78
Definition: device.hpp:575
void read_view(Reader reader, View const &view, typename std::enable_if< mp11::mp_and< detail::is_reader< Reader >, typename is_format_tag< typename Reader::format_tag_t >::type, typename is_read_supported< typename get_pixel_type< View >::type, typename Reader::format_tag_t >::type >::value >::type *=nullptr)
Reads an image view without conversion. No memory is allocated.
Definition: read_view.hpp:31
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
Helper metafunction to generate image reader type.
Definition: get_reader.hpp:26
diff --git a/develop/doc/html/reference/reader__base_8hpp_source.html b/develop/doc/html/reference/reader__base_8hpp_source.html index 9354ab68c..c7a08c644 100644 --- a/develop/doc/html/reference/reader__base_8hpp_source.html +++ b/develop/doc/html/reference/reader__base_8hpp_source.html @@ -54,7 +54,7 @@
1 //
2 // Copyright 2007-2008 Christian Henning
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_IO_READER_BASE_HPP
9 #define BOOST_GIL_IO_READER_BASE_HPP
10 
11 #include <boost/gil/io/base.hpp>
12 
13 #include <boost/assert.hpp>
14 
15 namespace boost { namespace gil {
16 
25 template< typename FormatTag
26  , typename ConversionPolicy
27  >
29 {
30 public:
31 
36  :_cc_policy()
37  {}
38 
42  reader_base( const ConversionPolicy& cc )
43  :_cc_policy( cc )
44  {}
45 
52  template< typename Image >
53  void init_image( Image& img
54  , const image_read_settings< FormatTag >& settings
55  )
56  {
57  //setup( backend._settings._dim );
58 
59  BOOST_ASSERT(settings._dim.x && settings._dim.y);
60 
61  img.recreate( settings._dim.x
62  , settings._dim.y
63  );
64  }
65 
66  template< typename View >
67  void init_view( const View& view
68  , const image_read_settings< FormatTag >&
69  )
70  {
71  setup( view.dimensions() );
72  }
73 
74 private:
75 
76  void setup( const point_t& /* dim */ )
77  {
78  //check_coordinates( dim );
79 
80  //if( dim == point_t( 0, 0 ))
81  //{
82  // _settings._dim.x = _info._width;
83  // _settings._dim.y = _info._height;
84  //}
85  //else
86  //{
87  // _settings._dim = dim;
88  //}
89  }
90 
91  void check_coordinates( const point_t& /* dim */ )
92  {
93  //using int_t = point_t::value_type;
94 
95  //int_t width = static_cast< int_t >( _info._width );
96  //int_t height = static_cast< int_t >( _info._height );
97 
98  //io_error_if( ( _settings._top_left.x < 0
99  // || _settings._top_left.y < 0
100  // || dim.x < 0
101  // || dim.y < 0
102  // )
103  // , "User provided view has incorrect size." );
104 
105 
106  //io_error_if( ( ( width ) < _settings._top_left.x
107  // && ( width ) <= dim.x
108  // && ( height ) < _settings._top_left.y
109  // && ( height ) <= dim.y )
110  // , "User provided view has incorrect size." );
111 
112  //io_error_if( ( ( _settings._top_left.x + dim.x ) > width
113  // || ( _settings._top_left.y + dim.y ) > height
114  // )
115  // , "User provided view has incorrect size." );
116  }
117 
118 protected:
119 
120  ConversionPolicy _cc_policy;
121 };
122 
123 } // namespace gil
124 } // namespace boost
125 
126 #endif
Definition: algorithm.hpp:30
void init_image(Image &img, const image_read_settings< FormatTag > &settings)
Definition: reader_base.hpp:53
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
reader_base()
Definition: reader_base.hpp:35
Definition: reader_base.hpp:28
diff --git a/develop/doc/html/reference/threshold_8hpp_source.html b/develop/doc/html/reference/threshold_8hpp_source.html index 937a058c4..cc0f05bdb 100644 --- a/develop/doc/html/reference/threshold_8hpp_source.html +++ b/develop/doc/html/reference/threshold_8hpp_source.html @@ -63,7 +63,7 @@
Consider values less than or equal to threshold value.
container interface over image view. Models ImageConcept, PixelBasedConcept
Definition: image.hpp:41
Definition: color_convert.hpp:31
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
void threshold_truncate(SrcView const &src_view, DstView const &dst_view, typename channel_type< DstView >::type threshold_value, threshold_truncate_mode mode=threshold_truncate_mode::threshold, threshold_direction direction=threshold_direction::regular)
Applies truncating threshold to each pixel of image view. Takes an image view and performs truncating...
Definition: threshold.hpp:173
Consider values greater than threshold value.
diff --git a/develop/doc/html/reference/write__view_8hpp_source.html b/develop/doc/html/reference/write__view_8hpp_source.html index 712514b7f..97ec79fb8 100644 --- a/develop/doc/html/reference/write__view_8hpp_source.html +++ b/develop/doc/html/reference/write__view_8hpp_source.html @@ -53,7 +53,7 @@
1 //
2 // Copyright 2007-2012 Christian Henning, Andreas Pokorny, Lubomir Bourdev
3 //
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
7 //
8 #ifndef BOOST_GIL_IO_WRITE_VIEW_HPP
9 #define BOOST_GIL_IO_WRITE_VIEW_HPP
10 
11 #include <boost/gil/io/base.hpp>
12 #include <boost/gil/io/conversion_policies.hpp>
13 #include <boost/gil/io/device.hpp>
14 #include <boost/gil/io/get_writer.hpp>
15 #include <boost/gil/io/path_spec.hpp>
16 #include <boost/gil/detail/mp11.hpp>
17 
18 #include <type_traits>
19 
20 namespace boost{ namespace gil {
21 
23 template<typename Writer, typename View>
24 inline
25 void write_view(Writer& writer, View const& view,
26  typename std::enable_if
27  <
28  mp11::mp_and
29  <
30  typename detail::is_writer<Writer>::type,
31  typename is_format_tag<typename Writer::format_tag_t>::type,
32  typename is_write_supported
33  <
34  typename get_pixel_type<View>::type,
35  typename Writer::format_tag_t
36  >::type
37  >::value
38  >::type* /* ptr */ = nullptr)
39 {
40  writer.apply(view);
41 }
42 
44 template<typename Device, typename View, typename FormatTag>
45 inline
46 void write_view(Device& device, View const& view, FormatTag const& tag,
47  typename std::enable_if
48  <
49  mp11::mp_and
50  <
51  typename detail::is_write_device<FormatTag, Device>::type,
52  typename is_format_tag<FormatTag>::type,
53  typename is_write_supported
54  <
55  typename get_pixel_type<View>::type,
56  FormatTag
57  >::type
58  >::value
59  >::type* /* ptr */ = nullptr)
60 {
61  using writer_t = typename get_writer<Device, FormatTag>::type;
62  writer_t writer = make_writer(device, tag);
63  write_view(writer, view);
64 }
65 
67 template<typename String, typename View, typename FormatTag>
68 inline
69 void write_view(String const& file_name, View const& view, FormatTag const& tag,
70  typename std::enable_if
71  <
72  mp11::mp_and
73  <
74  typename detail::is_supported_path_spec<String>::type,
75  typename is_format_tag<FormatTag>::type,
76  typename is_write_supported
77  <
78  typename get_pixel_type<View>::type,
79  FormatTag
80  >::type
81  >::value
82  >::type* /* ptr */ = nullptr)
83 {
84  using writer_t = typename get_writer<String, FormatTag>::type;
85  writer_t writer = make_writer(file_name, tag);
86  write_view(writer, view);
87 }
88 
90 template<typename Device, typename View, typename FormatTag, typename Log>
91 inline
92 void write_view(
93  Device& device, View const& view, image_write_info<FormatTag, Log> const& info,
94  typename std::enable_if
95  <
96  mp11::mp_and
97  <
98  typename detail::is_write_device<FormatTag, Device>::type,
99  typename is_format_tag<FormatTag>::type,
100  typename is_write_supported
101  <
102  typename get_pixel_type<View>::type,
103  FormatTag
104  >::type
105  >::value
106  >::type* /* ptr */ = nullptr)
107 {
108  using writer_t = typename get_writer<Device, FormatTag>::type;
109  writer_t writer = make_writer(device, info);
110  write_view(writer, view);
111 }
112 
114 template<typename String, typename View, typename FormatTag, typename Log>
115 inline
116 void write_view(
117  String const& file_name, View const& view, image_write_info<FormatTag, Log> const& info,
118  typename std::enable_if
119  <
120  mp11::mp_and
121  <
122  typename detail::is_supported_path_spec<String>::type,
123  typename is_format_tag<FormatTag>::type,
124  typename is_write_supported
125  <
126  typename get_pixel_type<View>::type,
127  FormatTag
128  >::type
129  >::value
130  >::type* /* ptr */ = nullptr)
131 {
132  using writer_t = typename get_writer<String, FormatTag>::type;
133  writer_t writer = make_writer(file_name, info);
134  write_view(writer, view);
135 }
136 
138 
139 // without image_write_info
140 template <typename Writer, typename ...Views>
141 inline
142 void write_view(Writer& writer, any_image_view<Views...> const& view,
143  typename std::enable_if
144  <
145  mp11::mp_and
146  <
147  typename detail::is_dynamic_image_writer<Writer>::type,
148  typename is_format_tag<typename Writer::format_tag_t>::type
149  >::value
150  >::type * /* ptr */ = nullptr)
151 {
152  writer.apply(view);
153 }
154 
155 // without image_write_info
156 template <typename Device, typename ...Views, typename FormatTag>
157 inline
158 void write_view(
159  Device& device, any_image_view<Views...> const& views, FormatTag const& tag,
160  typename std::enable_if
161  <
162  mp11::mp_and
163  <
164  typename detail::is_write_device<FormatTag, Device>::type,
165  typename is_format_tag<FormatTag>::type
166  >::value
167  >::type * /* ptr */ = 0)
168 {
169  using writer_t = typename get_dynamic_image_writer<Device, FormatTag>::type;
170  writer_t writer = make_dynamic_image_writer(device, tag);
171  write_view(writer, views);
172 }
173 
174 template <typename String, typename ...Views, typename FormatTag>
175 inline
176 void write_view(
177  String const& file_name, any_image_view<Views...> const& views, FormatTag const& tag,
178  typename std::enable_if
179  <
180  mp11::mp_and
181  <
182  typename detail::is_supported_path_spec<String>::type,
183  typename is_format_tag<FormatTag>::type
184  >::value
185  >::type * /* ptr */ = nullptr)
186 {
187  using writer_t = typename get_dynamic_image_writer<String, FormatTag>::type;
188  writer_t writer = make_dynamic_image_writer(file_name, tag);
189  write_view(writer, views);
190 }
191 
192 // with image_write_info
194 template <typename Device, typename ...Views, typename FormatTag, typename Log>
195 inline
196 void write_view(
197  Device& device, any_image_view<Views...> const& views, image_write_info<FormatTag, Log> const& info,
198  typename std::enable_if
199  <
200  mp11::mp_and
201  <
202  typename detail::is_write_device<FormatTag, Device>::type,
203  typename is_format_tag<FormatTag>::type
204  >::value
205  >::type * /* ptr */ = 0)
206 {
207  using writer_t = typename get_dynamic_image_writer<Device, FormatTag>::type;
208  writer_t writer = make_dynamic_image_writer(device, info);
209  write_view(writer, views);
210 }
211 
212 template <typename String, typename ...Views, typename FormatTag, typename Log>
213 inline
214 void write_view(
215  String const& file_name, any_image_view<Views...> const& views, image_write_info<FormatTag, Log> const& info,
216  typename std::enable_if
217  <
218  mp11::mp_and
219  <
220  typename detail::is_supported_path_spec<String>::type,
221  typename is_format_tag<FormatTag>::type
222  >::value
223  >::type * /* ptr */ = nullptr)
224 {
225  using writer_t = typename get_dynamic_image_writer<String, FormatTag>::type;
226  writer_t writer = make_dynamic_image_writer(file_name, info);
227  write_view(writer, views);
228 }
229 
230 }} // namespace boost::gil
231 
232 #endif
Definition: algorithm.hpp:30
-
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:538
+
const image< Pixel, IsPlanar, Alloc >::view_t & view(image< Pixel, IsPlanar, Alloc > &img)
Returns the non-constant-pixel view of an image.
Definition: image.hpp:548
diff --git a/develop/doc/html/search.html b/develop/doc/html/search.html index 105faa1f5..784b4a437 100644 --- a/develop/doc/html/search.html +++ b/develop/doc/html/search.html @@ -83,7 +83,7 @@
diff --git a/develop/doc/html/toolbox.html b/develop/doc/html/toolbox.html index 48d6e6bfb..1c4585eae 100644 --- a/develop/doc/html/toolbox.html +++ b/develop/doc/html/toolbox.html @@ -128,7 +128,7 @@ made suggestions for improvements.

diff --git a/develop/doc/html/tutorial/gradient.html b/develop/doc/html/tutorial/gradient.html index 135f57dac..6871dec60 100644 --- a/develop/doc/html/tutorial/gradient.html +++ b/develop/doc/html/tutorial/gradient.html @@ -953,7 +953,7 @@ code with different compilers.

diff --git a/develop/doc/html/tutorial/histogram.html b/develop/doc/html/tutorial/histogram.html index 85399291f..e1bb0d5cf 100644 --- a/develop/doc/html/tutorial/histogram.html +++ b/develop/doc/html/tutorial/histogram.html @@ -171,7 +171,7 @@ memory is allocated and no images are copied.

diff --git a/develop/doc/html/tutorial/video.html b/develop/doc/html/tutorial/video.html index b0de57ce3..047cc7aa5 100644 --- a/develop/doc/html/tutorial/video.html +++ b/develop/doc/html/tutorial/video.html @@ -82,7 +82,7 @@