/usr/include/boost/gil/concepts
Edit: /usr/include/boost/gil/concepts/image.hpp (5342B)
//
// Copyright 2005-2007 Adobe Systems Incorporated
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
#ifndef BOOST_GIL_CONCEPTS_IMAGE_HPP
#define BOOST_GIL_CONCEPTS_IMAGE_HPP
#include
#include
#include
#include
#include
#include
#include
#if defined(BOOST_CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wunused-local-typedefs"
#endif
#if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#endif
namespace boost { namespace gil {
/// \ingroup ImageConcept
/// \brief N-dimensional container of values
///
/// \code
/// concept RandomAccessNDImageConcept : Regular
/// {
/// typename view_t; where MutableRandomAccessNDImageViewConcept;
/// typename const_view_t = view_t::const_t;
/// typename point_t = view_t::point_t;
/// typename value_type = view_t::value_type;
/// typename allocator_type;
///
/// Image::Image(point_t dims, std::size_t alignment=1);
/// Image::Image(point_t dims, value_type fill_value, std::size_t alignment);
///
/// void Image::recreate(point_t new_dims, std::size_t alignment=1);
/// void Image::recreate(point_t new_dims, value_type fill_value, std::size_t alignment);
///
/// const point_t& Image::dimensions() const;
/// const const_view_t& const_view(const Image&);
/// const view_t& view(Image&);
/// };
/// \endcode
template
struct RandomAccessNDImageConcept
{
void constraints()
{
gil_function_requires>();
using view_t = typename Image::view_t;
gil_function_requires>();
using const_view_t = typename Image::const_view_t;
using pixel_t = typename Image::value_type;
using point_t = typename Image::point_t;
gil_function_requires>();
const_view_t cv = const_view(image);
ignore_unused_variable_warning(cv);
view_t v = view(image);
ignore_unused_variable_warning(v);
pixel_t fill_value;
point_t pt = image.dimensions();
Image image1(pt);
Image image2(pt, 1);
Image image3(pt, fill_value, 1);
image.recreate(pt);
image.recreate(pt, 1);
image.recreate(pt, fill_value, 1);
}
Image image;
};
/// \ingroup ImageConcept
/// \brief 2-dimensional container of values
///
/// \code
/// concept RandomAccess2DImageConcept
/// {
/// typename x_coord_t = const_view_t::x_coord_t;
/// typename y_coord_t = const_view_t::y_coord_t;
///
/// Image::Image(x_coord_t width, y_coord_t height, std::size_t alignment=1);
/// Image::Image(x_coord_t width, y_coord_t height, value_type fill_value, std::size_t alignment);
///
/// x_coord_t Image::width() const;
/// y_coord_t Image::height() const;
///
/// void Image::recreate(x_coord_t width, y_coord_t height, std::size_t alignment=1);
/// void Image::recreate(x_coord_t width, y_coord_t height, value_type fill_value, std::size_t alignment);
/// };
/// \endcode
template
struct RandomAccess2DImageConcept
{
void constraints()
{
gil_function_requires>();
using x_coord_t = typename Image::x_coord_t;
using y_coord_t = typename Image::y_coord_t;
using value_t = typename Image::value_type;
gil_function_requires>();
x_coord_t w=image.width();
y_coord_t h=image.height();
value_t fill_value;
Image im1(w,h);
Image im2(w,h,1);
Image im3(w,h,fill_value,1);
image.recreate(w,h);
image.recreate(w,h,1);
image.recreate(w,h,fill_value,1);
}
Image image;
};
/// \ingroup ImageConcept
/// \brief 2-dimensional image whose value type models PixelValueConcept
///
/// \code
/// concept ImageConcept
/// {
/// where MutableImageViewConcept;
/// typename coord_t = view_t::coord_t;
/// };
/// \endcode
template
struct ImageConcept
{
void constraints()
{
gil_function_requires>();
gil_function_requires>();
using coord_t = typename Image::coord_t;
static_assert(num_channels::value == mp11::mp_size::type>::value, "");
static_assert(std::is_same::value, "");
static_assert(std::is_same::value, "");
}
Image image;
};
}} // namespace boost::gil
#if defined(BOOST_CLANG)
#pragma clang diagnostic pop
#endif
#if defined(BOOST_GCC) && (BOOST_GCC >= 40900)
#pragma GCC diagnostic pop
#endif
#endif