Page 1 of 1

How to SaveSnapshot with coordinates

Posted: Tue Oct 24, 2023 12:01 pm
by amyren
This will save the whole window

Code: Select all

SaveSnapshot(f$, #SNAPDISPLAY, #IMGFMT_PNG)
But how to save just a part of the display, like an area specified by x, y, width, height?
SaveSnapshot does not apear to support coordinates

GrabDesktop does support coordinates, but that would only be usable if using a fullscreen display.
For Android I figured that GrabDesktop could work since it always will be fullscreen, but this GrabDesktop command generate an out of memory error on android.

Code: Select all

GrabDesktop(2, {X = 10, Y = 30, Width = 1400, Height = 720})
Any suggestions on how to do this?

Re: How to SaveSnapshot with coordinates

Posted: Tue Oct 24, 2023 12:26 pm
by Bugala
You could use CropBrush() or DisplayBrushPart()

Idea being that first take the snapshot, and then make the snapshot into a brush that you can use CropBrush or DisplayBrushPart to make into containing only part of the snapshot.

Re: How to SaveSnapshot with coordinates

Posted: Wed Oct 25, 2023 12:53 am
by amyren
Thank you, CropBrush did the job :)

Re: How to SaveSnapshot with coordinates

Posted: Sun Oct 29, 2023 5:05 pm
by airsoftsoftwair
amyren wrote: Tue Oct 24, 2023 12:01 pm GrabDesktop does support coordinates, but that would only be usable if using a fullscreen display.
Why? Can't you pass the window coordinates and offset them by the desired display coordinates to get the desired rectangle?

Re: How to SaveSnapshot with coordinates

Posted: Sun Oct 29, 2023 8:38 pm
by amyren
airsoftsoftwair wrote: Sun Oct 29, 2023 5:05 pm
amyren wrote: Tue Oct 24, 2023 12:01 pm GrabDesktop does support coordinates, but that would only be usable if using a fullscreen display.
Why? Can't you pass the window coordinates and offset them by the desired display coordinates to get the desired rectangle?
Ah, yes. I did'nt think of that. (havent used GetAttribute so much)
But even if I did, I had this issue with GrabDesktop that gave me that out of memory error on android.

Re: How to SaveSnapshot with coordinates

Posted: Fri Nov 03, 2023 11:25 pm
by airsoftsoftwair
amyren wrote: Sun Oct 29, 2023 8:38 pm But even if I did, I had this issue with GrabDesktop that gave me that out of memory error on android.
Yes, GrabDesktop() is currently unsupported on Android. It probably requires lots of permissions because of security considerations which is why I deliberately left out support for it because I didn't want Hollywood to be marked as something that records the screen.