| 12
 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
 
 |  
#include <cstdlib>
#include <iostream>
#include "CImg-1-19/CImg.h"
 
using namespace std;
using namespace cimg_library;
 
int main(int argc, char *argv[]) {
  // Création d'une image 
  int nLargeur = 200;
  int nHauteur = 100;
  CImg<unsigned char> img(nLargeur, nHauteur, 1, 3);
 
  // Affichage des informations sur l'image
  cout << "Dimensions de l'image " << endl;
  cout << "- largeur    = " << img.width << endl;// largeur
  cout << "- hauteur    = " << img.height << endl;// hauteur
  cout << "- profondeur = " << img.depth << endl;// nombre de "slices"
  cout << "- dim        = " << img.dim << endl;// nombre de "vector channels"
  // img.data pointe vers un tableau de <T> (T = unsigned char ici)
  //...
  img.fill(255);// remplissage de l'image en blanc
  //
  //img.draw_line(ptAnt.X, ptAnt.Y, ptAct.X, ptAct.Y, clTrace);
  //
  std::string strM = "Toto.bmp";
  img.save_bmp(strM.c_str());
}//main | 
Partager