Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim temp As Bitmap = PictureBox5.Image
- Dim raz As Integer = temp.Height / 3
- Dim height As Integer = temp.Height
- Dim width As Integer = temp.Width
- Dim rect As New Rectangle(Point.Empty, temp.Size)
- Dim bmpData As BitmapData = temp.LockBits(rect, ImageLockMode.[ReadOnly], temp.PixelFormat)
- Dim bpp As Integer = If((temp.PixelFormat = PixelFormat.Format32bppArgb), 2, 3)
- Dim size As Integer = bmpData.Stride * bmpData.Height
- Dim data As Byte() = New Byte(size - 1) {}
- System.Runtime.InteropServices.Marshal.Copy(bmpData.Scan0, data, 0, size)
- Dim options = New ParallelOptions()
- Dim maxCore As Integer = Environment.ProcessorCount - 1
- options.MaxDegreeOfParallelism = If(maxCore > 0, maxCore, 1)
- For y As Integer = 0 To height - 4
- For x As Integer = 0 To width - 4
- If True Then
- Dim index As Integer = y * bmpData.Stride + x * bpp
- data(index) = Math.Min(Math.Abs(CInt(data(index)) - CInt(data(index + bpp + bmpData.Stride))) + 88, 255)
- data(index + 1) = Math.Min(Math.Abs(CInt(data(index + 1)) - CInt(data(index + bpp + 1 + bmpData.Stride))) + 88, 255)
- data(index + 2) = Math.Min(Math.Abs(CInt(data(index + 2)) - CInt(data(index + bpp + 2 + bmpData.Stride))) + 88, 255)
- End If
- Next
- Next
- System.Runtime.InteropServices.Marshal.Copy(data, 0, bmpData.Scan0, data.Length)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement