From aeb487041de74ba2f0c60ad8c6794ca37500ce51 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 7 Sep 2015 22:05:15 +0200 Subject: [PATCH] =?UTF-8?q?bmp.readme=20fini,=20reste=20=C3=A0=20appliquer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/blue.bmp | Bin 126 -> 0 bytes code/classes.py | 18 +++++++++++------- code/classes.pyc | Bin 7492 -> 7501 bytes code/green.bmp | Bin 126 -> 0 bytes code/red.bmp | Bin 126 -> 0 bytes code/rgbw.bmp | Bin 138 -> 0 bytes code/test.bmp | Bin 170 -> 0 bytes 7 files changed, 11 insertions(+), 7 deletions(-) delete mode 100644 code/blue.bmp delete mode 100644 code/green.bmp delete mode 100644 code/red.bmp delete mode 100644 code/rgbw.bmp delete mode 100644 code/test.bmp diff --git a/code/blue.bmp b/code/blue.bmp deleted file mode 100644 index 0bcd5c5e5094d5023f335f2f077ead139369088d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 ucmZ?rtz&?IDj<~u#Eft(0hV9^lET~&3>E+qPVPa)FgCF?6Pm*RKt2Fz>;#?w diff --git a/code/classes.py b/code/classes.py index d5453c5..72255b1 100644 --- a/code/classes.py +++ b/code/classes.py @@ -1,6 +1,5 @@ # ~*~ encoding: utf-8 ~*~ # -import binascii import sys ################################################# @@ -66,6 +65,11 @@ class BMPHeader: # fonction qui créer à partir des attributs def unparse(self): + + # pas de gestion du header complémentaire + self.infoSize = 54 + self.offset = 54 + bytes = [] bytes += [ self.fromInt(self.signature, 2) ] # signature bytes += [ self.fromInt(self.fileSize, 4) ] # taille fichier BMP @@ -127,17 +131,17 @@ class BMPHeader: return intReturn # écrit le valeur entière en octet bourrés jusqu'à la taille - def fromInt(self, intCode, N): - s = '0' + bin(intCode)[2:] + def fromInt(self, value, size): + s = '0' + bin(value)[2:] rtn = "" while s != "": rtn += chr( int(s[-8:], 2) ) s = s[:-8] - + # on rajoute des zéros si besoin de padding if N > len(rtn): - rtn = chr(int( "0" * ( N-len(rtn) ) )) + rtn - + rtn = chr(int( "0" * (size - len(rtn)) )) + rtn + return rtn @@ -167,7 +171,7 @@ class BMPContent: # si le fichier a une mauvaise taille donc mauvais format if not len(binContent) == correctSize: print "Mauvais format (erreur de taille)" - # exit() + exit() # attribution de la map self.map = [] diff --git a/code/classes.pyc b/code/classes.pyc index 4e32847eb2445a624c0ff8ec258968a33115b5ca..73517bcc445da3b73e41ee63225ff62fc4991f1c 100644 GIT binary patch delta 848 zcmaJ<&uddb5dLQOC3!D-`K@gwskBm|2kSwkfu5=rQaw~nDa9h>&~1xiE3xUxlpHEO z*n`4cL{I9;qrAUB5O4J$c&P`AMtc4psC>`pZGuVnn% zx7OSu4nHmXr2Ol*MHpFxd%%Jy3MLMt@d(%gZY>au1CxM>bWGwBh4Eox9g~J}VUjRj z$0SjN+0m2`yxo~mlnD0Js-|I{j$R&dRmj-@svU)}0&Ef*vVgmaThT&Og}UU@*iu*_ zl)5~^(vAge0;#+wCZs*FNEbHN&1RFz#d`+EI2}6~Ygg=A{jhrPKQUpikGYxUlBW0M zlJ57!WDIR=?4Neoq^TpYjmcQWT20G*dD6XDh@!uwJ>BH@WASZ#ZZu z+o95?gIbOMdRry_U!?#uXk^IwqIiL6oDD<6O delta 882 zcmaJVN+q5F!nDe@l_fpPfRBg zw;j0FaWr{rs>kG_)rAwy9q(njD3HXQsB8T%&+Xz=>d-Nu6r>|3l}YEuMWNIvofIzr zHz$RcoK$j?jV0J{GwexDxRhV z_JWzrT+*DgbG#V52pIG0@5Bs0e4zHHJ(HFiwuto>*hXGb}#MQxla`;lYPKUf#K2uCoK6C``Mr(H(OHsrh R%gwwe2A_N@+zw~M>~F0;p^E?j diff --git a/code/green.bmp b/code/green.bmp deleted file mode 100644 index 48536de1cd217104ed917bacd4b47fc0bbbb47bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 ucmZ?rtz&?IDj<~u#Eft(0hV9^lET~&3>E+qPVPa)FgCF?6S~6x3=9Bh?F60x diff --git a/code/red.bmp b/code/red.bmp deleted file mode 100644 index 5d25b0a51fc1c0e0d128acc0101bb413feee72ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 tcmZ?rtz&?IDj<~u#Eft(0hV9^lET~&3>E+qPVPa)FgCF?6NbY73;<{D1fBo@ diff --git a/code/rgbw.bmp b/code/rgbw.bmp deleted file mode 100644 index 1d89d2c2d207e5ad05a22a83e7aed2d9ac54b351..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 138 zcmZ?r?P7p{Dj<~u#7t1k$RGih5CD?G+z<>F01{5_LB%jOu{6kBWbmJX;s1Xi0i=MC GfdK&9QVFvF diff --git a/code/test.bmp b/code/test.bmp deleted file mode 100644 index 0b2fe5d7b8b18009de7cfae21b8541b5553db332..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 170 zcmZ?rUBv(aRX{2Sh*_YRkwF41VE`nBxgi)V03@8;gNk8nVreEch5umyB<>C4fM^B= Q5b?j90muRZAQQv_0FpN$q5uE@