-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestColorImage2D.cpp
More file actions
53 lines (35 loc) · 1.04 KB
/
testColorImage2D.cpp
File metadata and controls
53 lines (35 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//
// Created by Clément.
//
#include <iostream>
#include <fstream>
#include "Image2D.hpp"
#include "Color.hpp"
#include "Image2DWriter.hpp"
#include "Image2DReader.hpp"
int main(int argc, char **argv) {
typedef Image2D<Color> ColorImage2D;
typedef ColorImage2D::Iterator Iterator;
typedef ColorImage2D::ConstIterator ConstIterator;
if (argc < 3) {
std::cerr << "Commande : testColor <input.pgm> <output.pgm>" << std::endl;
return 0;
}
ColorImage2D img;
std::ifstream input(argv[1]);
bool ok = Image2DReader<Color>::read(img, input);
if (!ok) {
std::cerr << "Erreur lors de la lecture du fichier !" << std::endl;
return 1;
}
input.close();
std::cout << "L'import a été réussi !" << std::endl;
std::ofstream output(argv[2]);
bool ok2 = Image2DWriter<Color>::write(img, output, false);
if (!ok2) {
std::cerr << "Une erreur s'est produite lors de l'écriture du fichier !" << std::endl;
return 1;
}
output.close();
return 0;
}