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>
13 #include <boost/gil/image.hpp>
15 #include <boost/config.hpp>
17 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
19 #pragma warning(disable:4512) //assignment operator could not be generated
22 namespace boost {
namespace gil {
25 template <
typename T>
struct get_view_t {
typedef typename T::view_t type; };
26 template <
typename Images>
struct images_get_views_t :
public mpl::transform<Images, get_view_t<mpl::_1> > {};
28 template <
typename T>
struct get_const_view_t {
typedef typename T::const_view_t type; };
29 template <
typename Images>
struct images_get_const_views_t :
public mpl::transform<Images, get_const_view_t<mpl::_1> > {};
31 struct recreate_image_fnobj
33 typedef void result_type;
34 point<std::ptrdiff_t>
const& _dimensions;
37 recreate_image_fnobj(point<std::ptrdiff_t>
const& dims,
unsigned alignment) : _dimensions(dims), _alignment(alignment) {}
38 template <
typename Image>
39 result_type operator()(Image& img)
const { img.recreate(_dimensions,_alignment); }
42 template <
typename AnyView>
43 struct any_image_get_view {
44 typedef AnyView result_type;
45 template <
typename Image> result_type operator()( Image& img)
const {
return result_type(
view(img)); }
48 template <
typename AnyConstView>
49 struct any_image_get_const_view {
50 typedef AnyConstView result_type;
51 template <
typename Image> result_type operator()(
const Image& img)
const {
return result_type(
const_view(img)); }
65 template <
typename ImageTypes>
71 typedef std::ptrdiff_t x_coord_t;
72 typedef std::ptrdiff_t y_coord_t;
77 template <
typename T>
explicit any_image(T& obj,
bool do_swap) :
parent_t(obj,do_swap) {}
81 template <
typename T>
any_image& operator=(
const T& obj) { parent_t::operator=(obj);
return *
this; }
85 void recreate(
const point_t& dims,
unsigned alignment=1)
90 void recreate(x_coord_t width, y_coord_t height,
unsigned alignment=1)
92 recreate({width, height}, alignment);
97 x_coord_t width()
const {
return dimensions().x; }
98 y_coord_t height()
const {
return dimensions().y; }
108 template <
typename Types> BOOST_FORCEINLINE
114 template <
typename Types> BOOST_FORCEINLINE
122 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
BOOST_FORCEINLINE any_image< Types >::const_view_t const_view(const any_image< Types > &anyImage)
Returns the constant-pixel view of any image. The returned view is any view.
Definition: any_image.hpp:115
Represents a run-time specified image. Note it does NOT model ImageConcept.
Definition: any_image.hpp:66
BOOST_FORCEINLINE UnaryOp::result_type 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:31
Represents a concrete instance of a run-time specified type from a set of typesA concept is typically...
Definition: variant.hpp:80
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:60
BOOST_FORCEINLINE any_image< Types >::view_t view(any_image< Types > &anyImage)
Returns the non-constant-pixel view of any image. The returned view is any view.
Definition: any_image.hpp:109
Returns the number of channels of a pixel-based GIL construct.
Definition: concepts.hpp:56