image_view Class Template Reference
[ModelsModels]

#include <image_view.hpp>

List of all members.


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.


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

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

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_t & dimensions () const
const locator & pixels () const
x_coord_t width () const
y_coord_t height () const
std::size_t num_channels () const
bool is_1d_traversable () const

Static Public Attributes

static const std::size_t num_dimensions = 2

Friends

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

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

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google