From 7f0ceec66541e933c232d0d6932f44341641cef3 Mon Sep 17 00:00:00 2001
From: Louis Chmielewski <louis.chmielewski@icloud.com>
Date: Wed, 20 Mar 2024 11:24:16 +0100
Subject: [PATCH] =?UTF-8?q?est=5Fbloc=5Funiforme=20class=20Bloc=20red?=
 =?UTF-8?q?=C3=A9finition?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .DS_Store                             | Bin 10244 -> 10244 bytes
 Projet/.DS_Store                      | Bin 6148 -> 6148 bytes
 Projet/{images => assets}/calbuth.png | Bin
 Projet/{images => assets}/galets.png  | Bin
 Projet/{images => assets}/joconde.png | Bin
 Projet/{images => assets}/mystere.csv |   0
 Projet/{src => }/decoupe_image.py     |  15 ++++++++-------
 Projet/src/.DS_Store                  | Bin 6148 -> 6148 bytes
 Projet/src/bloc.py                    |  14 ++++++++------
 Projet/src/manip_couleurs.py          |   2 ++
 10 files changed, 18 insertions(+), 13 deletions(-)
 rename Projet/{images => assets}/calbuth.png (100%)
 rename Projet/{images => assets}/galets.png (100%)
 rename Projet/{images => assets}/joconde.png (100%)
 rename Projet/{images => assets}/mystere.csv (100%)
 rename Projet/{src => }/decoupe_image.py (65%)

