Code base obscuration (for images) 1.0
It implements different obscuration methods on portable images (.pgm and .ppm)
Loading...
Searching...
No Matches
ImageBase.hpp
Go to the documentation of this file.
1
8#pragma once
9#include <cstdio>
10#include <cstdlib>
11#include "image_pgm.hpp"
12#include "image_ppm.hpp"
13
21{
23public:
29 typedef enum
30 {
33 PLAN_B
35
37protected:
38 unsigned char *data;
39 double *dataD;
41 bool color;
42 int height;
43 int width;
44 int nTaille;
45 bool isValid;
50protected:
56 void init();
62 void reset();
63
64public:
70 ImageBase(void);
71
78 ImageBase(const ImageBase &other);
79
88 ImageBase(int imWidth, int imHeight, bool isColor);
89
95 ~ImageBase(void);
96
98protected:
105 void copy(const ImageBase &copy);
106
107public:
114 int getHeight() { return height; };
121 int getWidth() { return width; };
122
129 int getTotalSize() { return nTaille; };
136 int getValidity() { return isValid; };
143 bool getColor() { return color; };
150 unsigned char *getData() { return data; };
157 void load(char *filename);
158
166 bool save(char *filename);
174 ImageBase *getPlan(PLAN plan);
182 unsigned char *operator[](int l);
183};
This class is a base class for images. It provides some basic functionalities for images.
Definition ImageBase.hpp:21
unsigned char * operator[](int l)
Overloaded operator[] to access the image data.
Definition ImageBase.cpp:211
int getValidity()
Gets the validity flag of the image.
Definition ImageBase.hpp:136
bool color
Definition ImageBase.hpp:41
ImageBase * getPlan(PLAN plan)
Gets a specific color plane of the image.
Definition ImageBase.cpp:157
bool save(char *filename)
Saves the image to a file.
Definition ImageBase.cpp:141
image_ppm img_ppm
Definition ImageBase.hpp:48
bool getColor()
Gets the color flag of the image.
Definition ImageBase.hpp:143
image_pgm img_pgm
Definition ImageBase.hpp:47
double * dataD
Definition ImageBase.hpp:39
unsigned char * data
Definition ImageBase.hpp:38
PLAN
Enumeration for the color planes of an image.
Definition ImageBase.hpp:30
@ PLAN_B
Definition ImageBase.hpp:33
@ PLAN_G
Definition ImageBase.hpp:32
@ PLAN_R
Definition ImageBase.hpp:31
void init()
Initializes the image object.
Definition ImageBase.cpp:72
void reset()
Resets the image object.
Definition ImageBase.cpp:86
bool isValid
Definition ImageBase.hpp:45
ImageBase(void)
Default constructor for the ImageBase class.
Definition ImageBase.cpp:18
~ImageBase(void)
Destructor for the ImageBase class.
Definition ImageBase.cpp:67
int nTaille
Definition ImageBase.hpp:44
int getWidth()
Gets the width of the image.
Definition ImageBase.hpp:121
int width
Definition ImageBase.hpp:43
int getTotalSize()
Gets the total size of the image data.
Definition ImageBase.hpp:129
int height
Definition ImageBase.hpp:42
void load(char *filename)
Loads an image from a file.
Definition ImageBase.cpp:96
int getHeight()
Gets the height of the image.
Definition ImageBase.hpp:114
void copy(const ImageBase &copy)
Copies the data from another ImageBase object.
Definition ImageBase.cpp:184
unsigned char * getData()
Gets the pointer to the image data in unsigned char format.
Definition ImageBase.hpp:150
The image_pgm class provides methods to read and write PGM images with various bit depths.
Definition image_pgm.hpp:30
This class represents a PPM image and provides methods to read and write PPM images,...
Definition image_ppm.hpp:31
This file contains the declaration of the image_pgm class, which is used to read and write PGM images...
This header file defines the image_ppm class, which is derived from image_portable.