robotgo icon indicating copy to clipboard operation
robotgo copied to clipboard

bitmap.GetPortion() get the remains area bitmap error

Open wilon opened this issue 9 months ago • 1 comments

  • Robotgo version (or commit ref): latest
  • Go version: 1.21
  • Gcc version: gcc version 8.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
  • Operating system and bit: win10 x64
  • Resolution: 1920x1080
  • Can you reproduce the bug at Examples:
    • [ ] Yes (provide example code)
    • [x] No
    • [ ] Not relevant
  • Provide example code:
package main

import (
   "fmt"

   "github.com/go-vgo/robotgo"
   "github.com/vcaesar/bitmap"
)

func main() {

   // area
   bit := robotgo.CaptureScreen(100, 100, 500, 400)

   // after point 10,10 remains area, “Assertion failed!”
   bit1 := bitmap.GetPortion(bit, 10, 10, 490, 390)
   x1, y1 := bitmap.Find(bit1, bit, 0.1)
   fmt.Println(x1, y1)

}
  • Log gist:
Assertion failed!

Program: C:\Users\ADMINI~1\AppData\Local\Temp\go-build3574158456\b001\exe\test.exe
File: C:/Users/Administrator/go/pkg/mod/github.com/vcaesar/[email protected]/base/bitmap/MMBitmap_c.h, Line 49

Expression: (bufsize + offset) <= (source->bytewidth * source->height)
exit status 3

Description

I want get the remains area bitmap from orgin bitmap, use bitmap.GetPortion, but failed.

wilon avatar Sep 18 '23 06:09 wilon

Here are some tests.

   bit := robotgo.CaptureScreen(100, 100, 500, 400)
   bit1 := bitmap.GetPortion(bit, 0, 0, 500, 400) // It's ok
   bit2 := bitmap.GetPortion(bit, 1, 1, 499, 399) // Assertion failed!
   bit3 := bitmap.GetPortion(bit, 1, 1, 498, 398) // It's ok, but loss 1 row, 1 column

wilon avatar Sep 18 '23 08:09 wilon