Dim DataR() As Integer, DataB() As Integer, DataG() As Integer
Dim tambah As Integer
----------------------------------------------------------------------------------------------------
Sub Brightness()
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 Brightness=================
Rednew = Red + tambah
Greennew = Green + tambah
Bluenew = Blue + tambah
If Rednew >= 255 Then Rednew = 255
If Rednew <= 0 Then Rednew = 0
If Greennew >= 255 Then Greennew = 255
If Greennew <= 0 Then Greennew = 0
If Bluenew >= 255 Then Bluenew = 255
If Bluenew <= 0 Then Bluenew = 0
'===========================================
'=====Menampilkan Citra====================================
Picture2.PSet (X, Y), RGB(Rednew, Greennew, Bluenew)
'==========================================================
Next
Next
End Sub
-----------------------------------------------------------------------------------------------------
Private Sub Command1_Click()
End
End Sub
--------------------------------------------------------------------------------------------------------
Private Sub HScroll1_Change()
tambah = HScroll1.Value
Label1.Caption = tambah
Brightness
End Sub
silahkan download filenya disni:http://www.4shared.com/rar/e_PlmjY9/Brightness.html


01.40
t-yeo


0 komentar:
Posting Komentar