Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitmap.GetPortion() get the remains area bitmap error #615

Open
1 of 3 tasks
wilon opened this issue Sep 18, 2023 · 1 comment
Open
1 of 3 tasks

bitmap.GetPortion() get the remains area bitmap error #615

wilon opened this issue Sep 18, 2023 · 1 comment

Comments

@wilon
Copy link
Collaborator

wilon commented Sep 18, 2023

  • 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)
    • 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/bitmap@v0.10.0-beta3.2/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
Copy link
Collaborator Author

wilon commented Sep 18, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant