Skip to content
This repository was archived by the owner on Dec 6, 2018. It is now read-only.

Commit 68694e3

Browse files
Corrections des commandes couleurs
* Luminosité & Saturation : multiplication au lieu d'addition * Le zéro de saturation était mal géré
1 parent 82a60fc commit 68694e3

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Nos noms complets et le nom du lycée sont masqués pour des raisons d'intimité
1212
###Le programme
1313
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.
1414

15-
*Version :* v1.0.0
15+
*Version :* v1.0.1
1616

1717
*Status :* [![Build Status](https://travis-ci.org/GeoffreyFrogeye/PILG.svg?branch=master)](https://travis-ci.org/GeoffreyFrogeye/PILG)
1818

src/traitementImage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ int saturation(Image entree, Image &sortie,
398398
for (int y = 0; y < sortie.g_dimensionY(); y++) {
399399
entree.g_pixel(x, y, pixel);
400400
rvb2tsl(pixel, tsl);
401-
tsl.s += saturation;
401+
tsl.s *= saturation;
402402
tsl.s = tsl.s > 1 ? 1 : (tsl.s < 0 ? 0 : tsl.s);
403403
tsl2rvb(tsl, pixel);
404404
sortie.s_pixel(x, y, pixel);
@@ -418,7 +418,7 @@ int luminosite(Image entree, Image &sortie,
418418
for (int y = 0; y < sortie.g_dimensionY(); y++) {
419419
entree.g_pixel(x, y, pixel);
420420
rvb2tsl(pixel, tsl);
421-
tsl.l += luminosite;
421+
tsl.l *= luminosite;
422422
tsl.l = tsl.l > 1 ? 1 : (tsl.l < 0 ? 0 : tsl.l);
423423
tsl2rvb(tsl, pixel);
424424
sortie.s_pixel(x, y, pixel);

src/utilitaires.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ int tsl2rvb(TSL entree, Pixel &sortie) {
6666
}
6767

6868
if (entree.s == 0) {
69-
fill_n(c, 3, entree.l * 255);
69+
fill_n(c, 3, entree.l);
7070
} else {
7171
fill_n(t3, 3, 0);
7272
fill_n(c, 3, 0);
7373
t2 = entree.l < 0.5 ? entree.l * (1 + entree.s) : entree.l + entree.s - entree.l
7474
* entree.s;
7575
t1 = 2 * entree.l - t2;
76-
entree.t /= 360;
76+
entree.t /= 360.0;
7777
t3[0] = entree.t + 1 / 3.0;
7878
t3[1] = entree.t;
7979
t3[2] = entree.t - 1 / 3.0;
@@ -97,12 +97,11 @@ int tsl2rvb(TSL entree, Pixel &sortie) {
9797
c[i] = t1;
9898
}
9999
}
100-
101-
sortie.r = c[0] * sortie.maxComposante;
102-
sortie.v = c[1] * sortie.maxComposante;
103-
sortie.b = c[2] * sortie.maxComposante;
104100
}
105101

102+
sortie.r = c[0] * sortie.maxComposante;
103+
sortie.v = c[1] * sortie.maxComposante;
104+
sortie.b = c[2] * sortie.maxComposante;
106105
return 0;
107106
}
108107

0 commit comments

Comments
 (0)