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