Dim DataR() As Integer, DataB() As Integer, DataG() As Integer
--------------------------------------------------------------------------------------------------------
Private Sub Command1_Click()
Dim Tinggi As Integer, Lebar As Integer
Dim Red As Integer, Green As Integer, Blue As Integer
Dim X As Integer, Y As Integer
Dim Tot_Pix As Long
'========= Mendapatkan Tinggi dan Lebar Citra =====
Tinggi = Picture1.ScaleHeight
Lebar = Picture1.ScaleWidth
'==================================================
'=== PEMESANAN Array Pada Data R,G,B ====
ReDim DataR(Lebar, Tinggi) As Integer '(baris,kolom)
ReDim DataG(Lebar, Tinggi) As Integer '(baris,kolom)
ReDim DataB(Lebar, Tinggi) As Integer '(baris,kolom)
'========================================
'====Agar Picture 2 Lebar dan tingginya sama dengan Picture 1====
With Picture2
.Cls
.Height = Tinggi
.Width = Lebar
End With
'================================================================
'==== PROSES PENGAMBILAN CITRA ====================
For X = 0 To Lebar - 1 'kolom
For Y = 0 To Tinggi - 1 'Baris
'===== Get Total Pixel =======
Tot_Pix = Picture1.Point(X, Y)
'=============================
'===== Get Red, Green, Blue ==
Red = Tot_Pix And 255
'Rekam red
DataR(X, Y) = Red
Tot_Pix = Tot_Pix / 256
Green = Tot_Pix And 255
'Rekam green
DataG(X, Y) = Green
Tot_Pix = Tot_Pix / 256
Blue = Tot_Pix And 255
'Rekam Blue
DataB(X, Y) = Blue
'=============================
'===Proses Invers======================
Redanyar = 255 - Red
Greenanyar = 255 - Green
Blueanyar = 255 - Blue
If (Redanyar < 0) Then Redanyar = 0
If (Greenanyar < 0) Then Greenanyar = 0
If (Blueanyar < 0) Then Blueanyar = 0
'=======================================
'=====Menampilkan Citra====================================
Picture2.PSet (X, Y), RGB(Redanyar, Greenanyar, Blueanyar)
'==========================================================
Next
Next
End Sub
----------------------------------------------------------------------------------------------------
Private Sub Command2_Click()
End
End Sub
silahkan download filenya disini :http://www.4shared.com/rar/oqNaxyVW/invers.html


01.33
t-yeo


0 komentar:
Posting Komentar