Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::gil::image_view< Loc > Class Template Reference

A lightweight object that interprets memory as a 2D array of pixels. More...

#include <image_view.hpp>

Classes

struct  add_deref
 
struct  axis
 

Public Types

typedef Loc::value_type value_type
 
typedef Loc::reference reference
 
typedef Loc::coord_t coord_t
 
typedef coord_t difference_type
 
typedef Loc::point_t point_t
 
typedef Loc locator
 
typedef image_view< typename
Loc::const_t > 
const_t
 
typedef iterator_from_2d< Loc > iterator
 
typedef std::reverse_iterator
< iterator
reverse_iterator
 
typedef std::size_t size_type
 
typedef locator xy_locator
 
typedef xy_locator::x_iterator x_iterator
 
typedef xy_locator::y_iterator y_iterator
 
typedef xy_locator::x_coord_t x_coord_t
 
typedef xy_locator::y_coord_t y_coord_t
 

Public Member Functions

 image_view ()
 
template<typename View >
 image_view (const View &iv)
 
template<typename L2 >
 image_view (const point_t &sz, const L2 &loc)
 
template<typename L2 >
 image_view (coord_t width, coord_t height, const L2 &loc)
 
template<typename View >
image_viewoperator= (const View &iv)
 
image_viewoperator= (const image_view &iv)
 
template<typename View >
bool operator== (const View &v) const
 
template<typename View >
bool operator!= (const View &v) const
 
const point_tdimensions () const
 
const locatorpixels () const
 
x_coord_t width () const
 
y_coord_t height () const
 
std::size_t num_channels () const
 
bool is_1d_traversable () const
 
1D navigation
size_type size () const
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
reference operator[] (difference_type i) const
 
iterator at (difference_type i) const
 
iterator at (const point_t &p) const
 
iterator at (x_coord_t x, y_coord_t y) const
 
2-D navigation
reference operator() (const point_t &p) const
 
reference operator() (x_coord_t x, y_coord_t y) const
 
template<std::size_t D>
axis< D >::iterator axis_iterator (const point_t &p) const
 
xy_locator xy_at (x_coord_t x, y_coord_t y) const
 
locator xy_at (const point_t &p) const
 
X navigation
x_iterator x_at (x_coord_t x, y_coord_t y) const
 
x_iterator x_at (const point_t &p) const
 
x_iterator row_begin (y_coord_t y) const
 
x_iterator row_end (y_coord_t y) const
 
Y navigation
y_iterator y_at (x_coord_t x, y_coord_t y) const
 
y_iterator y_at (const point_t &p) const
 
y_iterator col_begin (x_coord_t x) const
 
y_iterator col_end (x_coord_t x) const
 

Static Public Attributes

static const std::size_t num_dimensions =2
 

Friends

template<typename L2 >
class image_view
 
template<typename L2 >
void swap (image_view< L2 > &x, image_view< L2 > &y)
 

Detailed Description

template<typename Loc>
class boost::gil::image_view< Loc >

A lightweight object that interprets memory as a 2D array of pixels.

Models ImageViewConcept,PixelBasedConcept,HasDynamicXStepTypeConcept,HasDynamicYStepTypeConcept,HasTransposedTypeConcept

Image view consists of a pixel 2D locator (defining the mechanism for navigating in 2D) and the image dimensions.

Image views to images are what ranges are to STL containers. They are lightweight objects, that don't own the pixels. It is the user's responsibility that the underlying data remains valid for the lifetime of the image view.

Similar to iterators and ranges, constness of views does not extend to constness of pixels. A const image_view does not allow changing its location in memory (resizing, moving) but does not prevent one from changing the pixels. The latter requires an image view whose value_type is const.

Images have interfaces consistent with STL 1D random access containers, so they can be used directly in STL algorithms like:

std::fill(img.begin(), img.end(), red_pixel);

In addition, horizontal, vertical and 2D random access iterators are provided.

Note also that image_view does not require that its element type be a pixel. It could be instantiated with a locator whose value_type models only Regular. In this case the image view models the weaker RandomAccess2DImageViewConcept, and does not model PixelBasedConcept. Many generic algorithms don't require the elements to be pixels.

Member Typedef Documentation

