12 #ifndef GIL_DYNAMICIMAGE_ANY_IMAGE_HPP
13 #define GIL_DYNAMICIMAGE_ANY_IMAGE_HPP
25 #include "../../image.hpp"
32 #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
34 #pragma warning(disable:4512) //assignment operator could not be generated
37 namespace boost {
namespace gil {
40 template <
typename T>
struct get_view_t {
typedef typename T::view_t type; };
41 template <
typename Images>
struct images_get_views_t :
public mpl::transform<Images, get_view_t<mpl::_1> > {};
43 template <
typename T>
struct get_const_view_t {
typedef typename T::const_view_t type; };
44 template <
typename Images>
struct images_get_const_views_t :
public mpl::transform<Images, get_const_view_t<mpl::_1> > {};
46 struct recreate_image_fnobj {
47 typedef void result_type;
48 const point2<std::ptrdiff_t>& _dimensions;
51 recreate_image_fnobj(
const point2<std::ptrdiff_t>& dims,
unsigned alignment) : _dimensions(dims), _alignment(alignment) {}
52 template <
typename Image> result_type operator()(Image& img)
const { img.recreate(_dimensions,_alignment); }
55 template <
typename AnyView>
56 struct any_image_get_view {
57 typedef AnyView result_type;
58 template <
typename Image> result_type operator()( Image& img)
const {
return result_type(
view(img)); }
61 template <
typename AnyConstView>
62 struct any_image_get_const_view {
63 typedef AnyConstView result_type;
64 template <
typename Image> result_type operator()(
const Image& img)
const {
return result_type(
const_view(img)); }
78 template <
typename ImageTypes>
84 typedef std::ptrdiff_t x_coord_t;
85 typedef std::ptrdiff_t y_coord_t;
90 template <
typename T>
explicit any_image(T& obj,
bool do_swap) :
parent_t(obj,do_swap) {}
94 template <
typename T>
any_image& operator=(
const T& obj) { parent_t::operator=(obj);
return *
this; }
98 void recreate(
const point_t& dims,
unsigned alignment=1) {
apply_operation(*
this,detail::recreate_image_fnobj(dims,alignment)); }
99 void recreate(x_coord_t width, y_coord_t height,
unsigned alignment=1) { recreate(
point2<std::ptrdiff_t>(width,height),alignment); }
103 x_coord_t width()
const {
return dimensions().x; }
104 y_coord_t height()
const {
return dimensions().y; }
114 template <
typename Types> BOOST_FORCEINLINE
120 template <
typename Types> BOOST_FORCEINLINE
128 #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:121
Represents a run-time specified image. Note it does NOT model ImageConcept.
Definition: any_image.hpp:79
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:35
Represents a concrete instance of a run-time specified type from a set of typesA concept is typically...
Definition: variant.hpp:89
Represents a run-time specified image view. Models HasDynamicXStepTypeConcept, HasDynamicYStepTypeCon...
Definition: any_image_view.hpp:64
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:115
Returns the number of channels of a pixel-based GIL construct.
Definition: gil_concept.hpp:66
Support for run-time instantiated image view.