26.06.2013 Views

Étude des propriétés hydriques et des mécanismes d ... - sacre

Étude des propriétés hydriques et des mécanismes d ... - sacre

Étude des propriétés hydriques et des mécanismes d ... - sacre

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Annexes<br />

If InfoBMP.biWidth > 254 Then<br />

Close #1<br />

MsgBox ("fichier non valide ... il ne peut pas être affiché !!!")<br />

Exit Sub<br />

End If<br />

If InfoFile.bfType 19778 Then<br />

Close #1<br />

MsgBox ("fichier non valide ... ce n'est pas un .BMP !!!")<br />

Exit Sub<br />

End If<br />

If InfoBMP.biBitCount 24 Then<br />

Close #1<br />

MsgBox ("fichier non valide ... les pixels ne sont pas définis sur 8 Bits")<br />

Exit Sub<br />

End If<br />

IndexLecture = InfoFile.bfOffBits<br />

taillelignepixel = InfoBMP.biWidth + (InfoBMP.biWidth Mod 4)<br />

IndexX = 1<br />

Indexy = InfoBMP.biHeight<br />

Do While Not EOF(1)<br />

For i = 1 To (InfoBMP.biWidth * 3) Step 3<br />

G<strong>et</strong> #1, IndexLecture + i, Pix<br />

Cells(Indexy, IndexX).Interior.Color = RGB(Pix.Rouge, Pix.Vert, Pix.Bleu)<br />

IndexX = IndexX + 1<br />

Next i<br />

IndexX = 1<br />

If Indexy = 1 Then<br />

Exit Do<br />

Else<br />

Indexy = Indexy - 1<br />

End If<br />

IndexLecture = IndexLecture + (InfoBMP.biWidth * 3) + (InfoBMP.biWidth Mod 4) 'on considere seulement<br />

le 24 Bit > 3*oct<strong>et</strong><br />

Loop<br />

Close #1<br />

End Sub<br />

Function SeuillageBinaire(coul As Byte, niveau As Byte) As Byte<br />

If coul < niveau Then<br />

coul = 0<br />

Else<br />

coul = 255<br />

End If<br />

SeuillageBinaire = coul<br />

End Function<br />

Function Seuillage(coul As Byte, niveau As Byte) As Byte<br />

If coul < niveau Then coul = 0<br />

Seuillage = coul<br />

End Function<br />

Sub modifieBMP()<br />

Dim InfoFile As BITMAPFILEHEADER<br />

Dim InfoBMP As BITMAPINFOHEADER<br />

Dim Pix As Pixel<br />

Dim IndexLecture As Long<br />

Dim ValSeuilR As Byte, ValSeuilV As Byte, ValSeuilB As Byte<br />

Open "c:\temp\courbe.bmp" For Binary Access Read Write As #1<br />

G<strong>et</strong> #1, StartBITMAPFILEHEADER, InfoFile<br />

G<strong>et</strong> #1, StartBITMAPINFOHEADER, InfoBMP<br />

If InfoBMP.biBitCount 24 Then<br />

222<br />

Kévin Beck (2006)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!