|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84391 - trunk/boost/gil/extension/toolbox/image_types
From: chhenning_at_[hidden]
Date: 2013-05-20 11:44:31
Author: chhenning
Date: 2013-05-20 11:44:30 EDT (Mon, 20 May 2013)
New Revision: 84391
URL: http://svn.boost.org/trac/boost/changeset/84391
Log:
Added some metafunctions to fulfill some og gil's concepts.
Text files modified:
trunk/boost/gil/extension/toolbox/image_types/subchroma_image.hpp | 139 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 133 insertions(+), 6 deletions(-)
Modified: trunk/boost/gil/extension/toolbox/image_types/subchroma_image.hpp
==============================================================================
--- trunk/boost/gil/extension/toolbox/image_types/subchroma_image.hpp (original)
+++ trunk/boost/gil/extension/toolbox/image_types/subchroma_image.hpp 2013-05-20 11:44:30 EDT (Mon, 20 May 2013)
@@ -117,6 +117,58 @@
};
+/////////////////////////////
+// PixelBasedConcept
+/////////////////////////////
+
+template < typename Locator, typename Factors >
+struct channel_type< subchroma_image_locator< Locator, Factors > >
+ : public channel_type< typename subchroma_image_locator< Locator, Factors >::type > {};
+
+template < typename Locator, typename Factors >
+struct color_space_type< subchroma_image_locator< Locator, Factors > >
+ : public color_space_type< typename subchroma_image_locator< Locator, Factors >::type > {};
+
+template < typename Locator, typename Factors >
+struct channel_mapping_type< subchroma_image_locator< Locator, Factors > >
+ : public channel_mapping_type< typename subchroma_image_locator< Locator, Factors >::type > {};
+
+template < typename Locator, typename Factors >
+struct is_planar< subchroma_image_locator< Locator, Factors > >
+ : public is_planar< typename subchroma_image_locator< Locator, Factors >::type > {};
+
+/////////////////////////////
+// HasDynamicXStepTypeConcept
+/////////////////////////////
+
+template < typename Locator, typename Factors >
+struct dynamic_x_step_type< subchroma_image_locator< Locator, Factors > >
+{
+ typedef typename subchroma_image_locator< Locator, Factors >::type type;
+};
+
+/////////////////////////////
+// HasDynamicYStepTypeConcept
+/////////////////////////////
+
+template < typename Locator, typename Factors >
+struct dynamic_y_step_type< subchroma_image_locator< Locator, Factors > >
+{
+ typedef typename subchroma_image_locator< Locator, Factors >::type type;
+};
+
+/////////////////////////////
+// HasTransposedTypeConcept
+/////////////////////////////
+
+template < typename Locator, typename Factors >
+struct transposed_type< subchroma_image_locator< Locator, Factors > >
+{
+ typedef typename subchroma_image_locator< Locator, Factors >::type type;
+};
+
+//////////////////////////////////
+
////////////////////////////////////////////////////////////////////////////////////////
/// \class subchroma_image_view
/// \ingroup ImageViewModel PixelBasedModel
@@ -130,8 +182,8 @@
{
public:
- typedef typename Locator locator_t;
- typedef typename locator_t::deref_fn_t deref_fn_t;
+ typedef typename Locator locator;
+ typedef typename locator::deref_fn_t deref_fn_t;
typedef typename deref_fn_t::plane_locator_t plane_locator_t;
@@ -159,7 +211,7 @@
/// copy constructor
template< typename Subchroma_View >
subchroma_image_view( const Subchroma_View& v )
- : image_view< locator_t >( v )
+ : image_view< locator >( v )
{}
const point_t& v_ssfactors() const { return point_t( get_deref_fn().vx_ssfactor(), get_deref_fn().vx_ssfactor() ); }
@@ -191,6 +243,59 @@
point_t _u_dimensions;
};
+
+/////////////////////////////
+// PixelBasedConcept
+/////////////////////////////
+
+template < typename Locator, typename Factors >
+struct channel_type< subchroma_image_view< Locator, Factors > >
+ : public channel_type< Locator > {};
+
+template < typename Locator, typename Factors >
+struct color_space_type< subchroma_image_view< Locator, Factors > >
+ : public color_space_type< Locator > {};
+
+template < typename Locator, typename Factors >
+struct channel_mapping_type< subchroma_image_view< Locator, Factors > >
+ : public channel_mapping_type< Locator > {};
+
+template < typename Locator, typename Factors >
+struct is_planar< subchroma_image_view< Locator, Factors > >
+ : public is_planar< Locator > {};
+
+/////////////////////////////
+// HasDynamicXStepTypeConcept
+/////////////////////////////
+
+template < typename Locator, typename Factors >
+struct dynamic_x_step_type< subchroma_image_view< Locator, Factors > >
+{
+ typedef image_view< typename dynamic_x_step_type< Locator >::type > type;
+};
+
+/////////////////////////////
+// HasDynamicYStepTypeConcept
+/////////////////////////////
+
+template < typename Locator, typename Factors >
+struct dynamic_y_step_type< subchroma_image_view< Locator, Factors > >
+{
+ typedef image_view< typename dynamic_y_step_type< Locator >::type > type;
+};
+
+/////////////////////////////
+// HasTransposedTypeConcept
+/////////////////////////////
+
+template < typename Locator, typename Factors >
+struct transposed_type< subchroma_image_view< Locator, Factors > >
+{
+ typedef image_view< typename transposed_type< Locator >::type > type;
+};
+
+
+/////////////////////////////////////////////////////////////
template< int J
, int a
, int b
@@ -246,7 +351,7 @@
class subchroma_image : public Scaling_Factors< mpl::at_c< Factors, 0 >::type::value
, mpl::at_c< Factors, 1 >::type::value
, mpl::at_c< Factors, 2 >::type::value
- >
+ >
{
public:
@@ -282,7 +387,7 @@
, _v_plane( y_width / ss_X, y_height / ss_Y, 0, Allocator() )
, _u_plane( y_width / ss_X, y_height / ss_Y, 0, Allocator() )
{
- init( point_t( y_width, y_height ) );
+ init();
}
public:
@@ -291,7 +396,7 @@
private:
- void init( const point_t& y_dimensions )
+ void init()
{
typedef subchroma_image_deref_fn< pixel_locator_t
, Factors
@@ -323,6 +428,28 @@
plane_image_t _u_plane;
};
+
+/////////////////////////////
+// PixelBasedConcept
+/////////////////////////////
+
+template < typename Pixel, typename Factors, typename Alloc >
+struct channel_type< subchroma_image< Pixel, Factors, Alloc > >
+ : public channel_type< Pixel > {};
+
+template < typename Pixel, typename Factors, typename Alloc >
+struct color_space_type< subchroma_image< Pixel, Factors, Alloc > >
+ : public color_space_type< Pixel > {};
+
+template < typename Pixel, typename Factors, typename Alloc >
+struct channel_mapping_type< subchroma_image< Pixel, Factors, Alloc > >
+ : public channel_mapping_type< Pixel > {};
+
+template < typename Pixel, typename Factors, typename Alloc >
+struct is_planar< subchroma_image< Pixel, Factors, Alloc > >
+ : public mpl::bool_< false > {};
+
+
/////////////////////////////////////////////////////////////////////////////////////////
/// \name view, const_view
/// \brief Get an image view from an subchroma_image
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk