The blo Library
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
blo::Image< T, C > Class Template Reference

Image. More...

#include <Image.h>

Classes

class  RowProxy
 Image row proxy. More...
 

Public Member Functions

 Image ()=default
 Default constructor.
 
 Image (int width, int height)
 Constructs image of specified size.
 
 Image (int width, int height, const T val[])
 Constructs image of specified size and pixel value.
 
 Image (const T *pSrc, int srcStep, int width, int height)
 Constructs image that is a copy of specified image.
 
 Image (const Image &rhs)
 Copy constructor.
 
 Image (Image &&rhs) noexcept
 Move constructor.
 
virtual ~Image ()
 Destructor.
 
Image & operator= (const Image &rhs)
 Copy assignment operator.
 
Image & operator= (Image &&rhs) noexcept
 Move assignment operator.
 
RowProxy operator[] (int row)
 Index image row.
 
const RowProxy operator[] (int row) const
 Index image row.
 
bool empty () const
 Tests if the image is empty.
 
void resize (int width, int height)
 Resizes image.
 
void clear ()
 Resizes image to zero width and zero height.
 
int rows () const
 Number of rows in the image.
 
int height () const
 Height of the image.
 
int columns () const
 Number of columns in the image.
 
int width () const
 Width of the image.
 
T * ptrData ()
 Retrieves the pointer to the beginning of the image.
 
const T * ptrData () const
 Retrieves the pointer to the beginning of the image.
 
int step () const
 Step in bytes between the rows in the image.
 
void swap (Image &rhs)
 Swaps this image with another one.
 
void set (const T val[])
 Sets image pixels to a value.
 

Static Public Member Functions

static int channels ()
 Number of channels in the image.
 

Detailed Description

template<typename T, size_t C>
class blo::Image< T, C >

Image.

Template Parameters
TData type.
CNumber of channels.

Constructor & Destructor Documentation

◆ Image() [1/6]

template<typename T , size_t C>
blo::Image< T, C >::Image ( )
default

Default constructor.

◆ Image() [2/6]

template<typename T , size_t C>
blo::Image< T, C >::Image ( int  width,
int  height 
)

Constructs image of specified size.

Parameters
widthWidth of the image in pixels.
heightHeight of the image in pixels.

◆ Image() [3/6]

template<typename T , size_t C>
blo::Image< T, C >::Image ( int  width,
int  height,
const T  val[] 
)

Constructs image of specified size and pixel value.

Parameters
widthWidth of the image in pixels.
heightHeight of the image in pixels.
valConstant value to assign to each pixel in the image.

◆ Image() [4/6]

template<typename T , size_t C>
blo::Image< T, C >::Image ( const T *  pSrc,
int  srcStep,
int  width,
int  height 
)

Constructs image that is a copy of specified image.

Parameters
pSrcPointer to the source image.
srcStepStep in bytes between the rows in the source image.
widthWidth of the image in pixels.
heightHeight of the image in pixels.

◆ Image() [5/6]

template<typename T , size_t C>
blo::Image< T, C >::Image ( const Image< T, C > &  rhs)

Copy constructor.

◆ Image() [6/6]

template<typename T , size_t C>
blo::Image< T, C >::Image ( Image< T, C > &&  rhs)
noexcept

Move constructor.

◆ ~Image()

template<typename T , size_t C>
virtual blo::Image< T, C >::~Image ( )
virtual

Destructor.

Member Function Documentation

◆ channels()

template<typename T , size_t C>
static int blo::Image< T, C >::channels ( )
static

Number of channels in the image.

Returns
Number of channels in the image.

◆ clear()

template<typename T , size_t C>
void blo::Image< T, C >::clear ( )

Resizes image to zero width and zero height.

◆ columns()

template<typename T , size_t C>
int blo::Image< T, C >::columns ( ) const

Number of columns in the image.

Returns
Number of columns in the image.

◆ empty()

template<typename T , size_t C>
bool blo::Image< T, C >::empty ( ) const

Tests if the image is empty.

Returns
true if image is empty, false otherwise.

◆ height()

template<typename T , size_t C>
int blo::Image< T, C >::height ( ) const

Height of the image.

Returns
Height of the image in pixels.

◆ operator=() [1/2]

template<typename T , size_t C>
Image & blo::Image< T, C >::operator= ( const Image< T, C > &  rhs)

Copy assignment operator.

◆ operator=() [2/2]

template<typename T , size_t C>
Image & blo::Image< T, C >::operator= ( Image< T, C > &&  rhs)
noexcept

Move assignment operator.

◆ operator[]() [1/2]

template<typename T , size_t C>
RowProxy blo::Image< T, C >::operator[] ( int  row)

Index image row.

Note
Index image pixel using image[row][column].
Parameters
rowRow of the image.
Returns
Proxy of the image row.

◆ operator[]() [2/2]

template<typename T , size_t C>
const RowProxy blo::Image< T, C >::operator[] ( int  row) const

Index image row.

Note
Index image pixel using image[row][column].
Parameters
rowRow of the image.
Returns
Proxy of the image row.

◆ ptrData() [1/2]

template<typename T , size_t C>
T * blo::Image< T, C >::ptrData ( )

Retrieves the pointer to the beginning of the image.

Returns
Pointer to the pixel at coordinates (0, 0).

◆ ptrData() [2/2]

template<typename T , size_t C>
const T * blo::Image< T, C >::ptrData ( ) const

Retrieves the pointer to the beginning of the image.

Returns
Pointer to the beginning of the image.

◆ resize()

template<typename T , size_t C>
void blo::Image< T, C >::resize ( int  width,
int  height 
)

Resizes image.

Parameters
widthWidth in pixels to resize image to.
heightHeight in pixels to resize image to.

◆ rows()

template<typename T , size_t C>
int blo::Image< T, C >::rows ( ) const

Number of rows in the image.

Returns
Number of rows in the image.

◆ set()

template<typename T , size_t C>
void blo::Image< T, C >::set ( const T  val[])

Sets image pixels to a value.

Parameters
valConstant value to assign to each pixel in the image.

◆ step()

template<typename T , size_t C>
int blo::Image< T, C >::step ( ) const

Step in bytes between the rows in the image.

Returns
Step in bytes between the rows in the image.

◆ swap()

template<typename T , size_t C>
void blo::Image< T, C >::swap ( Image< T, C > &  rhs)

Swaps this image with another one.

◆ width()

template<typename T , size_t C>
int blo::Image< T, C >::width ( ) const

Width of the image.

Returns
Width of the image in pixels.

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