Projets d'introduction au graphisme des Ordinateurs(IGOR)

2011-2016 L1 MPI


avant apres

2017-2019 L1 MPI


avant apres

2021-2022 L1 MPI et LDD MI

silhou0silhou

2022-2023 L1 MPI et LDD MI


2023-2024 L1 MPI et LDD MI


2024-2025 L1 MPI et LDD MI

  • le code de la fonction colorDist()
  • /**
     CALCULATES A 'DISTANCE' BETWEEN TWO COLORS
     dist=0.0 should mean the very same color. 
     distance between black and white should be 1
     distance between opaque and transparent color should be 1
     from: http://stackoverflow.com/questions/5066439/compare-pixel-colour-java
     with alpha and normalisation added  ***/
    float colorDist(color c1, color c2) {
      float rmean =(red(c1) + red(c2)) / 2;
      float r = red(c1) - red(c2);
      float g = green(c1) - green(c2);
      float b = blue(c1) - blue(c2);
      float a = (alpha(c1) - alpha(c2))/255.0;
      return Math.max(a, sqrt((int(((512+rmean)*r*r))>>8)+(4*g*g)+(int(((767-rmean)*b*b))>>8))/764.8333);
    } // colorDist()
    



    ... et bonne chance !