From f237beee15c9b9d0abe221974d5a9fc40ad898b3 Mon Sep 17 00:00:00 2001 From: Geoffrey Frogeye Date: Sat, 3 May 2014 19:57:33 +0200 Subject: [PATCH] Instructions pour Travis CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ajout de .travis.yml * Modification de l'instruction test en testing (ne fait pas la même chose que les test habituels) * Ajout d'une image par défaut dans test.cpp * Corrections d'erreurs qui empêchaient la compilation --- .travis.yml | 6 ++ Makefile | 2 +- README.md | 4 +- src/analyserCommande.cpp | 2 +- src/main.cpp | 1 + src/test.cpp | 117 ++++++++++++++++++++++++++++++--------- src/traitementImage.cpp | 2 +- 7 files changed, 103 insertions(+), 31 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..714eb08 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: cpp +compiler: gcc +before_install: + - sudo apt-get update -qq + - sudo apt-get install -y libsdl1.2-dev +script: make && make testing \ No newline at end of file diff --git a/Makefile b/Makefile index af30eff..8210993 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ SRCPATH = src/ main: main.o image.o $(CXX) $(OBJPATH)main.o $(OBJPATH)image.o -o $(EXEPATH)$@ $(CXXFLAGS) -test: test.o image.o +testing: test.o image.o $(CXX) $(OBJPATH)test.o $(OBJPATH)image.o -o $(EXEPATH)$@ $(CXXFLAGS) # Dépendances diff --git a/README.md b/README.md index 84707d4..d29532d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,9 @@ Nos noms complets et le nom du lycée sont masqués pour des raisons d'intimité ###Le programme Ce programme est un éditeur basique d'images [PBM/PGM/PPM](http://fr.wikipedia.org/wiki/Portable_pixmap) s’exécutant en ligne de commande. -*Statut :* Prétotype +*Version :* Prétotype + +*Status :* [![Build Status](https://travis-ci.org/GeoffreyFrogeye/PILG.svg?branch=master)](https://travis-ci.org/GeoffreyFrogeye/PILG) ##Compilation Il n'existe pas de fichier binaire à télécharger pour le moment, le seul moyen d'avoir un aperçu du programme est de le compiler. diff --git a/src/analyserCommande.cpp b/src/analyserCommande.cpp index 25a9d17..5abe7d7 100644 --- a/src/analyserCommande.cpp +++ b/src/analyserCommande.cpp @@ -1,3 +1,3 @@ -function analyserCommande(string nom) { +int analyserCommande(string nom) { } diff --git a/src/main.cpp b/src/main.cpp index 90b09ac..c7d2503 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,6 +2,7 @@ #include #include "affichageFenetreSDL.cpp" +#include "image.h" using namespace std; diff --git a/src/test.cpp b/src/test.cpp index ec5f461..6ff089d 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -13,38 +13,103 @@ int main(int argc, char *args[]) { freopen("CON", "w", stderr); #endif - cout << "TEST AFFICHAGE FENETRE" << endl; // Message d'entrée et de test + cout << "PILG - Debug" << endl; // Message d'entrée et de test - int dimX = 640, dimY = 480; - ouvrirFenetre(dimX, dimY, "Test affichage fenêtre"); + int dimX = 640, dimY = 128; + ouvrirFenetre(dimX, dimY, "PILG - Fenêtre de debug"); - Image image(dimX, dimY, 255, PILG_RVB); - int x, y, c; - Pixel point; - point = image.g_pixelVide(); - // cout << "R : " << point.r << " - V : " << point.v << " - B : " << point.b << endl; // DEBUG + // Création imageRoue + Image imageRoue(dimX, dimY, 255, PILG_RVB); + Pixel pointRoue = imageRoue.g_pixelVide(); + int x, y, step; + float substep, lum; + for (x = 0; x < dimX; x++) { + for (y = 0; y < dimY; y++) { + step = (x * 6.0) / dimX; + substep = (x - step * (dimX / 6.0)) / (dimX / 6.0)*255; + lum = 1-((float) y)/dimY; + switch (step) { + case 0: + pointRoue.r = 255; + pointRoue.v = substep; + pointRoue.b = 0; + break; + case 1: + pointRoue.r = 255-substep; + pointRoue.v = 255; + pointRoue.b = 0; + break; + case 2: + pointRoue.r = 0; + pointRoue.v = 255; + pointRoue.b = substep; + break; + case 3: + pointRoue.r = 0; + pointRoue.v = 255-substep; + pointRoue.b = 255; + break; + case 4: + pointRoue.r = substep; + pointRoue.v = 0; + pointRoue.b = 255; + break; + case 5: + pointRoue.r = 255; + pointRoue.v = 0; + pointRoue.b = 255-substep; + break; + } + // Dégradé vers le noir + pointRoue.r = pointRoue.r*lum; + pointRoue.v = pointRoue.v*lum; + pointRoue.b = pointRoue.b*lum; + // // Ajout de luminosité + // pointRoue.r = pointRoue.r + 50; + // pointRoue.v = pointRoue.v + 50; + // pointRoue.b = pointRoue.b + 50; + + // Remise dans l'intervalle + pointRoue.r = (pointRoue.r > 255 ? 255 : pointRoue.r); + pointRoue.v = (pointRoue.v > 255 ? 255 : pointRoue.v); + pointRoue.b = (pointRoue.b > 255 ? 255 : pointRoue.b); + + if (imageRoue.s_point(x, y, pointRoue) == 1) { + cerr << "Erreur : s_point() a été entré avec des valeurs incorrectes" << endl; + cout << "X : " << x << " - Y: " << y << " - R : " << pointRoue.r << " - V : " << pointRoue.v << " - B : " << pointRoue.b << endl; // DEBUG + return 1; + } + imageRoue.g_point(x, y, pointRoue); + pointFenetre(x, y, pointRoue.r, pointRoue.v, pointRoue.b); + } + } + afficherFenetre(); // Cycle de couleurs avec utilisation d'Image - for (c = 0; c < 256; c++) { // À peu près 28 FPS avec SDL - for (x = 0; x < dimX; x++) { - for (y = 0; y < dimY; y++) { - point.r = c; - point.v = image.g_maxComposante() - c; - point.b = 0; - if (image.s_point(x, y, point) == 1) { - cerr << "Erreur : s_point() a été entré avec des valeurs incorrectes" << endl; - cout << "X : " << x << " - Y: " << y << " - R : " << point.r << " - V : " << point.v << " - B : " << point.b << endl; // DEBUG - return 1; - } - image.g_point(x, y, point); - pointFenetre(x, y, point.r, point.v, point.b); - } - } - afficherFenetre(); - } + // Image imageRoue(dimX, dimY, 255, PILG_RVB); + // Pixel pointRoueRoue = imageRoue.g_pixelVide(); + // int x, y, c; + // for (c = 0; c < 256; c++) { // À peu près 28 FPS avec SDL + // for (x = 0; x < dimX; x++) { + // for (y = 0; y < dimY; y++) { + // point.r = c; + // point.v = image.g_maxComposante() - c; + // point.b = 0; + // if (image.s_point(x, y, point) == 1) { + // cerr << "Erreur : s_point() a été entré avec des valeurs incorrectes" << endl; + // cout << "X : " << x << " - Y: " << y << " - R : " << point.r << " - V : " << point.v << " - B : " << point.b << endl; // DEBUG + // return 1; + // } + // image.g_point(x, y, point); + // pointFenetre(x, y, point.r, point.v, point.b); + // } + // } + // afficherFenetre(); + // } // // Cycle de couleurs sans utilisation d'Image + // int x, y, c; // for (c = 0; c < 256; c++) { // À peu près 75 FPS avec SDL // for (x = 0; x < dimX; x++) { // for (y = 0; y < dimY; y++) { @@ -54,8 +119,6 @@ int main(int argc, char *args[]) { // afficherFenetre(); // } - - cout << "Éxecution du programme terminée. Vous pouvez quitter la fenêtre." << endl; attendreFenetre(); fermerFenetre(); diff --git a/src/traitementImage.cpp b/src/traitementImage.cpp index bf7ee67..c38ff8f 100644 --- a/src/traitementImage.cpp +++ b/src/traitementImage.cpp @@ -107,7 +107,7 @@ int contraste(Image entree, Image &sortie, float contraste) { // Accentue les co } // Dessin -int trait(Image entree, Image &sortie, int x1, int y1, int x2, int y2, Pixel, pixel) { // Dessine un trait d'un point (x1,y1 à un point (x2,y2) +int trait(Image entree, Image &sortie, int x1, int y1, int x2, int y2, Pixel pixel) { // Dessine un trait d'un point (x1,y1 à un point (x2,y2) } int rectangle(Image entree, Image &sortie, int x1, int y1, int x2, int y2) {