rename
This commit is contained in:
parent
d223aa1902
commit
4b34b3625e
|
@ -1,7 +1,5 @@
|
||||||
# ~*~ encoding: utf-8 ~*~ #
|
# ~*~ encoding: utf-8 ~*~ #
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
# classe qui parse le header (binaire) en objet #
|
# classe qui parse le header (binaire) en objet #
|
||||||
#################################################
|
#################################################
|
||||||
|
@ -35,6 +33,7 @@ class BMPHeader:
|
||||||
|
|
||||||
# parse le header au format bin en objet
|
# parse le header au format bin en objet
|
||||||
def parse(self, binHeader=""):
|
def parse(self, binHeader=""):
|
||||||
|
|
||||||
# on utilise l'argument si on l'a sinon l'attribut
|
# on utilise l'argument si on l'a sinon l'attribut
|
||||||
if binHeader != "":
|
if binHeader != "":
|
||||||
parsingData = binHeader
|
parsingData = binHeader
|
||||||
|
@ -69,6 +68,7 @@ class BMPHeader:
|
||||||
self.intData.append( ord(byte) )
|
self.intData.append( ord(byte) )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# fonction qui créer <self.binData> à partir des attributs
|
# fonction qui créer <self.binData> à partir des attributs
|
||||||
def unparse(self):
|
def unparse(self):
|
||||||
|
|
|
@ -143,4 +143,6 @@ Classes:
|
||||||
#############
|
#############
|
||||||
## To Do ##
|
## To Do ##
|
||||||
#############
|
#############
|
||||||
|
[x] gestion de la palette (attribut au <parse>) définit par défaut au <unparse>
|
||||||
[x] faire que le unparse du content créée le header
|
[x] faire que le unparse du content créée le header
|
||||||
|
[ ] prise en charge des formats 1, 4, et 8 bpp
|
|
@ -0,0 +1,5 @@
|
||||||
|
# ~*~ encoding: utf-8 ~*~ #
|
||||||
|
|
||||||
|
class Noise:
|
||||||
|
|
||||||
|
def
|
28
code/bmp.py
28
code/bmp.py
|
@ -4,7 +4,7 @@
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
# classes
|
# classes
|
||||||
from classes import *
|
from BMPFile import *
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
@ -20,19 +20,24 @@ def testFileIntegrity():
|
||||||
# Parsing
|
# Parsing
|
||||||
img.parse( binFile );
|
img.parse( binFile );
|
||||||
|
|
||||||
# MODIFICATIONS des pixels
|
|
||||||
for line in img.content.map:
|
for line in img.content.map:
|
||||||
for pixel in line:
|
for pixel in line:
|
||||||
pixel.r = 255
|
print "rgb(%s, %s, %s)" % (pixel.r, pixel.g, pixel.b)
|
||||||
pixel.g = 75
|
print
|
||||||
pixel.b = 255
|
|
||||||
|
# # MODIFICATIONS des pixels
|
||||||
|
# for line in img.content.map:
|
||||||
|
# for pixel in line:
|
||||||
|
# pixel.r = 255
|
||||||
|
# pixel.g = 75
|
||||||
|
# pixel.b = 255
|
||||||
|
|
||||||
|
|
||||||
# Unparsing
|
# # Unparsing
|
||||||
img.unparse()
|
# img.unparse()
|
||||||
|
|
||||||
|
|
||||||
print img.binData
|
# print img.binData
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -42,8 +47,8 @@ def testManualCreation():
|
||||||
img = BMPFile()
|
img = BMPFile()
|
||||||
for y in range(0, 100):
|
for y in range(0, 100):
|
||||||
img.content.map.append( [] )
|
img.content.map.append( [] )
|
||||||
for x in range(0, 100):
|
for x in range(0, 1000):
|
||||||
img.content.map[y].append( RGBPixel(
|
img.content.map[y].append( PixelColor(
|
||||||
random.randint(0, 255),
|
random.randint(0, 255),
|
||||||
random.randint(0, 255),
|
random.randint(0, 255),
|
||||||
random.randint(0, 255)
|
random.randint(0, 255)
|
||||||
|
@ -54,4 +59,5 @@ def testManualCreation():
|
||||||
print img.binData
|
print img.binData
|
||||||
|
|
||||||
# MAIN
|
# MAIN
|
||||||
testManualCreation()
|
#testManualCreation()
|
||||||
|
testFileIntegrity()
|
Binary file not shown.
After Width: | Height: | Size: 257 KiB |
Loading…
Reference in New Issue