home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 3 'Fixed Dialog
- Caption = "Matrix Filter"
- ClientHeight = 3015
- ClientLeft = 1875
- ClientTop = 2310
- ClientWidth = 8295
- Height = 3795
- Left = 1815
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3015
- ScaleWidth = 8295
- ShowInTaskbar = 0 'False
- Top = 1590
- Width = 8415
- Begin VB.Frame Frame2
- Caption = "Matrix Filter"
- Height = 2895
- Left = 5040
- TabIndex = 37
- Top = 0
- Width = 3135
- Begin VB.CommandButton Command6
- Caption = "-"
- Height = 255
- Left = 2280
- TabIndex = 51
- Top = 1920
- Width = 255
- End
- Begin VB.CommandButton Command5
- Caption = "+"
- Height = 255
- Left = 2040
- TabIndex = 50
- Top = 1920
- Width = 255
- End
- Begin VB.CommandButton Command4
- Caption = "-"
- Height = 255
- Left = 2280
- TabIndex = 49
- Top = 1200
- Width = 255
- End
- Begin VB.CommandButton Command3
- Caption = "+"
- Height = 255
- Left = 2040
- TabIndex = 48
- Top = 1200
- Width = 255
- End
- Begin VB.CommandButton Command2
- Caption = "-"
- Height = 255
- Left = 2280
- TabIndex = 47
- Top = 480
- Width = 255
- End
- Begin VB.CommandButton Command1
- Caption = "+"
- Height = 255
- Left = 2040
- TabIndex = 46
- Top = 480
- Width = 255
- End
- Begin VB.TextBox txtOffset
- Height = 285
- Left = 2640
- TabIndex = 35
- Top = 1680
- Width = 375
- End
- Begin VB.TextBox txtNorm
- Height = 285
- Left = 2640
- TabIndex = 34
- Top = 960
- Width = 375
- End
- Begin VB.TextBox txtScale
- Height = 285
- Left = 2640
- TabIndex = 33
- Top = 240
- Width = 375
- End
- Begin VB.ComboBox cmbMatrixSize
- Height = 315
- Left = 1080
- TabIndex = 7
- Top = 240
- Width = 615
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 24
- Left = 1560
- TabIndex = 32
- Top = 2400
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 23
- Left = 1560
- TabIndex = 27
- Top = 2040
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 22
- Left = 1560
- TabIndex = 22
- Top = 1680
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 21
- Left = 1560
- TabIndex = 17
- Top = 1320
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 20
- Left = 1560
- TabIndex = 12
- Top = 960
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 19
- Left = 1200
- TabIndex = 31
- Top = 2400
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 18
- Left = 1200
- TabIndex = 26
- Top = 2040
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 17
- Left = 1200
- TabIndex = 21
- Top = 1680
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 16
- Left = 1200
- TabIndex = 16
- Top = 1320
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 15
- Left = 1200
- TabIndex = 11
- Top = 960
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 14
- Left = 840
- TabIndex = 30
- Top = 2400
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 13
- Left = 840
- TabIndex = 25
- Top = 2040
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 12
- Left = 840
- TabIndex = 20
- Top = 1680
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 11
- Left = 840
- TabIndex = 15
- Top = 1320
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 10
- Left = 840
- TabIndex = 10
- Top = 960
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 9
- Left = 480
- TabIndex = 29
- Top = 2400
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 8
- Left = 480
- TabIndex = 24
- Top = 2040
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 7
- Left = 480
- TabIndex = 19
- Top = 1680
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 6
- Left = 480
- TabIndex = 14
- Top = 1320
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 5
- Left = 480
- TabIndex = 9
- Top = 960
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 4
- Left = 120
- TabIndex = 28
- Top = 2400
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 3
- Left = 120
- TabIndex = 23
- Top = 2040
- Visible = 0 'False
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 2
- Left = 120
- TabIndex = 18
- Top = 1680
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 1
- Left = 120
- TabIndex = 13
- Top = 1320
- Width = 255
- End
- Begin VB.TextBox txtMatrixArray
- Height = 285
- Index = 0
- Left = 120
- TabIndex = 8
- Top = 960
- Width = 255
- End
- Begin VB.Label Label5
- Caption = "Offset:"
- Height = 255
- Left = 2040
- TabIndex = 42
- Top = 1680
- Width = 615
- End
- Begin VB.Label Label4
- Caption = "Norm:"
- Height = 255
- Left = 2040
- TabIndex = 41
- Top = 960
- Width = 495
- End
- Begin VB.Label Label3
- Caption = "Scale:"
- Height = 255
- Left = 2040
- TabIndex = 40
- Top = 240
- Width = 615
- End
- Begin VB.Label Label2
- Caption = "Matrix Array:"
- Height = 255
- Left = 120
- TabIndex = 39
- Top = 720
- Width = 975
- End
- Begin VB.Label Label1
- Caption = "Matrix Size:"
- Height = 255
- Left = 120
- TabIndex = 38
- Top = 240
- Width = 975
- End
- End
- Begin VB.CommandButton cmdProcessImage
- Caption = "&Process Image"
- Height = 375
- Left = 3120
- TabIndex = 6
- Top = 2520
- Width = 1695
- End
- Begin VB.HScrollBar HScroll1
- Height = 255
- LargeChange = 3
- Left = 3120
- Max = 10
- Min = 1
- TabIndex = 5
- Top = 2160
- Value = 1
- Width = 1455
- End
- Begin VB.Frame Frame1
- Caption = "Image Processor"
- Height = 2055
- Left = 3120
- TabIndex = 36
- Top = 0
- Width = 1695
- Begin VB.OptionButton optProcessor
- Caption = "Matrix"
- Height = 255
- Index = 4
- Left = 120
- TabIndex = 4
- Top = 1680
- Value = -1 'True
- Width = 1455
- End
- Begin VB.OptionButton optProcessor
- Caption = "Blur"
- Height = 255
- Index = 3
- Left = 120
- TabIndex = 3
- Top = 1320
- Width = 1455
- End
- Begin VB.OptionButton optProcessor
- Caption = "Extract Edges"
- Height = 255
- Index = 2
- Left = 120
- TabIndex = 2
- Top = 960
- Width = 1335
- End
- Begin VB.OptionButton optProcessor
- Caption = "Sharpen"
- Height = 255
- Index = 1
- Left = 120
- TabIndex = 1
- Top = 600
- Width = 1095
- End
- Begin VB.OptionButton optProcessor
- Caption = "Soften"
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 0
- Top = 240
- Width = 1095
- End
- End
- Begin ik32Lib.Picbuf PicbufOriginal
- Height = 375
- Left = 2760
- TabIndex = 45
- TabStop = 0 'False
- Top = 720
- Width = 735
- _Version = 65536
- _ExtentX = 1296
- _ExtentY = 661
- _StockProps = 253
- End
- Begin ik32Lib.Picbuf PicbufVisible
- Height = 2895
- Left = 120
- TabIndex = 44
- TabStop = 0 'False
- Top = 0
- Width = 2895
- _Version = 65536
- _ExtentX = 5106
- _ExtentY = 5106
- _StockProps = 253
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 2760
- Top = 1800
- _Version = 65536
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- End
- Begin VB.Label lblScrollChange
- Caption = "1"
- Height = 255
- Left = 4680
- TabIndex = 43
- Top = 2160
- Width = 255
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuLoad
- Caption = "&Load Image..."
- End
- Begin VB.Menu mnuSave
- Caption = "&Save Image..."
- End
- Begin VB.Menu mnuSpacer
- Caption = "-"
- End
- Begin VB.Menu mnuExit
- Caption = "E&xit"
- Shortcut = ^X
- End
- End
- Begin VB.Menu mnuReload
- Caption = "&Reload"
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Public nSoften, nSharpen, nExtract As Integer
- 'Description: This code makes the 3x3 or 5x5 boxes
- 'visible according to which value is chosen
- Private Sub cmbMatrixSize_Click()
- Dim Index As Integer
- Select Case cmbMatrixSize.Text
- Case "3"
- 'make 3x3 text boxes visible
- For Index = 3 To 13 Step 5
- txtMatrixArray(Index).Visible = False
- Next
- For Index = 4 To 14 Step 5
- txtMatrixArray(Index).Visible = False
- Next
- For Index = 15 To 24
- txtMatrixArray(Index).Visible = False
- Next
- Case "5"
- 'Make 5x5 text boxes visible
- For Index = 3 To 13 Step 5
- txtMatrixArray(Index).Visible = True
- Next
- For Index = 4 To 14 Step 5
- txtMatrixArray(Index).Visible = True
- Next
- For Index = 15 To 24
- txtMatrixArray(Index).Visible = True
- Next
- End Select
- End Sub
- 'Description: This code determines which filter has
- 'been selected, and then performs that filter
- Private Sub cmdProcessImage_Click()
- Dim nIndex, nIndex2 As Integer
-
- Select Case True
- Case optProcessor(0).Value 'Soften
- PicbufVisible.Soften nSoften
- Case optProcessor(1).Value 'Sharpen
- PicbufVisible.Sharpen nSharpen
- Case optProcessor(2).Value 'Extract Edges
- PicbufVisible.ExtractEdges nExtract
- Case optProcessor(3).Value 'Blur
- PicbufVisible.Blur
- Case optProcessor(4).Value 'Matrix
- 'determine values for matrix array
- If Val(cmbMatrixSize.Text) = 3 Then
- 'determine for 3x3 matrix
- ReDim MatrixArray(0 To 2, 0 To 2) As Integer
- For nIndex = 0 To 2
- For nIndex2 = 0 To 2
- MatrixArray(nIndex, nIndex2) = Val(txtMatrixArray((nIndex * 5) + nIndex2).Text)
- Next
- Next
- Else
- 'determine for 5x5 matrix
- ReDim MatrixArray(0 To 4, 0 To 4) As Integer
- For nIndex = 0 To 4
- For nIndex2 = 0 To 4
- MatrixArray(nIndex, nIndex2) = Val(txtMatrixArray((nIndex * 5) + nIndex2).Text)
- Next
- Next
- End If
- 'do matrix array filter
- PicbufVisible.MatrixFilter Val(cmbMatrixSize.Text), MatrixArray(0, 0), Val(txtScale.Text), Val(txtNorm.Text), Val(txtOffset.Text)
- End Select
- End Sub
- 'Description: This code increases the value of a
- 'text box.
- Private Sub Command1_Click()
- txtScale.Text = Val(txtScale.Text) + 1
- End Sub
- 'Description: This code decreases the value of a
- 'text box.
- Private Sub Command2_Click()
- txtScale.Text = Val(txtScale.Text) - 1
- End Sub
- 'Description: This code increases the value of a
- 'text box.
- Private Sub Command3_Click()
- txtNorm.Text = Val(txtNorm.Text) + 1
- End Sub
- 'Description: This code decreases the value of a
- 'text box.
- Private Sub Command4_Click()
- txtNorm.Text = Val(txtNorm.Text) - 1
- If Val(txtNorm.Text) < -1 Then txtNorm.Text = -1
- End Sub
- 'Description: This code increases the value of a
- 'text box.
- Private Sub Command5_Click()
- txtOffset.Text = Val(txtOffset.Text) + 1
- End Sub
- 'Description: This code decreases the value of a
- 'text box.
- Private Sub Command6_Click()
- txtOffset.Text = Val(txtOffset.Text) - 1
- End Sub
- 'Description: Here we set all of the presets
- Private Sub Form_Load()
- Dim loopIndex As Integer
- 'Set PicBuf properties
- PicbufOriginal.Visible = False
- InitPicbuf PicbufVisible, True
- InitPicbuf PicbufOriginal, False, "winlogo1.bmp"
- 'Set values for soften, sharpen, and extract edges
- 'functions
- nSoften = 1
- nSharpen = 1
- nExtract = 1
- 'Set default values for controls
- optProcessor(0).Value = True
- cmbMatrixSize.AddItem "3"
- cmbMatrixSize.AddItem "5"
- cmbMatrixSize.Text = "3"
- For loopIndex = 0 To 24
- txtMatrixArray(loopIndex).Text = 1
- Next
- txtScale.Text = 1
- txtNorm.Text = -1
- txtOffset.Text = 0
- 'Make matrix controls invisible
- Form1.Width = 5020
- End Sub
- 'Description: This updates the values of certain
- 'filter information, according to which option
- 'button has been selected
- Private Sub HScroll1_Change()
- 'set value of label showing scroll bar value
- lblScrollChange.Caption = HScroll1.Value
- 'determine which operation has been chosen, update
- 'the value for that operation according to scroll
- 'bar and text box values.
- Select Case True
- Case optProcessor(0).Value
- nSoften = HScroll1.Value
- Case optProcessor(1).Value
- nSharpen = HScroll1.Value
- Case optProcessor(2).Value
- nExtract = HScroll1.Value
- End Select
- End Sub
- 'Description: This exits the program
- Private Sub mnuExit_Click()
- ExitProgram
- End Sub
- 'Description: This code uses the Common Dialog
- 'control to select a file name, and then loads it
- 'into the picbuf.
- Private Sub mnuLoad_Click()
- LoadImage PicbufOriginal, CommonDialog1
- End Sub
- 'Description: This code loads the original image,
- 'which is stored in PicbufOriginal
- Private Sub mnuReload_Click()
- PicbufOriginal_Change
- nSoften = 1
- nSharpen = 1
- nExtract = 1
- End Sub
- 'Description: This code uses the Common Dialog
- 'control to select a file name, and then stores the
- 'image
- Private Sub mnuSave_Click()
- SaveImage PicbufVisible, CommonDialog1
- End Sub
- 'Description: This section of code determines the
- 'values for softening, sharpening, and edge extraction.
- 'it also determines what is visible or enabled
- 'depending on which option button is chosen
- Private Sub optProcessor_Click(Index As Integer)
- Select Case Index
- Case 0
- HScroll1.Enabled = True
- HScroll1.Value = nSoften
- lblScrollChange.Visible = True
- Case 1
- HScroll1.Enabled = True
- HScroll1.Value = nSharpen
- lblScrollChange.Visible = True
- Case 2
- HScroll1.Enabled = True
- HScroll1.Value = nExtract
- lblScrollChange.Visible = True
- Case Is > 2
- HScroll1.Enabled = False
- lblScrollChange.Visible = False
- End Select
- If Index < 4 Then
- Form1.Width = 5020
- Else
- Form1.Width = 8415
- End If
- End Sub
- 'Description: This code copies an image from one
- 'picbuf to another.
- Private Sub PicbufOriginal_Change()
- 'copy original picbuf to edit picbuf
- PicbufVisible.Picture = PicbufOriginal.Picture
- PicbufVisible.Filename = PicbufOriginal.Filename
- End Sub
-