Dim BMP As Bitmap
Dim x,y as Integer
Dim rect As New Rectangle(0, 0, x, y)
Dim bmpData As System.Drawing.Imaging.BitmapData = BMP.LockBits(rect, Drawing.Imaging.ImageLockMode.ReadWrite, BMP.PixelFormat)
Dim ptr As IntPtr = bmpData.Scan0
Dim bytes As Integer = bmpData.Stride * y
Dim rgbValues(bytes - 1) As Byte
System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes)
Dim secondcounter As Integer = 0
Dim tempred As Integer
Dim tempblue As Integer
Dim tempgreen As Integer
Dim tempalpha As Integer
Dim tempx As Integer
Dim tempy As Integer
While secondcounter < rgbValues.Length
tempblue = rgbValues(secondcounter)
tempgreen = rgbValues(secondcounter + 1)
tempred = rgbValues(secondcounter + 2)
tempalpha = rgbValues(secondcounter + 3)
tempalpha = 255
tempy = ((secondcounter * 0.25) / x)
tempx = (secondcounter * 0.25) - (tempy * x)
If tempx < 0 Then
tempx = tempx + x
End If
'Code
rgbValues(secondcounter) = tempblue
rgbValues(secondcounter + 1) = tempgreen
rgbValues(secondcounter + 2) = tempred
rgbValues(secondcounter + 3) = tempalpha
secondcounter = secondcounter + 4
End While
System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr, bytes)
BMP.UnlockBits(bmpData)