/* Manipulations sur une classe couleur        */

public class ManipulationCouleursEnConsole {

/* Type agrege de stockage des informations    */
/* relatives a une couleur codee sous la forme */
/* heure, minute, seconde                      */

  static class Couleur {
    short r = 0;
    short v = 0;
    short b = 0; };

/* Programme principal                         */

  public static void main(String [] args) {
    Console.setTitle("ManipulationCouleurs");
    Couleur c = new Couleur();
    double assombrissement;
    Couleur ca = new Couleur();
    double eclaircissement;
    Couleur ce = new Couleur();
    double fa;
    double fe;
    Console.afficherln("SVP, r, v & b?");
    c.r = Console.saisirShort();
    c.v = Console.saisirShort();
    c.b = Console.saisirShort();
    Console.afficherln("SVP, assombrissement?");
    assombrissement = Console.saisirDouble();
    Console.afficherln("SVP, eclaircissement?");
    eclaircissement = Console.saisirDouble();
    fa = 1.0-assombrissement/100.0;
    ca.r =(short) Math.round(fa*c.r);
    ca.v =(short) Math.round(fa*c.v);
    ca.b =(short) Math.round(fa*c.b);
    fe = 1.0-eclaircissement/100.0;
    ce.r =(short) (255-Math.round(fe*(255-c.r)));
    ce.v =(short) (255-Math.round(fe*(255-c.v)));
    ce.b =(short) (255-Math.round(fe*(255-c.b)));
    Console.afficherln("[",c.r,":",c.v,":",c.b,"]");
    Console.afficherln("[",ca.r,":",ca.v,":",ca.b,"]");
    Console.afficherln("[",ce.r,":",ce.v,":",ce.b,"]");
  }
}