Code base obscuration (for images) 1.0
It implements different obscuration methods on portable images (.pgm and .ppm)
Loading...
Searching...
No Matches
ImageBase Class Reference

This class is a base class for images. It provides some basic functionalities for images. More...

#include <ImageBase.hpp>

Collaboration diagram for ImageBase:

Public Types

enum  PLAN { PLAN_R , PLAN_G , PLAN_B }
 Enumeration for the color planes of an image. More...
 

Public Member Functions

 ImageBase (void)
 Default constructor for the ImageBase class.
 
 ImageBase (const ImageBase &other)
 Copy constructor for the ImageBase class.
 
 ImageBase (int imWidth, int imHeight, bool isColor)
 Constructor for the ImageBase class with specified width, height, and color mode.
 
 ~ImageBase (void)
 Destructor for the ImageBase class.
 
int getHeight ()
 Gets the height of the image.
 
int getWidth ()
 Gets the width of the image.
 
int getTotalSize ()
 Gets the total size of the image data.
 
int getValidity ()
 Gets the validity flag of the image.
 
bool getColor ()
 Gets the color flag of the image.
 
unsigned char * getData ()
 Gets the pointer to the image data in unsigned char format.
 
void load (char *filename)
 Loads an image from a file.
 
bool save (char *filename)
 Saves the image to a file.
 
ImageBasegetPlan (PLAN plan)
 Gets a specific color plane of the image.
 
unsigned char * operator[] (int l)
 Overloaded operator[] to access the image data.
 

Protected Member Functions

void init ()
 Initializes the image object.
 
void reset ()
 Resets the image object.
 
void copy (const ImageBase &copy)
 Copies the data from another ImageBase object.
 

Protected Attributes

unsigned char * data
 
double * dataD
 
bool color
 
int height
 
int width
 
int nTaille
 
bool isValid
 
image_pgm img_pgm
 
image_ppm img_ppm
 

Detailed Description

This class is a base class for images. It provides some basic functionalities for images.

Author
Mickael Pinto
Date
October 2012

Member Enumeration Documentation

◆ PLAN

Enumeration for the color planes of an image.

Author
Mickael Pinto
Date
October 2012
Enumerator
PLAN_R 
PLAN_G 
PLAN_B 

Constructor & Destructor Documentation

◆ ImageBase() [1/3]

ImageBase::ImageBase ( void )

Default constructor for the ImageBase class.

Author
Mickael Pinto
Date
October 2012

◆ ImageBase() [2/3]

ImageBase::ImageBase ( const ImageBase & other)

Copy constructor for the ImageBase class.

Parameters
otherThe ImageBase object to copy.
Author
Mickael Pinto
Date
October 2012

◆ ImageBase() [3/3]

ImageBase::ImageBase ( int imWidth,
int imHeight,
bool isColor )

Constructor for the ImageBase class with specified width, height, and color mode.

Parameters
imWidthThe width of the image.
imHeightThe height of the image.
isColorFlag indicating if the image is in color or not.
Author
Mickael Pinto
Date
October 2012

◆ ~ImageBase()

ImageBase::~ImageBase ( void )

Destructor for the ImageBase class.

Author
Mickael Pinto
Date
October 2012

Member Function Documentation

◆ copy()

void ImageBase::copy ( const ImageBase & copy)
protected

Copies the data from another ImageBase object.

Parameters
copyThe ImageBase object to copy.
Author
Mickael Pinto
Date
October 2012

◆ getColor()

bool ImageBase::getColor ( )
inline

Gets the color flag of the image.

Returns
The color flag of the image.
Author
Mickael Pinto
Date
October 2012

◆ getData()

unsigned char * ImageBase::getData ( )
inline

Gets the pointer to the image data in unsigned char format.

Returns
The pointer to the image data in unsigned char format.
Author
Mickael Pinto
Date
October 2012

◆ getHeight()

int ImageBase::getHeight ( )
inline

Gets the height of the image.

Returns
The height of the image.
Author
Mickael Pinto
Date
October 2012

◆ getPlan()

ImageBase * ImageBase::getPlan ( PLAN plan)

Gets a specific color plane of the image.

Parameters
planThe color plane to get.
Returns
A new ImageBase object containing the specified color plane.
Author
Mickael Pinto
Date
October 2012

◆ getTotalSize()

int ImageBase::getTotalSize ( )
inline

Gets the total size of the image data.

Returns
The total size of the image data.
Author
Mickael Pinto
Date
October 2012

◆ getValidity()

int ImageBase::getValidity ( )
inline

Gets the validity flag of the image.

Returns
The validity flag of the image.
Author
Mickael Pinto
Date
October 2012

◆ getWidth()

int ImageBase::getWidth ( )
inline

Gets the width of the image.

Returns
The width of the image.
Author
Mickael Pinto
Date
October 2012

◆ init()

void ImageBase::init ( )
protected

Initializes the image object.

Author
Mickael Pinto
Date
October 2012

◆ load()

void ImageBase::load ( char * filename)

Loads an image from a file.

Parameters
filenameThe name of the file to load.
Author
Mickael Pinto
Date
October 2012

◆ operator[]()

unsigned char * ImageBase::operator[] ( int l)

Overloaded operator[] to access the image data.

Parameters
lThe index of the data to access.
Returns
A pointer to the image data at the specified index.
Author
Mickael Pinto
Date
October 2012

◆ reset()

void ImageBase::reset ( )
protected

Resets the image object.

Author
Mickael Pinto
Date
October 2012

◆ save()

bool ImageBase::save ( char * filename)

Saves the image to a file.

Parameters
filenameThe name of the file to save.
Returns
True if the image was saved successfully, false otherwise.
Author
Mickael Pinto
Date
October 2012

Member Data Documentation

◆ color

bool ImageBase::color
protected

Flag indicating if the image is in color or not

◆ data

unsigned char* ImageBase::data
protected

Pointer to the image data in unsigned char format

◆ dataD

double* ImageBase::dataD
protected

Pointer to the image data in double format

◆ height

int ImageBase::height
protected

Height of the image

◆ img_pgm

image_pgm ImageBase::img_pgm
protected

Object for handling PGM images

◆ img_ppm

image_ppm ImageBase::img_ppm
protected

Object for handling PPM images

◆ isValid

bool ImageBase::isValid
protected

Flag indicating if the image is valid or not

◆ nTaille

int ImageBase::nTaille
protected

Total size of the image data

◆ width

int ImageBase::width
protected

Width of the image