template<typename Loc>
typedef image_view<typename Loc::const_t> boost::gil::image_view< Loc >::const_t
template<typename Loc>
typedef Loc::coord_t boost::gil::image_view< Loc >::coord_t
template<typename Loc>
typedef coord_t boost::gil::image_view< Loc >::difference_type
template<typename Loc>
typedef iterator_from_2d<Loc> boost::gil::image_view< Loc >::iterator
template<typename Loc>
typedef Loc boost::gil::image_view< Loc >::locator
template<typename Loc>
typedef Loc::point_t boost::gil::image_view< Loc >::point_t
template<typename Loc>
typedef Loc::reference boost::gil::image_view< Loc >::reference
template<typename Loc>
typedef std::reverse_iterator<iterator> boost::gil::image_view< Loc >::reverse_iterator
template<typename Loc>
typedef std::size_t boost::gil::image_view< Loc >::size_type
template<typename Loc>
typedef Loc::value_type boost::gil::image_view< Loc >::value_type
template<typename Loc>
typedef xy_locator::x_coord_t boost::gil::image_view< Loc >::x_coord_t
template<typename Loc>
typedef xy_locator::x_iterator boost::gil::image_view< Loc >::x_iterator
template<typename Loc>
typedef locator boost::gil::image_view< Loc >::xy_locator
template<typename Loc>
typedef xy_locator::y_coord_t boost::gil::image_view< Loc >::y_coord_t
template<typename Loc>
typedef xy_locator::y_iterator boost::gil::image_view< Loc >::y_iterator

Constructor & Destructor Documentation

template<typename Loc>
boost::gil::image_view< Loc >::image_view ( )
inline
template<typename Loc>
template<typename View >
boost::gil::image_view< Loc >::image_view ( const View &  iv)
inline
template<typename Loc>
template<typename L2 >
boost::gil::image_view< Loc >::image_view ( const point_t sz,
const L2 &  loc 
)
inline
template<typename Loc>
template<typename L2 >
boost::gil::image_view< Loc >::image_view ( coord_t  width,
coord_t  height,
const L2 &  loc 
)
inline

Member Function Documentation

template<typename Loc>
iterator boost::gil::image_view< Loc >::at ( const point_t p) const
inline
template<typename Loc>
template<std::size_t D>
axis<D>::iterator boost::gil::image_view< Loc >::axis_iterator ( const point_t p) const
inline
template<typename Loc>
y_iterator boost::gil::image_view< Loc >::col_begin ( x_coord_t  x) const
inline
template<typename Loc>
y_iterator boost::gil::image_view< Loc >::col_end ( x_coord_t  x) const
inline
template<typename Loc>
bool boost::gil::image_view< Loc >::is_1d_traversable ( ) const
inline
template<typename Loc>
std::size_t boost::gil::image_view< Loc >::num_channels ( ) const
inline
template<typename Loc>
template<typename View >
bool boost::gil::image_view< Loc >::operator!= ( const View &  v) const
inline
template<typename Loc>
reference boost::gil::image_view< Loc >::operator() ( const point_t p) const
inline
template<typename Loc>
reference boost::gil::image_view< Loc >::operator() ( x_coord_t  x,
y_coord_t  y 
) const
inline
template<typename Loc>
template<typename View >
image_view& boost::gil::image_view< Loc >::operator= ( const View &  iv)
inline
template<typename Loc>
image_view& boost::gil::image_view< Loc >::operator= ( const image_view< Loc > &  iv)
inline
template<typename Loc>
template<typename View >
bool boost::gil::image_view< Loc >::operator== ( const View &  v) const
inline
template<typename Loc>
reference boost::gil::image_view< Loc >::operator[] ( difference_type  i) const
inline
template<typename Loc>
reverse_iterator boost::gil::image_view< Loc >::rbegin ( ) const
inline
template<typename Loc>
reverse_iterator boost::gil::image_view< Loc >::rend ( ) const
inline
template<typename Loc>
x_iterator boost::gil::image_view< Loc >::row_begin ( y_coord_t  y) const
inline
template<typename Loc>
x_iterator boost::gil::image_view< Loc >::row_end ( y_coord_t  y) const
inline
template<typename Loc>
x_iterator boost::gil::image_view< Loc >::x_at ( x_coord_t  x,
y_coord_t  y 
) const
inline
template<typename Loc>
x_iterator boost::gil::image_view< Loc >::x_at ( const point_t p) const
inline
template<typename Loc>
xy_locator boost::gil::image_view< Loc >::xy_at ( x_coord_t  x,
y_coord_t  y 
) const
inline
template<typename Loc>
locator boost::gil::image_view< Loc >::xy_at ( const point_t p) const
inline
template<typename Loc>
y_iterator boost::gil::image_view< Loc >::y_at ( const point_t p) const
inline

Friends And Related Function Documentation

template<typename Loc>
template<typename L2 >
friend class image_view
friend
template<typename Loc>
template<typename L2 >
void swap ( image_view< L2 > &  x,
image_view< L2 > &  y 
)
friend

Member Data Documentation

template<typename Loc>
const std::size_t boost::gil::image_view< Loc >::num_dimensions =2
static

The documentation for this class was generated from the following file: