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

Suggestion: Open and Find should return errors #2

Open
SirRFI opened this issue Feb 24, 2022 · 0 comments
Open

Suggestion: Open and Find should return errors #2

SirRFI opened this issue Feb 24, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@SirRFI
Copy link

SirRFI commented Feb 24, 2022

  • bitmap version (or commit ref): v0.10.0-beta3.1
  • Go version: go version go1.17.6 windows/amd64
  • Gcc version: gcc.exe (x86_64-win32-seh-rev0, Built by MinGW-W64 project) 8.1.0 (recommended by robotgo's README)
  • Operating system and bit: Windows 10 64bit
  • Provide example code:
package main

import (
	"fmt"
	"github.com/vcaesar/bitmap"
)

func main() {
	img := bitmap.Open("iDontExist.png") // nil
	x, y := bitmap.Find(img)
	fmt.Println(x, y) // -1 -1
}
go run .
bitmap is not ready yet!
-1 -1

Description

Open, Find and maybe some other functions should return an error on failure.
Currently "bitmap is not ready yet!" appears in output during attempt to find invalid? bitmap. on the screen.
Even with valid "needle" (image to be searched for) was provided, but simply not found in "haystack" (image to be searched in), it will return -1 for both X and Y, which actually can be valid position in multi-screen setup, as shown here.

Initially suggested here.

@vcaesar vcaesar added the enhancement New feature or request label Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants