Skip to content

Suggestion: Open and Find should return errors #2

@SirRFI

Description

@SirRFI
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions