INFO804 Introduction à l'informatique graphique
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
rt::Image2D< TValue > Class Template Reference

Classe générique pour représenter des images 2D. More...

#include <Image2D.h>

Classes

struct  ConstIterator
 
struct  GenericConstIterator
 
struct  GenericIterator
 
struct  Iterator
 Un itérateur (non-constant) simple sur l'image. More...
 

Public Types

typedef Image2D< TValueSelf
 
typedef TValue Value
 
typedef std::vector< Value > Container
 
typedef Container::iterator ContainerIterator
 
typedef Container::const_iterator ContainerConstIterator
 

Public Member Functions

 Image2D (int w, int h, Value g=Value())
 
void fill (Value g)
 
int w () const
 
int h () const
 
Iterator begin ()
 
Iterator end ()
 
Iterator start (int x, int y)
 
template<typename Accessor >
GenericConstIterator< Accessor > start (int x=0, int y=0) const
 
template<typename Accessor >
GenericConstIterator< Accessor > begin () const
 
template<typename Accessor >
GenericConstIterator< Accessor > end () const
 
template<typename Accessor >
GenericIterator< Accessor > start (int x=0, int y=0)
 
template<typename Accessor >
GenericIterator< Accessor > begin ()
 
template<typename Accessor >
GenericIterator< Accessor > end ()
 
Value at (int i, int j) const
 
Value & at (int i, int j)
 

Detailed Description

template<typename TValue>
class rt::Image2D< TValue >

Classe générique pour représenter des images 2D.

Definition at line 10 of file Image2D.h.

Member Typedef Documentation

◆ Container

template<typename TValue >
typedef std::vector<Value> rt::Image2D< TValue >::Container

Definition at line 14 of file Image2D.h.

◆ ContainerConstIterator

template<typename TValue >
typedef Container::const_iterator rt::Image2D< TValue >::ContainerConstIterator

Definition at line 16 of file Image2D.h.

◆ ContainerIterator

template<typename TValue >
typedef Container::iterator rt::Image2D< TValue >::ContainerIterator

Definition at line 15 of file Image2D.h.

◆ Self

Definition at line 12 of file Image2D.h.

◆ Value

Definition at line 13 of file Image2D.h.

Constructor & Destructor Documentation

◆ Image2D() [1/2]

template<typename TValue >
rt::Image2D< TValue >::Image2D ( )

Definition at line 157 of file Image2D.h.

158 : m_data(), m_width( 0 ), m_height( 0 )
159{}

◆ Image2D() [2/2]

template<typename TValue >
rt::Image2D< TValue >::Image2D ( int  w,
int  h,
Value  g = Value() 
)

Definition at line 162 of file Image2D.h.

163 : m_data( w*h, g ), m_width( w ), m_height( h )
164{}
int h() const
Definition Image2D.h:180
int w() const
Definition Image2D.h:175

Member Function Documentation

◆ at() [1/2]

template<typename TValue >
Image2D< TValue >::Value & rt::Image2D< TValue >::at ( int  i,
int  j 
)

Accesseur read-write à la valeur d'un pixel.

Returns
une référence à la valeur du pixel(i,j)

Definition at line 192 of file Image2D.h.

193{
194 return m_data[ index( i, j ) ];
195}

◆ at() [2/2]

template<typename TValue >
Image2D< TValue >::Value rt::Image2D< TValue >::at ( int  i,
int  j 
) const

Accesseur read-only à la valeur d'un pixel.

Returns
la valeur du pixel(i,j)

Definition at line 185 of file Image2D.h.

186{
187 return m_data[ index( i, j ) ];
188}

◆ begin() [1/3]

template<typename TValue >
Iterator rt::Image2D< TValue >::begin ( )
inline
Returns
un itérateur pointant sur le début de l'image

Definition at line 109 of file Image2D.h.

109{ return start( 0, 0 ); }
Iterator start(int x, int y)
Definition Image2D.h:113

◆ begin() [2/3]

template<typename TValue >
template<typename Accessor >
GenericIterator< Accessor > rt::Image2D< TValue >::begin ( )
inline

Definition at line 132 of file Image2D.h.

133 { return start< Accessor >( 0, 0 ); }

◆ begin() [3/3]

template<typename TValue >
template<typename Accessor >
GenericConstIterator< Accessor > rt::Image2D< TValue >::begin ( ) const
inline

Definition at line 120 of file Image2D.h.

121 { return start< Accessor >( 0, 0 ); }

◆ end() [1/3]

template<typename TValue >
Iterator rt::Image2D< TValue >::end ( )
inline
Returns
un itérateur pointant après la fin de l'image

Definition at line 111 of file Image2D.h.

111{ return start( 0, h() ); }

◆ end() [2/3]

template<typename TValue >
template<typename Accessor >
GenericIterator< Accessor > rt::Image2D< TValue >::end ( )
inline

Definition at line 136 of file Image2D.h.

137 { return start< Accessor >( 0, h() ); }

◆ end() [3/3]

template<typename TValue >
template<typename Accessor >
GenericConstIterator< Accessor > rt::Image2D< TValue >::end ( ) const
inline

Definition at line 124 of file Image2D.h.

125 { return start< Accessor >( 0, h() ); }

◆ fill()

template<typename TValue >
void rt::Image2D< TValue >::fill ( Value  g)

Definition at line 168 of file Image2D.h.

169{
170 m_data.fill( g );
171}

◆ h()

template<typename TValue >
int rt::Image2D< TValue >::h ( ) const
Returns
la hauteur de l'image.

Definition at line 180 of file Image2D.h.

181{ return m_height; }

◆ start() [1/3]

template<typename TValue >
Iterator rt::Image2D< TValue >::start ( int  x,
int  y 
)
inline
Returns
un itérateur pointant sur le pixel (x,y).

Definition at line 113 of file Image2D.h.

113{ return Iterator( *this, x, y ); }

◆ start() [2/3]

template<typename TValue >
template<typename Accessor >
GenericIterator< Accessor > rt::Image2D< TValue >::start ( int  x = 0,
int  y = 0 
)
inline

Definition at line 128 of file Image2D.h.

129 { return GenericIterator< Accessor >( *this, x, y ); }

◆ start() [3/3]

template<typename TValue >
template<typename Accessor >
GenericConstIterator< Accessor > rt::Image2D< TValue >::start ( int  x = 0,
int  y = 0 
) const
inline

Definition at line 116 of file Image2D.h.

117 { return GenericConstIterator< Accessor >( *this, x, y ); }

◆ w()

template<typename TValue >
int rt::Image2D< TValue >::w ( ) const
Returns
la largeur de l'image.

Definition at line 175 of file Image2D.h.

176{ return m_width; }

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