8 #ifndef BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_ANY_IMAGE_HPP     9 #define BOOST_GIL_EXTENSION_DYNAMIC_IMAGE_ANY_IMAGE_HPP    11 #include <boost/gil/extension/dynamic_image/any_image_view.hpp>    12 #include <boost/gil/extension/dynamic_image/apply_operation.hpp>    14 #include <boost/gil/image.hpp>    15 #include <boost/gil/detail/mp11.hpp>    17 #include <boost/config.hpp>    18 #include <boost/variant.hpp>    20 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)    22 #pragma warning(disable:4512) //assignment operator could not be generated    25 namespace boost { 
namespace gil {
    30 using get_view_t = 
typename T::view_t;
    32 template <
typename Images>
    33 using images_get_views_t = mp11::mp_transform<get_view_t, Images>;
    36 using get_const_view_t = 
typename T::const_view_t;
    38 template <
typename Images>
    39 using images_get_const_views_t = mp11::mp_transform<get_const_view_t, Images>;
    41 struct recreate_image_fnobj
    43     using result_type = void;
    44     point<std::ptrdiff_t> 
const& _dimensions;
    47     recreate_image_fnobj(point<std::ptrdiff_t> 
const& dims, 
unsigned alignment)
    48         : _dimensions(dims), _alignment(alignment)
    51     template <
typename Image>
    52     result_type operator()(Image& img)
 const { img.recreate(_dimensions,_alignment); }
    55 template <
typename AnyView>  
    56 struct any_image_get_view
    58     using result_type = AnyView;
    59     template <
typename Image>
    60     result_type operator()(Image& img)
 const    62         return result_type(
view(img));
    66 template <
typename AnyConstView>  
    67 struct any_image_get_const_view
    69     using result_type = AnyConstView;
    70     template <
typename Image>
    71     result_type operator()(Image 
const& img)
 const { 
return result_type{
const_view(img)}; }
    87 template <
typename Images>
    88 class any_image : 
public make_variant_over<Images>::type
    90     using parent_t = 
typename make_variant_over<Images>::type;
    94     using x_coord_t = std::ptrdiff_t;
    95     using y_coord_t = std::ptrdiff_t;
   101     template <
typename Image>
   102     explicit any_image(Image 
const& img) : parent_t(img) {}
   104     template <
typename Image>
   105     explicit any_image(Image& img, 
bool do_swap) : parent_t(img, do_swap) {}
   107     template <
typename OtherImages>
   109         : parent_t((
typename make_variant_over<OtherImages>::type 
const&)img)
   114         parent_t::operator=((parent_t 
const&)img);
   118     template <
typename Image>
   121         parent_t::operator=(img);
   125     template <
typename OtherImages>
   128             parent_t::operator=((
typename make_variant_over<OtherImages>::type 
const&)img);
   132     void recreate(
const point_t& dims, 
unsigned alignment=1)
   137     void recreate(x_coord_t width, y_coord_t height, 
unsigned alignment=1)
   139         recreate({ width, height }, alignment);
   152     x_coord_t width()
  const { 
return dimensions().x; }
   153     y_coord_t height()
 const { 
return dimensions().y; }
   164 template <
typename Types>
   174 template <
typename Types>
   179     return apply_operation(img, detail::any_image_get_const_view<view_t>());
   185 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) BOOST_FORCEINLINE auto view(any_image< Types > &img) -> typename any_image< Types >::view_t
Returns the non-constant-pixel view of any image. The returned view is any view.
Definition: any_image.hpp:166
Represents a run-time specified image. Note it does NOT model ImageConcept.
Definition: any_image.hpp:88
BOOST_FORCEINLINE auto apply_operation(variant< Types > &arg, UnaryOp op)
Invokes a generic mutable operation (represented as a unary function object) on a variant.
Definition: apply_operation.hpp:33
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:66
BOOST_FORCEINLINE auto const_view(any_image< Types > const &img) -> typename any_image< Types >::const_view_t
Returns the constant-pixel view of any image. The returned view is any view.
Definition: any_image.hpp:176
Returns the number of channels of a pixel-based GIL construct.
Definition: locator.hpp:38