diff --git a/.gitignore b/.gitignore index 1e8df95..82ac717 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ -compile* -bin/* *.sublime-* +generator/nodes_modules/* \ No newline at end of file diff --git a/Avancement.html b/Avancement.html new file mode 100644 index 0000000..c689c72 --- /dev/null +++ b/Avancement.html @@ -0,0 +1,41 @@ + + + + Avancement + + + + + + + +
+
+
+

Avancement

+

Légende

+ +
  • D Définition réalisée
  • A Algorithme réalisé
  • C Code réalisé
+ +

Liste générale

+ +

Ordre donné à titre indicatif

+ +
  • Fonction principale
  • Fonction d'analyse de commande
    • Analyse de la commande
    • Analyse des arguments
    • Correspondance commandes ↔ fonctions
  • Objets
    • Fenêtre D
      • SDL C
      • BGI A
    • Pixel C
    • Image D
  • Fonctions D
    • Gestion de fichier
      • Créer
      • Ouvrir
      • Enregistrer
      • Importer
    • Édition
      • Copier tout
      • Couper tout
      • Coller tout
      • Annuler
      • Refaire
    • Couleur
      • Teinte
      • Saturation
      • Luminosité
      • Contraste
    • Dessin
      • Trait
      • Rectangle
      • Cercle
      • Disque
    • Géométrie
      • Zoom
      • Pivot
      • Redimensionner
    • Conversion du mode
      • Binaire
      • Niveaux de gris
      • Couleur
    • Aide
  • Documentation
+
+
+
+ + + \ No newline at end of file diff --git a/Compilation.html b/Compilation.html new file mode 100644 index 0000000..2c699fa --- /dev/null +++ b/Compilation.html @@ -0,0 +1,43 @@ + + + + Compilation + + + + + + + +
+
+
+

Compilation

+

Windows

+ +
  1. Télécharger et installer MinGW
  2. Inclure MinGW dans la variable d'environnement %PATH% : set path=%path%;C:\MinGW\bin
  3. Créer le dossier bin à la racine du dépôt : mkdir bin
  4. Télécharger la bibliothèque de développement SDL 1.2.15, copier le contenu des dossier lib et include de l'archive téléchargée dans le dossier de MinGW
  5. Télécharger la bibliothèque d’exécution de SDL 1.2.15 et placer SDL.dll dans le dossier bin
  6. Compiler : g++ src/main.cpp -o bin/main.exe -lmingw32 -lSDLmain -lSDL -static-libgcc -static-libstdc++
+ +

L’exécutable se trouvera dans le dossier bin

+ +

Linux

+ +
  1. Installer la bibliothèque de développement SDL 1.2 : sudo apt-get install libsdl1.2-dev
  2. Créer le dossier bin à la racine du dépôt : mkdir bin
  3. Compiler : g++ src/main.cpp -o bin/main -lSDLmain -lSDL
+ +

L’exécutable se trouvera dans le dossier bin

+
+
+
+ + + \ No newline at end of file diff --git a/LICENCE.md b/LICENCE.md deleted file mode 100644 index 68684ea..0000000 --- a/LICENCE.md +++ /dev/null @@ -1 +0,0 @@ -*Copyright 2014 Geoffrey et Lucas* diff --git a/README.md b/README.md deleted file mode 100644 index 379ef1b..0000000 --- a/README.md +++ /dev/null @@ -1,37 +0,0 @@ -#Projet d'ISN de Lucas et Geoffrey - -##À propos... - -###De ce dépôt -Ce dépôt a été crée pour faciliter le développement du projet. Son caractère public n'est que lié aux nécessité de GitHub. Si vous ne savez pas de quel projet il s'agit, vous perdez votre temps ici. L'absence de licence (du moins jusqu'aux épreuves) vous interdit de distribuer ou de réutiliser le code, qui de toute façon ne vous aurait pas été utile. - -###De ce projet -Ceci est la création de Lucas et de Geoffrey pour l'option Informatique et Sciences du Numérique qui sera présenté lors du Baccalauréat 2013/2014. -Nos noms complets et le nom du lycée sont masqués pour des raisons d'intimité. Les personnes devant nous reconnaître nous reconnaîtront. - -###Du 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 - -##Compilation -###Windows -1. Télécharger et installer [MinGW](http://www.mingw.org/) -2. Inclure **MinGW** dans la variable d'environnement ```%PATH%``` : ```set path=%path%;C:\MinGW\bin``` -3. Créer le dossier *bin* à la racine du dépôt : ```mkdir bin``` -4. Télécharger la [bibliothèque de développement SDL 1.2.15](http://www.libsdl.org/release/SDL-devel-1.2.15-mingw32.tar.gz), copier le contenu des dossier *lib* et *include* de l'archive téléchargée dans le dossier de **MinGW** -5. Télécharger la [bibliothèque d’exécution de SDL 1.2.15](http://www.libsdl.org/release/SDL-1.2.15-win32.zip) et placer *SDL.dll* dans le dossier *bin* -6. Compiler : ```g++ src/main.cpp -o bin/main.exe -lmingw32 -lSDLmain -lSDL -static-libgcc -static-libstdc++``` - -L’exécutable se trouvera dans le dossier *bin* - -###Linux -1. Installer la **bibliothèque de développement SDL 1.2** : ```sudo apt-get install libsdl1.2-dev``` -2. Créer le dossier *bin* à la racine du dépôt : ```mkdir bin``` -3. Compiler : ```g++ src/main.cpp -o bin/main -lSDLmain -lSDL``` - -L’exécutable se trouvera dans le dossier *bin* - - ----------- -*Copyright 2014 Lucas et Geoffrey* diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 300374d..0000000 --- a/TODO.md +++ /dev/null @@ -1,53 +0,0 @@ -#À réaliser - -####Légende -* **D** Définition réalisée -* **A** Algorithme réalisé -* **C** Code réalisé - -####Liste générale -*Ordre donné à titre indicatif* - -* Fonction principale -* Fonction d'analyse de commande - * Analyse de la commande - * Analyse des arguments - * Correspondance commandes ↔ fonctions -* Objets - * Fenêtre **D** - * SDL **C** - * BGI **A** - * Pixel **C** - * Image **D** -* Fonctions **D** - * Gestion de fichier - * Créer - * Ouvrir - * Enregistrer - * Importer - * Édition - * Copier tout - * Couper tout - * Coller tout - * Annuler - * Refaire - * Couleur - * Teinte - * Saturation - * Luminosité - * Contraste - * Dessin - * Trait - * Rectangle - * Cercle - * Disque - * Géométrie - * Zoom - * Pivot - * Redimensionner - * Conversion du mode - * Binaire - * Niveaux de gris - * Couleur - * Aide -* Documentation diff --git a/css/contenu.css b/css/contenu.css new file mode 100644 index 0000000..8aac17d --- /dev/null +++ b/css/contenu.css @@ -0,0 +1,322 @@ +/* Style CSS pour Markdown depuis https://github.com/jasonm23/markdown-css-themes */ + +body { + font-family: Helvetica, arial, sans-serif; + font-size: large; + line-height: 1.6; + padding-top: 10px; + padding-bottom: 10px; + background-color: white; + padding: 30px; } + +body > *:first-child { + margin-top: 0 !important; } +body > *:last-child { + margin-bottom: 0 !important; } + +a { + color: #4183C4; } +a.absent { + color: #cc0000; } +a.anchor { + display: block; + padding-left: 30px; + margin-left: -30px; + cursor: pointer; + position: absolute; + top: 0; + left: 0; + bottom: 0; } + +h1, h2, h3, h4, h5, h6 { + margin: 20px 0 10px; + padding: 0; + font-weight: bold; + -webkit-font-smoothing: antialiased; + cursor: text; + position: relative; } + +h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor { + text-decoration: none; } + +h1 tt, h1 code { + font-size: inherit; } + +h2 tt, h2 code { + font-size: inherit; } + +h3 tt, h3 code { + font-size: inherit; } + +h4 tt, h4 code { + font-size: inherit; } + +h5 tt, h5 code { + font-size: inherit; } + +h6 tt, h6 code { + font-size: inherit; } + +h1 { + font-size: 28px; + color: black; } + +h2 { + font-size: 24px; + border-bottom: 1px solid #cccccc; + color: black; } + +h3 { + font-size: 18px; } + +h4 { + font-size: 16px; } + +h5 { + font-size: 14px; } + +h6 { + color: #777777; + font-size: 14px; } + +p, blockquote, ul, ol, dl, li, table, pre { + margin: 15px 0; } + +hr { + background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAECAYAAACtBE5DAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OENDRjNBN0E2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OENDRjNBN0I2NTZBMTFFMEI3QjRBODM4NzJDMjlGNDgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4Q0NGM0E3ODY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4Q0NGM0E3OTY1NkExMUUwQjdCNEE4Mzg3MkMyOUY0OCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PqqezsUAAAAfSURBVHjaYmRABcYwBiM2QSA4y4hNEKYDQxAEAAIMAHNGAzhkPOlYAAAAAElFTkSuQmCC) repeat-x 0 0; + border: 0 none; + color: #999; + height: 4px; + padding: 0; +} + +body > h2:first-child { + margin-top: 0; + padding-top: 0; } +body > h1:first-child { + margin-top: 0; + padding-top: 0; } +body > h1:first-child + h2 { + margin-top: 0; + padding-top: 0; } +body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child { + margin-top: 0; + padding-top: 0; } + +a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 { + margin-top: 0; + padding-top: 0; } + +h1 p, h2 p, h3 p, h4 p, h5 p, h6 p { + margin-top: 0; } + +li p.first { + display: inline-block; } +li { + margin: 0; } +ul, ol { + padding-left: 30px; } + +ul :first-child, ol :first-child { + margin-top: 0; } + +dl { + padding: 0; } +dl dt { + font-size: 14px; + font-weight: bold; + font-style: italic; + padding: 0; + margin: 15px 0 5px; } +dl dt:first-child { + padding: 0; } +dl dt > :first-child { + margin-top: 0; } +dl dt > :last-child { + margin-bottom: 0; } +dl dd { + margin: 0 0 15px; + padding: 0 15px; } +dl dd > :first-child { + margin-top: 0; } +dl dd > :last-child { + margin-bottom: 0; } + +blockquote { + border-left: 4px solid #dddddd; + padding: 0 15px; + color: #777777; } +blockquote > :first-child { + margin-top: 0; } +blockquote > :last-child { + margin-bottom: 0; } + +table { + padding: 0;border-collapse: collapse; } +table tr { + border-top: 1px solid #cccccc; + background-color: white; + margin: 0; + padding: 0; } +table tr:nth-child(2n) { + background-color: #f8f8f8; } +table tr th { + font-weight: bold; + border: 1px solid #cccccc; + margin: 0; + padding: 6px 13px; } +table tr td { + border: 1px solid #cccccc; + margin: 0; + padding: 6px 13px; } +table tr th :first-child, table tr td :first-child { + margin-top: 0; } +table tr th :last-child, table tr td :last-child { + margin-bottom: 0; } + +img { + max-width: 100%; } + +span.frame { + display: block; + overflow: hidden; } +span.frame > span { + border: 1px solid #dddddd; + display: block; + float: left; + overflow: hidden; + margin: 13px 0 0; + padding: 7px; + width: auto; } +span.frame span img { + display: block; + float: left; } +span.frame span span { + clear: both; + color: #333333; + display: block; + padding: 5px 0 0; } +span.align-center { + display: block; + overflow: hidden; + clear: both; } +span.align-center > span { + display: block; + overflow: hidden; + margin: 13px auto 0; + text-align: center; } +span.align-center span img { + margin: 0 auto; + text-align: center; } +span.align-right { + display: block; + overflow: hidden; + clear: both; } +span.align-right > span { + display: block; + overflow: hidden; + margin: 13px 0 0; + text-align: right; } +span.align-right span img { + margin: 0; + text-align: right; } +span.float-left { + display: block; + margin-right: 13px; + overflow: hidden; + float: left; } +span.float-left span { + margin: 13px 0 0; } +span.float-right { + display: block; + margin-left: 13px; + overflow: hidden; + float: right; } +span.float-right > span { + display: block; + overflow: hidden; + margin: 13px auto 0; + text-align: right; } + +code, tt { + margin: 0 2px; + padding: 0 5px; + white-space: nowrap; + border: 1px solid #ccc; + background-color: #f8f8f8; + border-radius: 3px; } + +pre code { + margin: 0; + padding: 0; + white-space: pre; + border: none; + background: transparent; } + +.highlight pre { + background-color: #f8f8f8; + border: 1px solid #cccccc; + font-size: 13px; + line-height: 19px; + overflow: auto; + padding: 6px 10px; + border-radius: 3px; } + +pre { + background-color: #f8f8f8; + border: 1px solid #cccccc; + font-size: 13px; + line-height: 19px; + overflow: auto; + padding: 6px 10px; + border-radius: 3px; } +pre code, pre tt { + background-color: transparent; + border: none; } + +sup { + font-size: 0.83em; + vertical-align: super; + line-height: 0; +} +* { + -webkit-print-color-adjust: exact; +} +@media screen and (min-width: 914px) { + body { + width: 854px; + margin:0 auto; + } +} +@media print { + table, pre { + page-break-inside: avoid; + } + pre { + word-wrap: break-word; + } +} + +/* Theme personalisé */ + +.todoEl { + display: inline-block; + color: white; + font-weight: bold; + padding: 0px 1px 0px 1px; + margin: 1px; + background-color: black; + border-radius: 3px; +} + +.todo_D { + background-color: #95336a; +} + +.todo_A { + background-color: #326189; +} + +.todo_C { + background-color: #5d7e31; +} \ No newline at end of file diff --git a/css/miseEnPage.css b/css/miseEnPage.css new file mode 100644 index 0000000..9352c7b --- /dev/null +++ b/css/miseEnPage.css @@ -0,0 +1,52 @@ +#wrapper { + margin-top: 50px; +} + +nav { + background-color: #333; + text-align: center; + position: fixed; + left: 0; + top: 0; + width: 100%; + z-index: 10000; +} + +nav ul { + margin: 5px 0px 5px 0px; +} + +nav li { + display: inline-block; + font-size: larger; +} + +nav a { + position: relative; + display: inline-block; + color: #fff; + text-decoration: none; + border-radius: 8px; + padding: 5px; + transition: background-color .2s ease-in-out; +} + + +nav ul li:before { + content: '•'; + color: #aaa; + margin: 0px 5px 0px 5px; + display: inline-block; +} + +nav ul li:first-child:before { + content : ''; +} + +nav a:hover { + background: #222; +} + +nav a:active { + background: #444; +} \ No newline at end of file diff --git a/generator/generator.js b/generator/generator.js new file mode 100644 index 0000000..509ae7c --- /dev/null +++ b/generator/generator.js @@ -0,0 +1,114 @@ +#!/bin/env node + +/*jslint node: true, forin: true, indent: 4 */ + +"use strict"; + +// Dépendances +var https = require('https'), + fs = require('fs'), + markdown = require('markdown').markdown; + +// Variables +var liste = []; + +// Fonctions +function recupererFichier(nomFichier, retour) { + var contenu = ''; + console.log('Téléchargement de ' + nomFichier); + https.get('https://raw.githubusercontent.com/GeoffreyFrogeye/PILG/master/' + nomFichier, function (res) { + console.log('Réponse pour ' + nomFichier + ' obtenue (' + res.statusCode + ')'); + res.on('data', function (morceau) { + contenu += morceau; + }).on('end', function () { + console.log('Fichier ' + nomFichier + ' téléchargé'); + retour(contenu); + }); + }).on('error', function (e) { + console.error('Impossible de récupérer le fichier ' + nomFichier + ' car ' + e.message); + }); +} + +function genererPages(liste) { + var nav = '', + element; + for (element in liste) { + if (liste[element].titre === 'À propos') { + liste[element].titreCourt = 'index'; + } else { + liste[element].titreCourt = liste[element].titre + .replace(/À/, 'A') + .replace(/ /, '_') + .replace(/\W/g, ''); + } + if (!liste[element].lien) { + liste[element].lien = liste[element].titreCourt + '.html'; + } + nav += '
  • ' + liste[element].titre + '
  • \n'; + } + fs.readFile('model.html', function (err, contenuModele) { + if (!err) { + liste.forEach(function (element) { + var contenuHTML; + if (element.contenu) { + contenuHTML = contenuModele + .toString('utf-8') + .replace(/%%TITRE%%/g, element.titre) + .replace(/%%NAV%%/, nav) + .replace(/%%CONTENU%%/, element.contenu) + .replace(/%%LICENSE%%/, 'Copyright 2014 Geoffrey et Lucas'); + fs.writeFile('../' + element.titreCourt + '.html', contenuHTML, function (err) { + if (!err) { + console.log('Écrit ' + element.titreCourt + '.html'); + } else { + console.error('Impossible d\'écrire' + element.titreCourt + '.html', err); + } + }); + + } + }); + } else { + console.err('Impossible d\'ouvrir le fichier modèle'); + } + }); +} + +// Execution +function executer() { + recupererFichier('README.md', function (contenu) { + var decoupe = contenu + .toString('utf-8') + .replace(/##Compilation\n/, '%%SPLIT%%') + .replace(/Nos noms complets et le nom du lycée sont masqués pour des raisons d'intimité\. Les personnes devant nous reconnaître nous reconnaîtront\./g, '') + .replace(/##De ce dépôt[ \wæâ€êÿûîœôäßëðüïö©éÉèÈçÇàÀ\.\-\'\,\(\)\n]+?##/g, '#') + .replace(/#(#+)/g, '$1') + .replace(/^#[ \wæâ€êÿûîœôäßëðüïö©éÉèÈçÇàÀ\.\-\']+\n/g, '') + .replace(/\n#[ \wæâ€êÿûîœôäßëðüïö©éÉèÈçÇàÀ\.\-\']+\n/g, '') + .replace(/(De ce)|(Du)/g, 'Le') + .replace(/-+\n\*Copyright[ \wæâ€êÿûîœôäßëðüïö©éÉèÈçÇàÀ\.\-\']+\*/g, '') + .split('%%SPLIT%%'); + liste.push({ + titre: 'À propos', + contenu: markdown.toHTML(decoupe[0]) + '\nCapture d\'écran du code' + }, { + titre: 'Compilation', + contenu: markdown.toHTML(decoupe[1]) + }); + recupererFichier('TODO.md', function (contenu) { + liste.push({ + titre: "Avancement", + contenu: markdown.toHTML(contenu + .toString('utf-8') + .replace(/^#[ \wæâ€êÿûîœôäßëðüïö©éÉèÈçÇàÀ\.\-\']+\n/g, '') + .replace(/\n#[ \wæâ€êÿûîœôäßëðüïö©éÉèÈçÇàÀ\.\-\']+\n/g, '')) + .replace(/([DAC])<\/strong>/g, '$1') + }, { + titre: 'Code source', + lien: 'https://github.com/GeoffreyFrogeye/PILG' + }); + genererPages(liste); + }); + }); +} + +executer(); \ No newline at end of file diff --git a/generator/model.html b/generator/model.html new file mode 100644 index 0000000..bdaa0ca --- /dev/null +++ b/generator/model.html @@ -0,0 +1,29 @@ + + + + %%TITRE%% + + + + + + + +
    +
    +
    +

    %%TITRE%%

    +%%CONTENU%% +
    +
    +
    + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..c37421d --- /dev/null +++ b/index.html @@ -0,0 +1,42 @@ + + + + À propos + + + + + + + +
    +
    +
    +

    À propos

    +

    Le projet

    + +

    Ceci est la création de Lucas et de Geoffrey pour l'option Informatique et Sciences du Numérique qui sera présenté lors du Baccalauréat 2013/2014.

    + +

    Le programme

    + +

    Ce programme est un éditeur basique d'images PBM/PGM/PPM s’exécutant en ligne de commande.

    + +

    Statut : Prétotype

    +Capture d'écran du code +
    +
    +
    + + + \ No newline at end of file diff --git a/screen.png b/screen.png new file mode 100644 index 0000000..c3ffea2 Binary files /dev/null and b/screen.png differ diff --git a/src/affichageFenetreBGI.cpp b/src/affichageFenetreBGI.cpp deleted file mode 100644 index 12894de..0000000 --- a/src/affichageFenetreBGI.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -int ouvrirFenetre(int dimensionX, int dimensionY, const char* nom) { // Crée une fenêtre - initwindow(dimensionX, dimensionY, nom, 0, 0); - return 0; -} - -int setNomFenetre(const char* nom) { // Change le nom de la fenêtre - return 0; -} - -int pointFenetre(int x, int y, int r, int v, int b) { - putpixel(x, y, COLOR(r, v, b)); - return 0; -} - -int afficherFenetre() { - - return 0; -} - -int attendreFenetre() { - while (kbhit()) { - delay(100); - } -} - -int fermerFenetre() { - closegraph(ALL_WINDOWS); -} diff --git a/src/affichageFenetreSDL.cpp b/src/affichageFenetreSDL.cpp deleted file mode 100644 index 57b0d8a..0000000 --- a/src/affichageFenetreSDL.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include -#include - -int fenetreDimensionX; // Stocke les dimensions X de la fenêtre -int fenetreDimensionY; // Stocke les dimensions Y de la fenêtre -SDL_Surface* fenetreEcran; -SDL_Surface* fenetreImage; - - -void definirPixel(SDL_Surface *surface, int x, int y, Uint32 pixel) -{ - /*nbOctetsParPixel représente le nombre d'octets utilisés pour stocker un pixel. - En multipliant ce nombre d'octets par 8 (un octet = 8 bits), on obtient la profondeur de couleur - de l'image : 8, 16, 24 ou 32 bits.*/ - int nbOctetsParPixel = surface->format->BytesPerPixel; - /*Ici p est l'adresse du pixel que l'on veut modifier*/ - /*surface->pixels contient l'adresse du premier pixel de l'image*/ - Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * nbOctetsParPixel; - - /*Gestion différente suivant le nombre d'octets par pixel de l'image*/ - switch(nbOctetsParPixel) - { - case 1: - *p = pixel; - break; - - case 2: - *(Uint16 *)p = pixel; - break; - - case 3: - /*Suivant l'architecture de la machine*/ - if(SDL_BYTEORDER == SDL_BIG_ENDIAN) - { - p[0] = (pixel >> 16) & 0xff; - p[1] = (pixel >> 8) & 0xff; - p[2] = pixel & 0xff; - } - else - { - p[0] = pixel & 0xff; - p[1] = (pixel >> 8) & 0xff; - p[2] = (pixel >> 16) & 0xff; - } - break; - - case 4: - *(Uint32 *)p = pixel; - break; - } -} - -int ouvrirFenetre(int dimensionX, int dimensionY, std::string nom) { // Crée une fenêtre - SDL_Init(SDL_INIT_VIDEO); - fenetreDimensionX = dimensionX; - fenetreDimensionY = dimensionY; - fenetreEcran = SDL_SetVideoMode(fenetreDimensionX, fenetreDimensionY, 32, SDL_HWSURFACE); - fenetreImage = SDL_CreateRGBSurface(SDL_HWSURFACE, fenetreDimensionX, fenetreDimensionX, 32, 0, 0, 0, 0); - SDL_FillRect(fenetreImage, NULL, SDL_MapRGB(fenetreEcran->format, 0, 0, 0)); - setNomFenetre(nom); - return 0; -} - -int setNomFenetre(std::string nom) { // Change le nom de la fenêtre - SDL_WM_SetCaption(nom.c_str(), NULL); - return 0; -} - -int pointFenetre(int x, int y, int r, int v, int b) { - // TODO (erreur) Vérifications des dimensions - - // std::cout << "(" << x << ";" << y << ") = (" << r << ";" << v << ";" << b << ")" << std::endl; // DEBUG - - Uint32 pixel; - - Uint8 u_r, u_v, u_b, u_a; - u_r = (Uint8) (r > 255 ? 255 : r); // TODO (performance, facultatif, erreur) Si > 255, on renvoit 0xff sinon on convertit - u_v = (Uint8) (v > 255 ? 255 : v); - u_b = (Uint8) (b > 255 ? 255 : b); - u_a = (Uint8) 255; - - pixel = SDL_MapRGBA(fenetreImage->format, u_r, u_v, u_b, u_a); - - SDL_LockSurface(fenetreImage); - definirPixel(fenetreImage, x, y, pixel); - SDL_UnlockSurface(fenetreImage); - - return 0; -} - -int afficherFenetre() { - // TODO (performance, facultatif) fenetreImage pourrait être crée pendant afficherFenetre(), et pointFenetre() ne modifierait qu'un tableau - SDL_Rect position; - position.x = 0; position.y = 0; - SDL_BlitSurface(fenetreImage, NULL, fenetreEcran, &position); - SDL_Flip(fenetreEcran); - return 0; -} - -int attendreFenetre() { - SDL_Event evenement; - - while (evenement.type != SDL_QUIT) { - SDL_WaitEvent(&evenement); - } -} - -int fermerFenetre() { - SDL_FreeSurface(fenetreImage); - SDL_Quit(); - return 0; -} diff --git a/src/analyserCommande.cpp b/src/analyserCommande.cpp deleted file mode 100644 index 25a9d17..0000000 --- a/src/analyserCommande.cpp +++ /dev/null @@ -1,3 +0,0 @@ -function analyserCommande(string nom) { - -} diff --git a/src/image.cpp b/src/image.cpp deleted file mode 100644 index 7bff85c..0000000 --- a/src/image.cpp +++ /dev/null @@ -1,55 +0,0 @@ -int Image::Image(int dimensionX, int dimensionY, int maxComposante, int typeComposantes) { // Crée l'objet Image - -} -// Getters -int Image::g_dimensionX() { - return m_dimensionX; -} -int Image::g_dimensionY() { - return m_dimensionY; - -} -int Image::g_typeComposante() { - return m_typeComposante; -} -int Image::g_maxComposante() { - return m_typeComposante; - -} -int g_point(int x, int y, Pixel &pixel) { - if (en_Limites(x, y)) { - pixel = m_tab[x][y]; - return 0; - } else { - return 1; - } -} -// Setters - -int Image::s_point(int x, int y, Pixel pixel) { - if (en_Limites(x, y) && pixel.typeComposantes == Image.g_typeComposante && pixel.maxComposante == Image.g_maxComposante && enLimitesComposantes(pixel)) { - m_tab[x][y] = pixel; - } - -} - -bool Image::enLimitesComposantes(Pixel pixel) { - switch (pixel.typeComposantes) { - case 0: - return true; - break; - case 1: - return pixel.m <= pixel.maxComposante; - break; - case 2: - return (pixel.r <= pixel.maxComposante && pixel.v <= pixel.maxComposante && pixel.b <= pixel.maxComposante); - break; - default: - return false; - break; - } -} - -bool Image::enLimites(int x, int y) { - return (x >= 0 && x < g_dimensionX && y >= 0 && y < g_dimensionY); -} \ No newline at end of file diff --git a/src/image.h b/src/image.h deleted file mode 100644 index 7f06b6e..0000000 --- a/src/image.h +++ /dev/null @@ -1,34 +0,0 @@ -#include - -typedef Pixel { - int typeComposantes; - int maxComposante; - int r; - int v; - int b; - int g; - bool n; - -} Pixel; - -class Image { -public: - int Image(int dimensionX, int dimensionY, int maxComposante, int typeComposantes); // Crée l'objet Image - // Getters - int g_dimensionX(); - int g_dimensionY(); - int g_typeComposante(); - int g_maxComposante(); - Pixel g_point(int x, int y); - // Setters - int s_point(int x, int y, Pixel pixel); - -private: - bool enLimitesComposantes(Pixel pixel); - bool enLimites(int x, int y); - int m_dimensionX; - int m_dimensionY; - int m_typeComposantes; // 0 : N&B, 1 : Niveaux de gris, 2 : RVB - int m_maxComposante; // Maximum de composante (inutilisé pour binaire) - vector< vector< Pixel > > m_tab; -}; diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index dd7caf6..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -#include "affichageFenetreSDL.cpp" - - -using namespace std; - -// Insertion des ensembles de fonctions massives séparés pour plus de clarté -#include "analyserCommande.cpp" -#include "traitementImage.cpp" - -int main(int argc, char* args[]) { - -#if defined(WIN32) // Permet de refaire fonctionner cin et cout sous Windows après démarrage de SDL - freopen("CON", "w", stdout); - freopen("CON", "w", stderr); -#endif - - cout << "PILG" << endl; // Message d'entrée et de test - - return 0; -} diff --git a/src/test_affichageFenetre.cpp b/src/test_affichageFenetre.cpp deleted file mode 100644 index c7366d2..0000000 --- a/src/test_affichageFenetre.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include - -#include "affichageFenetreBGI.cpp" - -using namespace std; - - -int main(int argc, char* args[]) { - -#if defined(WIN32) // Permet de refaire fonctionner cin et cout sous Windows après démarrage de SDL - freopen("CON", "w", stdout); - freopen("CON", "w", stderr); -#endif - - cout << "TEST AFFICHAGE FENETRE" << endl; // Message d'entrée et de test - - int dimX = 640, dimY = 480; - ouvrirFenetre(dimX, dimY, "Test affichage fenêtre"); - - for (int c = 0; c <= 255; c++) { // À peu près 58 FPS - for (int x = 0; x <= dimX; x++) { - for (int y = 0; y <= dimY; y++) { - pointFenetre(x, y, c, 255-c, 0); - } - } - afficherFenetre(); - } - - cout << "Éxecution du programme terminée. Vous pouvez quitter la fenêtre." << endl; - attendreFenetre(); - fermerFenetre(); - - - return 0; -} diff --git a/src/traitementImage.cpp b/src/traitementImage.cpp deleted file mode 100644 index 9cc6850..0000000 --- a/src/traitementImage.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// Gestion de fichiers -int creer(Image &sortie, int dimensionX, int dimensionY, int typeComposante, int maxComposante) { // Créer une image de dimensions X et Y - -} -int ouvrir(Image &sortie, string nomFichier) { // Ouvrir une image existante à partir du nom du fichier - -} -int sauver(Image entree, string nomFichier) { // Sauvegarder l'image obtenue dans un nouveau fichier - -} -int import(Image entree, Image &sortie, string nomFichier, int x, int y) { - -} - -// Edition -int copier() { // Copie tous les pixels - -} -int couper() { // Copie et remplace par du blanc tous les pixels - -} -int coller() { // Coller les pixels copiés ou coupés. - -} -int annuler() { // Annuler la dernière action. - -} -int refaire() { // répeter la dernière action - -} - -// Couleur -int teinte(Image entree, Image &sortie, float teinte) { // Change la teinte de l'image - // Si la teinte appartient à [0;1[ - // r1 = 0 - // r2 = 1 - // v1 = 1 - // v2 = 2 - // b1 = 2 - // b2 = 0 - // Valeur = Teinte - // Sinon Si la teinte appartient à [1;2[ - // r1 = 1 - // r2 = 2 - // v1 = 2 - // v2 = 0 - // b1 = 0 - // b2 = 1 - // Valeur = Teinte-1 - // Sinon Si la teinte appartient à [2;3] - // r1 = 2 - // r2 = 0 - // v1 = 0 - // v2 = 1 - // b1 = 1 - // b2 = 2 - // Valeur = Teinte-2 - // Fin Si - // Pour x=0 à x=image.getDimensionX() - // Pour y=0 à y=image.getDimensionY() - // - // - // - // pixel.r = r1+(r2-r1)*valeur - // pixel.v = v1+(v2-v1)*valeur - // pixel.b = b1+(b2-b1)*valeur - // Fin Pour - // Fin Pour -} - -int saturation(Image entree, Image &sortie, float saturation) { // Sature l'image - // Pour x = xMin to x = xMax - // Pour y = yMin to y = yMax - // Ajouter la variable saturation à chaque valeur de chaque pixel - // Ne pas dépasser le seuil limite MaxComposante !!! - // Fin Pour - // Fin Pour -} -int luminosite(Image entree, Image &sortie, float luminosite) { // Augmente la luminosité de l'image - // Pour x=0 à x=image.g_DimensionX() - // Pour y=0 à y=image.g_DimensionY() - // si image.g_typeComposante=1 - // pixel = image.g_point(x,y); - // pixel.g = luminosite*10+pixel.g; - // image.s_point(x, y, pixel); - // sinon si image.g_typeComposante=2 - // pixel = image.g_point(x,y); - // pixel.r = luminosite*10+pixel.r; - // pixel.v = luminosite*10+pixel.v; - // pixel.b = luminosite*10+pixel.b; - // image.s_point(x, y, pixel); - // Fin si - // Fin Pour - // Fin Pour -} -int contraste(Image entree, Image &sortie, float contraste) { // Accentue les contrastes de l'image - // pour x=0 à x=image.g_dimensionX() - //pour y=0 à x=image.g_DimensionY() - //si image.g_typeComposante=1 - //pixel = image.g_point(x,y); - //pixel.g = contraste*pixel.g; - // if pixel.g > Image.g_maxComposante - // pixel.g = Image.g_maxComposante - // end if - - -} - -// 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 rectangle(Image entree, Image &sortie, int x1, int y1, int x2, int y2) { - -} -int cercle(Image entree, Image &sortie, int x, int y, int r) { - -} - -// Geométrie -int zoom(Image entree, Image &sortie) { - -} -int pivoter(Image entree, Image &sortie) { - -} -int redimensionner(Image entree, Image &sortie) { - -} - -// Modification couleur -int convBIN(Image entree, Image &sortie) { - -} -int convNIV(Image entree, Image &sortie) { - -} -int convRVB(Image entree, Image &sortie) { - -} - -//Help -int aide() { - -}