RigsofRods
Soft-body Physics Simulation
Data Structures | Public Types | Public Member Functions | Private Member Functions | Private Attributes
Hydrax::Image Class Reference

Class for store variable channels of an image. More...

#include <Image.h>

+ Collaboration diagram for Hydrax::Image:

Data Structures

struct  Pixel
 Pixel structure. More...
 

Public Types

enum  Type { TYPE_ONE_CHANNEL = 1, TYPE_TWO_CHANNELS = 2, TYPE_RGB = 3, TYPE_RGBA = 4 }
 Image type enum. More...
 
enum  Channel { CHANNEL_R = 0, CHANNEL_G = 1, CHANNEL_B = 2, CHANNEL_A = 3 }
 Channel enum. More...
 

Public Member Functions

 Image (const Size &Size)
 Constructor. More...
 
 Image (const Size &Size, const Type &Type)
 Constructor. More...
 
 Image (const Size &Size, const Type &Type, const float &v)
 Constructor. More...
 
 ~Image ()
 Destructor. More...
 
const float & getValue (const int &x, const int &y, const int &c) const
 Get a pixel value. More...
 
float getValueLI (const float &x, const float &y, const int &c) const
 Get a pixel value with linear interpolation, like x = 4.56, y = 8.34. More...
 
const float & getValue (const int &x, const int &y, const Channel &c) const
 Get a pixel value. More...
 
float getValueLI (const float &x, const float &y, const Channel &c) const
 Get a pixel value with linear interpolation, like x = 4.56, y = 8.34. More...
 
Pixel getPixel (const int &x, const int &y) const
 Get a pixel. More...
 
Pixel getPixelLI (const float &x, const float &y) const
 Get a pixel with linear interpolation, like x = 4.56, y = 8.34. More...
 
void setValue (const int &x, const int &y, const int &c, const float &v)
 Set a pixel value. More...
 
void setValue (const int &x, const int &y, const Channel &c, const float &v)
 Set a pixel value. More...
 
void setPixel (const int &x, const int &y, const Pixel &p)
 Set a pixel. More...
 
Size getSize () const
 Get image size. More...
 
Type getType () const
 Get image type. More...
 
const int & getNumberOfChannels () const
 Get number of channels. More...
 

Private Member Functions

void _Initialize (const float &v)
 Initialize array (Reserve dynamic memory) More...
 

Private Attributes

Size mSize
 Image size. More...
 
int mChannels
 Number of channels. More...
 
float * mData
 Our image data. More...
 

Detailed Description

Class for store variable channels of an image.

Definition at line 42 of file Image.h.

Member Enumeration Documentation

◆ Channel

Channel enum.

Enumerator
CHANNEL_R 
CHANNEL_G 
CHANNEL_B 
CHANNEL_A 

Definition at line 58 of file Image.h.

◆ Type

Image type enum.

Enumerator
TYPE_ONE_CHANNEL 
TYPE_TWO_CHANNELS 
TYPE_RGB 
TYPE_RGBA 

Default.

Definition at line 47 of file Image.h.

Constructor & Destructor Documentation

◆ Image() [1/3]

Hydrax::Image::Image ( const Size Size)

Constructor.

Parameters
SizeImage size

Definition at line 29 of file Image.cpp.

+ Here is the call graph for this function:

◆ Image() [2/3]

Hydrax::Image::Image ( const Size Size,
const Type Type 
)

Constructor.

Parameters
SizeImage size
TypeImage type

Definition at line 37 of file Image.cpp.

+ Here is the call graph for this function:

◆ Image() [3/3]

Hydrax::Image::Image ( const Size Size,
const Type Type,
const float &  v 
)

Constructor.

Parameters
SizeImage size
TypeImage type
vInitial channel values

Definition at line 45 of file Image.cpp.

+ Here is the call graph for this function:

◆ ~Image()

Hydrax::Image::~Image ( )

Destructor.

Definition at line 53 of file Image.cpp.

Member Function Documentation

◆ _Initialize()

void Hydrax::Image::_Initialize ( const float &  v)
private

