Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is what I got exactly but it fails after one pass. Something about the array being out of bounds probably something with the y*bmd.Stride (but i don't understand why a out of bounds error occurs there as it should just copy raw memory bytes no arrays are used!)</p> <pre><code> Public Function findImages(ByVal bmd As BitmapData) As List(Of Point) Dim results As New List(Of Point)() foundRects = New List(Of Rectangle)() For y As Integer = 0 To bmd.Height - 1 'oringinal code 'Dim scanline As Pointer(Of Byte) = CType(bmd.Scan0, Pointer(Of Byte)) + (y * bmd.Stride) 'mess is here ' gets address of the first line 'Dim ptr As IntPtr = bmd.Scan0 'Dim bytes As Integer = (y * bmd.Stride) 'If bytes = 0 Then bytes = bmd.Stride Dim scanline(bmd.Width * PIXLESIZE) As Byte 'Copy the RGB values into the array. Runtime.InteropServices.Marshal.Copy(bmd.Scan0, scanline, (y * bmd.Stride), bmd.Width * PIXLESIZE) ' -------------------------------- For x As Integer = 0 To bmd.Width - 1 Dim xo As Integer = x * PIXLESIZE Dim buff As Byte() = {scanline(xo), scanline(xo + 1), scanline(xo + 2), &amp;HFF} Dim val As Integer = BitConverter.ToInt32(buff, 0) ' Pixle value from subimage in desktop image If pixels.ContainsKey(val) AndAlso notFound(x, y) Then Dim loc As Point = DirectCast(pixels(val), Point) Dim sx As Integer = x - loc.X Dim sy As Integer = y - loc.Y ' Subimage occurs in desktop image If imageThere(bmd, sx, sy) Then Dim p As New Point(x - loc.X, y - loc.Y) results.Add(p) foundRects.Add(New Rectangle(x, y, bmImage.Width, bmImage.Height)) End If End If Next Next Return results End Function </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload