Private Sub trbEmboss_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles trbEmboss.ValueChanged
Dim bmap As Bitmap
bmap = New Bitmap(pbEdited.Image)
pbEdited.Image = bmap
Dim tempbmp As New Bitmap(pbEdited.Image)
Dim i, j As Integer
Dim DispX As Integer = 1, DispY As Integer = 1
Dim red, green, blue As Integer
With tempbmp
For i = 0 To .Height - 2
For j = 0 To .Width - 2
Dim pixel1, pixel2 As System.Drawing.Color
pixel1 = .GetPixel(j, i)
pixel2 = .GetPixel(j + DispX, i + DispY)
red = Math.Min(Math.Abs(CInt(pixel1.R) - CInt(pixel2.R)) + 128, 255)
green = Math.Min(Math.Abs(CInt(pixel1.G) - CInt(pixel2.G)) + 128, 255)
blue = Math.Min(Math.Abs(CInt(pixel1.B)/> - CInt(pixel2.B)/>) + 128, 255)
bmap.SetPixel(j, i, Color.FromArgb(red, green, blue))
Next
If i Mod 10 = 0 Then
pbEdited.Invalidate()
pbEdited.Refresh()
Me.Text = Int(100 * i / (pbEdited.Image.Height - 2)).ToString & "%"
'pbEmboss.Value = Int(100 * i / (PictureBox1.Image.Height - 2))
End If
Next
End With
pbEdited.Refresh()
Me.Text = "Done embossing image"
Anyone with an idea, please help me and thank you in advance.
This post has been edited by macosxnerd101: 07 March 2011 - 09:51 PM
Reason for edit:: CODE TAGS!!! USE THEM!!!

New Topic/Question
Reply




MultiQuote






|