diff --git a/.DS_Store b/.DS_Store
index 05a0c2a2a552f6ab2fbe63fe7d4dda73b8f717f8..c573b4820ce84db888793758843ca03256630bfb 100644
GIT binary patch
delta 157
zcmZn(XbIS$Di9|)rI>+%frUYjA)O(Up(Hoo#U&{xKZ${XfkQ=oQghMOqmHQZDR|`z
zG7N*0^K%OrKtNkybF+Xvqlyj42sVZQh9ZW1hAf6uRBIR*7|s@7oqSACkvXOC>gHF1
GQeprZDJSy)

delta 157
zcmZn(XbIS$Di9~I><<G20}F#5LpnnyLrHGFi%U{Yei8!%1ILMfizB129CbvMPr)l+
zkYN~{oS$3300No?o0|pX8C9$*7#JAX7y=lI81fmi7*bKKVPI(JjJz`Wn4lsvr^cnt
IuLPyU0G|mfE&u=k

diff --git a/Projet/.DS_Store b/Projet/.DS_Store
index 273da1de5b714b196a0af5fce08fd4b40994a30c..a4713cb99a55e75946d762e76721e15707628d7b 100644
GIT binary patch
delta 287
zcmZoMXfc@J&n>{fz`)4BAi%&-vN38SGe3yW#*oNR%uvjb%1|;{iba_d!E<9dtqJEb
z6z8NH1}Ep|7BGMS%QrO!1_orkR;<!UdgEB7>yh*pWFYBfRREcQq?e(%EVw8yCqFM8
z;ywleh7^WWhGd3(hEj$ChE#@lhD?TBhD3&RhExVUh6094&z$_^q@4UD2C!!syBQc5
z^!|eZ$Y=&mh9Cyl%{y4l7@0JeP5!_p!NPF1`08XHb_q6_w~lFrS0`(+OEEf3c4cqc
J%+B$b9{?MrL?-|M

delta 218
zcmZoMXfc@J&&|)kz`)4BAi%(ox-n`aGe3yW#*oR7%aF*B&X77;iba_d!E<9dtqJEb
z6z8NH1}Ep|7BGMS%QrO!1_orkR;<!UdgEB7&5`sLWFYBfRREcQq?e(%EVw8yCqFM8
z<i5=xSnU{@v{)w_uuHHsbVgp8?87d>7W8qup2nrgS?p4b0h3$Vn<h3mY-Z>9%MSp-
Cdox-9

diff --git a/Projet/images/calbuth.png b/Projet/assets/calbuth.png
similarity index 100%
rename from Projet/images/calbuth.png
rename to Projet/assets/calbuth.png
diff --git a/Projet/images/galets.png b/Projet/assets/galets.png
similarity index 100%
rename from Projet/images/galets.png
rename to Projet/assets/galets.png
diff --git a/Projet/images/joconde.png b/Projet/assets/joconde.png
similarity index 100%
rename from Projet/images/joconde.png
rename to Projet/assets/joconde.png
diff --git a/Projet/images/mystere.csv b/Projet/assets/mystere.csv
similarity index 100%
rename from Projet/images/mystere.csv
rename to Projet/assets/mystere.csv
diff --git a/Projet/src/decoupe_image.py b/Projet/decoupe_image.py
similarity index 65%
rename from Projet/src/decoupe_image.py
rename to Projet/decoupe_image.py
index 6ecb4d4..0443244 100755
--- a/Projet/src/decoupe_image.py
+++ b/Projet/decoupe_image.py
@@ -10,6 +10,7 @@
 
 """
 from PIL import Image, ImageDraw
+from bloc import Bloc
 
 def decoupe_image(image: Bloc, ordre: int) -> Bloc:
     """
@@ -19,12 +20,12 @@ def decoupe_image(image: Bloc, ordre: int) -> Bloc:
     $$$ 
 
     """
-    image = Image.open(image)
-    x = ?
-    y = ?
-    if 0 <= x < largeur and 0 <= y < hauteur:
-    pixel = image.getpixel((x, y))
-    
-    if ordre != 0:
+#     image = Image.open(image)
+#     x = ?
+#     y = ?
+#     if 0 <= x < largeur and 0 <= y < hauteur:
+#     pixel = image.getpixel((x, y))
+#     
+#     if ordre != 0:
         
         
\ No newline at end of file
diff --git a/Projet/src/.DS_Store b/Projet/src/.DS_Store
index e68ebb3a7fe22ce3d21badb20a2758a5823aeefe..6f610a638eb20b9bb21f5405e19bd72bd89031a9 100644
GIT binary patch
delta 65
zcmZoMXfc=|#>CJ*u~2NHo+2aD!~pBb1|lqz`5E;#*D`joO}@Z*U^6=hKL-;-`{sj;
W-<c=#ix@I8Ot#^X-W(&cf*AmDjuO29

delta 114
zcmZoMXfc=|#>B`mu~2NHo+2aj!~pBb0*noe%oBSI4Fwod7*ZLM8S)uQ844Iu8R8i-
z8FCpC8PXY28T1$m7%Dw;@{^Nt@{<@C7z7v?7-cuEo5{ABor9l)iIHP7Bjb1G$^0UQ
T9E=PM3=Iqn44XYf_Amng`W_i-

diff --git a/Projet/src/bloc.py b/Projet/src/bloc.py
index 79b1175..e119f8b 100755
--- a/Projet/src/bloc.py
+++ b/Projet/src/bloc.py
@@ -17,14 +17,14 @@ class Bloc:
     """Classe d'un bloc d'une image en pixel
     """
 
-    def __init__(self, image: Image):
+    def __init__(self, bloc: Image):
         """
         Initialise le type bloc à la valeur de l'image 
         """
         largeur, hauteur = image.size
         pixel_hl = image.getpixel((0, 0))
         pixel_lr = image.getpixel((largeur, hauteur))
-        self.image = image
+        self.bloc = bloc
         
     def __eq__(self, other):
         """
@@ -34,17 +34,19 @@ class Bloc:
         $$$ 
 
         """
-        return self.image == other.image
+        return self.bloc == other.bloc
     
-    def est_bloc_uniforme(bloc:Bloc)->bool:
+    def est_bloc_uniforme(bloc1:Bloc, bloc2:Bloc, bloc3:Bloc, bloc4:Bloc)->bool:
         """
-        Renvoie True si le bloc est un bloc uniforme
+        Renvoie True si le bloc est un bloc uniforme, c'est à dire si les 4 couleurs du bloc sont proches 
         Précondition : aucune
         Exemple(s) :
         $$$ 
 
         """
-        return bloc.pixel_hl == bloc.pixel_lr
+        return est_couleur_proche(moyenne_couleur_bloc(bloc1), moyenne_couleur_bloc(bloc2)) and \n
+               est_couleur_proche(moyenne_couleur_bloc(bloc1), moyenne_couleur_bloc(bloc3)) and \n
+               est_couleur_proche(moyenne_couleur_bloc(bloc1), moyenne_couleur_bloc(bloc4))
     
     
     def est_bloc_non_uniforme()-> bool:
diff --git a/Projet/src/manip_couleurs.py b/Projet/src/manip_couleurs.py
index cb4dc7a..fe10415 100755
--- a/Projet/src/manip_couleurs.py
+++ b/Projet/src/manip_couleurs.py
@@ -17,6 +17,8 @@ def moyenne_couleur_bloc(liste: list[tuple[int,int,int]]) -> tuple:
     Exemple(s) :
     $$$ moyenne_couleur_bloc([(1,2,3),(4,5,6),(7,8,9)])
     (4,5,6)
+    $$$ moyenne_couleur_bloc([(1,2,3),(4,5,6),(7,8,9),(10,11,12),(13,14,15)])
+    (7,8,9)
     """
     total_r = 0
     total_g = 0
-- 
GitLab