diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1caac49 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# IDE tool cache +.idea/* +.vscode/* diff --git a/windows.go b/windows.go index 36e604f..02ed988 100644 --- a/windows.go +++ b/windows.go @@ -68,6 +68,9 @@ func Capture(x, y, width, height int) (*image.RGBA, error) { } defer win.SelectObject(memory_device, old) + if x == width || y == height { + return nil, errors.New("size failed (width or height are consistent)") + } if !win.BitBlt(memory_device, 0, 0, int32(width), int32(height), hdc, int32(x), int32(y), win.SRCCOPY) { return nil, errors.New("BitBlt failed") }