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

Commit

Permalink
Corrections des commandes couleurs
Browse files Browse the repository at this point in the history
* Luminosité & Saturation : multiplication au lieu d'addition
* Le zéro de saturation était mal géré
  • Loading branch information
GeoffreyFrogeye committed May 22, 2014
1 parent 82a60fc commit 68694e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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.

*Version :* v1.0.0
*Version :* v1.0.1

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

Expand Down
4 changes: 2 additions & 2 deletions src/traitementImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ int saturation(Image entree, Image &sortie,
for (int y = 0; y < sortie.g_dimensionY(); y++) {
entree.g_pixel(x, y, pixel);
rvb2tsl(pixel, tsl);
tsl.s += saturation;
tsl.s *= saturation;
tsl.s = tsl.s > 1 ? 1 : (tsl.s < 0 ? 0 : tsl.s);
tsl2rvb(tsl, pixel);
sortie.s_pixel(x, y, pixel);
Expand All @@ -418,7 +418,7 @@ int luminosite(Image entree, Image &sortie,
for (int y = 0; y < sortie.g_dimensionY(); y++) {
entree.g_pixel(x, y, pixel);
rvb2tsl(pixel, tsl);
tsl.l += luminosite;
tsl.l *= luminosite;
tsl.l = tsl.l > 1 ? 1 : (tsl.l < 0 ? 0 : tsl.l);
tsl2rvb(tsl, pixel);
sortie.s_pixel(x, y, pixel);
Expand Down
11 changes: 5 additions & 6 deletions src/utilitaires.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ int tsl2rvb(TSL entree, Pixel &sortie) {
}

if (entree.s == 0) {
fill_n(c, 3, entree.l * 255);
fill_n(c, 3, entree.l);
} else {
fill_n(t3, 3, 0);
fill_n(c, 3, 0);
t2 = entree.l < 0.5 ? entree.l * (1 + entree.s) : entree.l + entree.s - entree.l
* entree.s;
t1 = 2 * entree.l - t2;
entree.t /= 360;
entree.t /= 360.0;
t3[0] = entree.t + 1 / 3.0;
t3[1] = entree.t;
t3[2] = entree.t - 1 / 3.0;
Expand All @@ -97,12 +97,11 @@ int tsl2rvb(TSL entree, Pixel &sortie) {
c[i] = t1;
}
}

sortie.r = c[0] * sortie.maxComposante;
sortie.v = c[1] * sortie.maxComposante;
sortie.b = c[2] * sortie.maxComposante;
}

sortie.r = c[0] * sortie.maxComposante;
sortie.v = c[1] * sortie.maxComposante;
sortie.b = c[2] * sortie.maxComposante;
return 0;
}

Expand Down

0 comments on commit 68694e3

Please sign in to comment.