Guest User

Untitled

a guest
Jan 19th, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. btnOk.Enabled = False
  2. chkStop.Focus()
  3. Dim bmap As New Bitmap(picEmboss.Image)
  4. picEmboss.Image = bmap
  5. 'Needed variables
  6. Dim tempbmp As New Bitmap(picEmboss.Image)
  7. Dim i, j As Integer
  8. Dim DispX As Integer = 1, DispY As Integer = 1
  9. Dim red, green, blue As Integer
  10. Static former As Integer = 0 'first time it is run,its value is zero
  11. 'So, we go across the image matrix, pixel by pixel
  12. Static Former_i As Integer = 0
  13.  
  14. With tempbmp
  15.  
  16. For i = Former_i To .Height - 2
  17. For j = 0 To .Width - 2
  18. Dim pixel1, pixel2 As System.Drawing.Color
  19. pixel1 = .GetPixel(j, i)
  20. pixel2 = .GetPixel(j + DispX, i + DispY)
  21. red = Math.Min(Math.Abs(CInt(pixel1.R) - CInt(pixel2.R)) + 128, 255)
  22. green = Math.Min(Math.Abs(CInt(pixel1.G) - CInt(pixel2.G)) + 128, 255)
  23. blue = Math.Min(Math.Abs(CInt(pixel1.B) - CInt(pixel2.B)) + 128, 255)
  24. bmap.SetPixel(j, i, Color.FromArgb(red, green, blue))
  25. Next
  26.  
  27. Next
  28.  
  29. End With
  30. End Sub
Advertisement
Add Comment
Please, Sign In to add comment