Initialize array (Reserve dynamic memory)

Parameters
vInitial values

Definition at line 239 of file Image.cpp.

+ Here is the caller graph for this function:

◆ getNumberOfChannels()

const int& Hydrax::Image::getNumberOfChannels ( ) const
inline

Get number of channels.

Returns
Number of channels

Definition at line 253 of file Image.h.

◆ getPixel()

Image::Pixel Hydrax::Image::getPixel ( const int &  x,
const int &  y 
) const

Get a pixel.

Parameters
xX value
yY value
Returns
Pixel

Definition at line 114 of file Image.cpp.

+ Here is the call graph for this function:

◆ getPixelLI()

Image::Pixel Hydrax::Image::getPixelLI ( const float &  x,
const float &  y 
) const

Get a pixel with linear interpolation, like x = 4.56, y = 8.34.

Parameters
xX value
yY value
Returns
Pixel

Definition at line 144 of file Image.cpp.

+ Here is the call graph for this function:

◆ getSize()

Size Hydrax::Image::getSize ( ) const
inline

Get image size.

Returns
Image size

Definition at line 237 of file Image.h.

+ Here is the caller graph for this function:

◆ getType()

Type Hydrax::Image::getType ( ) const
inline

Get image type.

Returns
Image type

Definition at line 245 of file Image.h.

+ Here is the caller graph for this function:

◆ getValue() [1/2]

const float& Hydrax::Image::getValue ( const int &  x,
const int &  y,
const Channel c 
) const
inline

Get a pixel value.

Parameters
xX value
yY value
cChannel
Returns
Pixel channel value

Definition at line 176 of file Image.h.

+ Here is the call graph for this function:

◆ getValue() [2/2]

const float & Hydrax::Image::getValue ( const int &  x,
const int &  y,
const int &  c 
) const

Get a pixel value.

Parameters
xX value
yY value
cChannel
Returns
Pixel channel value

Definition at line 58 of file Image.cpp.

+ Here is the caller graph for this function:

◆ getValueLI() [1/2]

float Hydrax::Image::getValueLI ( const float &  x,
const float &  y,
const Channel c 
) const
inline

Get a pixel value with linear interpolation, like x = 4.56, y = 8.34.

Parameters
xX value
yY value
cChannel
Returns
Pixel channel value

Definition at line 188 of file Image.h.

+ Here is the call graph for this function:

◆ getValueLI() [2/2]

float Hydrax::Image::getValueLI ( const float &  x,
const float &  y,
const int &  c 
) const

Get a pixel value with linear interpolation, like x = 4.56, y = 8.34.

Parameters
xX value
yY value
cChannel
Returns
Pixel channel value

Definition at line 76 of file Image.cpp.

+ Here is the caller graph for this function:

◆ setPixel()

void Hydrax::Image::setPixel ( const int &  x,
const int &  y,
const Pixel p 
)

Set a pixel.

Parameters
xX value
yY value
pPixel

Definition at line 192 of file Image.cpp.

+ Here is the call graph for this function:

◆ setValue() [1/2]

void Hydrax::Image::setValue ( const int &  x,
const int &  y,
const Channel c,
const float &  v 
)
inline

Set a pixel value.

Parameters
xX value
yY value
cChannel
vValue

Definition at line 222 of file Image.h.

+ Here is the call graph for this function:

◆ setValue() [2/2]

void Hydrax::Image::setValue ( const int &  x,
const int &  y,
const int &  c,
const float &  v 
)

Set a pixel value.

Parameters
xX value
yY value
cChannel
vValue

Definition at line 174 of file Image.cpp.

+ Here is the caller graph for this function:

Field Documentation

◆ mChannels

int Hydrax::Image::mChannels
private

Number of channels.

Definition at line 267 of file Image.h.

◆ mData

float* Hydrax::Image::mData
private

Our image data.

Definition at line 270 of file Image.h.

◆ mSize

Size Hydrax::Image::mSize
private

Image size.

Definition at line 265 of file Image.h.


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