grabdesktop error in android

Report any Hollywood bugs here
Post Reply
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

grabdesktop error in android

Post 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
User avatar
airsoftsoftwair
Posts: 5443
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: grabdesktop error in android

Post 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.
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: grabdesktop error in android

Post 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$)
xabierpayet
Posts: 267
Joined: Fri Feb 24, 2012 9:34 am

Re: grabdesktop error in android

Post by xabierpayet »

solved, i use your code, but i need enddoubebuffer first, thanks, all is working fast again
Post Reply