Voilà le code source, jessaye d'enregistrer le picture3 (voir source) car quand je fait savepicture, il bug. Merci d'avance
il necessite 3 picture box et une listbox avec 6 choix dans la list.
code source:
Private Sub MERGE(INVERTED1 As Boolean, INVERTED2 As Boolean)
Dim X As Long
Dim y As Long
Dim R1 As Integer
Dim G1 As Integer
Dim B1 As Integer
Dim R2 As Integer
Dim G2 As Integer
Dim B2 As Integer
Picture3.Cls
Picture3.Height = Picture1.Height
Picture3.Width = Picture1.Width
For X = 0 To Picture1.ScaleWidth
DoEvents
For y = 0 To Picture1.ScaleHeight
'on regarde les valeurs RGB de la première image
GET_COLORS Picture1.Point(X, y), R1, G1, B1, INVERTED1
'on regarde les valeurs RGB de la seconde image
GET_COLORS Picture2.Point(X, y), R2, G2, B2, INVERTED2
Picture3.PSet (X, y), RGB((R1 + R2) / 2, (G2 + G1) / 2, (B2 + B1) / 2)
Next y
Next X
Beep
End Sub
------------------------------------------------------
Private Sub NEGATIVE_IMAGE(PICTURE As PictureBox)
Dim X As Long
Dim y As Long
Dim R1 As Integer
Dim G1 As Integer
Dim B1 As Integer
Dim R2 As Integer
Dim G2 As Integer
Dim B2 As Integer
Picture3.Cls
Picture3.Height = Picture1.Height
Picture3.Width = Picture1.Width
For X = 0 To Picture1.ScaleWidth
DoEvents
For y = 0 To Picture1.ScaleHeight
'on regarde les valeurs RGB de l'image
GET_COLORS PICTURE.Point(X, y), R1, G1, B1, True
Picture3.PSet (X, y), RGB(R1, G1, B1)
Next y
Next X
End Sub
--------------------------------------------------------
Private Sub GET_COLORS(COLOR As Long, ByRef R As Integer, ByRef G As Integer, ByRef B As Integer, INVERTED As Boolean)
'Ici on regarde les valeurs du RGB
Dim TEMP As Long
TEMP = (COLOR And 255)
R = TEMP And 255
TEMP = Int(COLOR / 256)
G = TEMP And 255
TEMP = Int(COLOR / 65536)
B = TEMP And 255
If INVERTED = True Then
R = Abs(R - 255)
G = Abs(G - 255)
B = Abs(B - 255)
End If
End Sub
Private Sub Form_Load()
End Sub
-------------------------------------------------
Private Sub List1_DblClick()
Select Case List1.ListIndex
Case 0:
MERGE False, False
Case 1:
MERGE True, False
Case 2:
MERGE False, True
Case 3:
MERGE True, True
Case 4:
NEGATIVE_IMAGE Picture1
Case 5:
NEGATIVE_IMAGE Picture2
End Select
End Sub