I posted this question on the Lazarus mail list but realized later that it is probably more suitable here, so this is a repeat of the post:
------------------------------------------------------------------------------
I wonder if there is a (preferably cross-platform) method to:
1) Select a region of the current desktop by placing a rectangle over it with
the mouse.
2) Copy the part of the desktop within the rectangle as an image to the
clipboard.
If so what functions do I need to accomplish the selection and the copy?
I am using Lazarus 2.0.10 and Fpc 3.2.0 on Windows 10 and Ubuntu 18.04.5
In an earlier effort to define a desktop region for locating coordinates for ripping video off screen using ffmpeg
I asked here and got a workable solution for that.
But the resulting rectangle border was not as neat as I want it to be in this case, so if there are ways to accomplish for instance the way SnagIt puts the selection rectangle on screen I would like to know how...
And once I have the coordinates to snatch the image from, how is that extraction actually done?
I.e. how to read the bitmap and put it onto the clipboard so it can be pasted into an image handling utility or onto an MS Word document etc?
I have used the clipboard a lot but only ever for text strings...
EDIT:I found a
useful thread here where the screen rect extraction is exemplified by @JurassicPork.
It uses the package BGRABitmap available via OLPM in the Package menu.