Page 1 of 1

grabdesktop error in android

Posted: Sat Feb 27, 2016 12:28 am
by xabierpayet
out of memory error in android...

desktop_brush = GrabDesktop(Nil,{width=400,height=400,x=x,y=y})
DisplayBrush(desktop_brush,0,0,{scalex=2.0,scaley=2.0,smoothscale=True})

grabdesktop is not working in android, is possible use another instruction for capture a piece of the display?
i tried savesnapshot, but i cannot save the captured image to a virtual file, i save it to my hard disk, and is very slow here

Re: grabdesktop error in android

Posted: Sat Feb 27, 2016 9:14 pm
by airsoftsoftwair
Yes, GrabDesktop() doesn't work on Android because there is no easy way to grab the "desktop" on Android. You can use DisplayBGPicPart() instead, e.g. to copy the display's contents to a brush, just use:

Code: Select all

CreateBrush(1, w, h)
SelectBrush(1)
DisplayBGPicPart(1, 0, 0, w, h, 0, 0, {Layers = True})
EndSelect
This should do the job.

Re: grabdesktop error in android

Posted: Sun Feb 28, 2016 3:03 am
by xabierpayet
i try your solution, and doesn´t work, i´m using doublebuffer and i need capture an small part of the whole screen, the only solution that i found is
using savesnapshot, but it´s 10 times slower than grabdesktop, i´m using this code, and i cannot use less of 20000 in the size in bytes of the virtualfile or the image is corrupted

vf$ = DefineVirtualFile("virtual.dat",0, 200000, "image.jpg")
EndIf
SaveSnapshot(vf$,#SNAPDISPLAY,#IMGFMT_JPEG,{quality=60})
LoadBrush(19,vf$)

Re: grabdesktop error in android

Posted: Sun Feb 28, 2016 5:02 am
by xabierpayet
solved, i use your code, but i need enddoubebuffer first, thanks, all is working fast again