Dim As Integer As Integer Private Sub Command1_Click CommonDialog1 Sho

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Dim r As Integer, c As Integer
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Picture1.Picture = LoadPicture(CommonDialog1.FileName) 'si carica immagine
Picture2.Height = Picture1.Height
Picture2.Width = Picture1.Width
End Sub
Private Sub Command2_Click()
Dim pix As Long
Dim media As Long
Dim red As Integer, blu As Integer, green As Integer
For r = 0 To Picture1.ScaleHeight + 100
For c = 0 To Picture1.ScaleWidth
pix = Picture1.Point(r, c)
green = pix Mod 256
pix = Int(pix / 256)
red = pix Mod 256
pix = Int(pix / 256)
pix = Int(pix / 256)
blu = pix
media = (red + green + blu) / 3
media = Abs(media)
pix = RGB(media, media, media)
Picture2.PSet (r, c), pix
Next c
Next r
End Sub
Private Sub Command3_Click()
Dim pix As Long
Dim media As Long
Dim red As Integer, blu As Integer, green As Integer
For r = 0 To Picture1.ScaleHeight + 100
For c = 0 To Picture1.ScaleWidth
pix = Picture1.Point(r, c)
green = pix Mod 256
pix = Int(pix / 256)
red = pix Mod 256
pix = Int(pix / 256)
blu = pix
pix = RGB(Abs(red), 0, 0)
Picture2.PSet (r, c), pix
Next c
Next r
End Sub
Private Sub Command4_Click()
Dim pix As Long
Dim media As Long
Dim red As Integer, blu As Integer, green As Integer
For r = 0 To Picture1.ScaleHeight + 100
For c = 0 To Picture1.ScaleWidth
pix = Picture1.Point(r, c)
green = pix Mod 256
pix = Int(pix / 256)
red = pix Mod 256
pix = Int(pix / 256)
pix = Int(pix / 256)
blu = pix
pix = RGB(0, Abs(green), 0)
Picture2.PSet (r, c), pix
Next c
Next r
End Sub
Private Sub Command5_Click()
Dim pix As Long
Dim media As Long
For r = 0 To Picture1.ScaleHeight + 100
For c = 0 To Picture1.ScaleWidth
pix = Picture1.Point(r, c)
Picture2.PSet (r / 2, c / 2), pix
Next c
Next r
End Sub
Private Sub Command6_Click()
Dim x, y, r, c As Integer
Dim px As Long
For y = 1 To Picture2.ScaleWidth - 1
For x = 1 To Picture2.ScaleHeight - 1
px = Picture2.Point(x, y)
For r = 0 To 1
For c = 0 To 1
Picture1.PSet (x * 2 + r, y * 2 + c), px
Next c
Next r
Next x
Next y
End Sub