Page 1 of 2

Blank Snapshot in iOS

Posted: Thu May 09, 2013 4:10 pm
by RogGuay
Hi All,

I am using this code:

put item 1 of the screenmouseloc into x0
put item 2 of the screenmouseLoc into y0
import snapshot from rectangle (x0-50, y0-50, x0 +50, y0+50)

which works fine in the IDE but not the iOS environment. In iOS, I get a blank (or black?) image.

Can someone please help me with this?

Thanks,
Roger

Re: Blank Snapshot in iOS

Posted: Thu May 09, 2013 4:25 pm
by endernafi
Hi Roger,

I did a quick test and it works fine in the simulator.
I've put exactly your 3 line of code in a mouseUp handler in card script.
It seems that the problem you're facing is related to something else.
I suggest to look at the other parts of your code.

Best,

~ Ender Nafi

Re: Blank Snapshot in iOS

Posted: Thu May 09, 2013 5:56 pm
by dave_probertGA6e24
Which version of LC are you using?

In LC6 on my iPad I had to do a "lock screen", just before doing a snapshot or else it would not work (ie blank image). The same code without the lock screen works fine from LC5.5.4. The only difference was the addition of the "lock screen" line before and the "unlock screen" after the snapshot call.

I think the same also applied to taking a photo and assigning it to another image - can't remember just now though.

Cheers,
Dave

Re: Blank Snapshot in iOS

Posted: Thu May 09, 2013 7:31 pm
by RogGuay
Thank you, Ender, but that is not the case for me. I did exactly as you did and ended up with a blank again. What now?

Roger
endernafi wrote:Hi Roger,

I did a quick test and it works fine in the simulator.
I've put exactly your 3 line of code in a mouseUp handler in card script.
It seems that the problem you're facing is related to something else.
I suggest to look at the other parts of your code.

Best,

~ Ender Nafi

Re: Blank Snapshot in iOS

Posted: Thu May 09, 2013 7:36 pm
by RogGuay
Thanks, Dave. I'm using LC 5.5.4 and I am also using "lock Screen". Here is my entire code called from a mouseDown handler:

on ZoomThing
if the short name of the owner of the target is not "ControlsGrp" then

if exists(image ZoomShot) then delete image zoomShot
lock screen

put item 1 of the screenmouseloc into x0
put item 2 of the screenmouseLoc into y0
import snapshot from rectangle (x0-50, y0-50, x0 +50, y0+50) ---of window 180490432 (this does not work)
--set the width of last image to 2*the formattedWidth of last image
--set the height of last image to 2*the formattedHeight of last image
--set the loc of last image to the Mouseloc

set the name of last image to ZoomShot
unlock screen
end if
end ZoomThing

I commented out a few lines in an effort to isolate my problem, to no avail.

What the heck???

Roger



dave_probertGA6e24 wrote:Which version of LC are you using?

In LC6 on my iPad I had to do a "lock screen", just before doing a snapshot or else it would not work (ie blank image). The same code without the lock screen works fine from LC5.5.4. The only difference was the addition of the "lock screen" line before and the "unlock screen" after the snapshot call.

I think the same also applied to taking a photo and assigning it to another image - can't remember just now though.

Cheers,
Dave

Re: Blank Snapshot in iOS

Posted: Thu May 09, 2013 9:18 pm
by endernafi
Roger hi,

Could you hide the status bar from Standalone Application Settings and then give it a try please?
It seems that status bar causes the problem.

Edit:
I've attached a working sample which doesn't require hiding the status bar, hope it helps...


Best,

~ Ender Nafi

Re: Blank Snapshot in iOS

Posted: Thu May 09, 2013 11:21 pm
by RogGuay
Ender, thank you so much for your patience and persistence.

Turns out your stack works and mine does not!!. I DO have the Status Bar hidden, but I find your stack works with or without the Status Bar! I need to play with your more sophisticated code to see if I'm missing something in mine. Standby....

And, thanks again!!

Roger

endernafi wrote:Roger hi,

Could you hide the status bar from Standalone Application Settings and then give it a try please?
It seems that status bar causes the problem.

Edit:
I've attached a working sample which doesn't require hiding the status bar, hope it helps...


Best,

~ Ender Nafi

Re: Blank Snapshot in iOS

Posted: Tue May 14, 2013 1:17 pm
by RogGuay
Hi Ender et al,

I finally found the source of my problem. It turns out that I had "set the acceleratedRendering of this stack to true" on openStack. With this, Import Snapshot does NOT work in iOS (works fine in OS X)!. Once I commented this statement out, everything works fine!

Thanks to all for your help!

Roger

RogGuay wrote:Ender, thank you so much for your patience and persistence.

Turns out your stack works and mine does not!!. I DO have the Status Bar hidden, but I find your stack works with or without the Status Bar! I need to play with your more sophisticated code to see if I'm missing something in mine. Standby....

And, thanks again!!

Roger

endernafi wrote:Roger hi,

Could you hide the status bar from Standalone Application Settings and then give it a try please?
It seems that status bar causes the problem.

Edit:
I've attached a working sample which doesn't require hiding the status bar, hope it helps...


Best,

~ Ender Nafi

Re: Blank Snapshot in iOS

Posted: Tue May 14, 2013 1:45 pm
by Dixie
Roger..

I beg to differ... acceleratedRendering set to true does not cause a problem when using 'import snapshot' in iOS...

Dixie

Re: Blank Snapshot in iOS

Posted: Tue May 14, 2013 4:33 pm
by endernafi
Ok, I can confirm that.
After setting the acceleratedRendering of the stack to true,
the snapshot turns to a black square {img1}.
Setting it to false, the code works fine {img2}.
Tested in LiveCode 5.5.4, it looks like a bug...
Roger, I hope you don't need acceleratedRendering in your app 8)


Best,

~ Ender Nafi

Re: Blank Snapshot in iOS

Posted: Tue May 14, 2013 4:50 pm
by Dixie
Ender Nafi...

Then you must be doing something completely different to me... I have no problem with acceleratedRendering being on or off and calling the import snapshot command.... Every change of colour in this app triggers an import snapshot command and then lays the whole lot into an image in the background... I have just tested it in LC 5.5.3, 5.5.4 and LC 6.0.1... no difference.

Dixie

Re: Blank Snapshot in iOS

Posted: Tue May 14, 2013 11:33 pm
by endernafi
Dixie,

I have to clarify something.
The problem is about import snapshot from rect.
import snapshot from object works fine regardless of acceleratedRendering property.
I assume that you're using the latter in your code.
Could you try the import snapshot from rect structure in a spare time and tell whether it works or not?


Best,

~ Ender Nafi

Re: Blank Snapshot in iOS

Posted: Wed May 15, 2013 12:23 pm
by Dixie
Ender...

I am also talking about importing a snapshot from a rectangle...

Code: Select all

   lock screen
   /*changing the colour */
   import snapshot from rectangle 0,0,320,436 of this card
   set the points of grc "draw" to empty
   
   delete image "canvas" of this card
   set the name of the last image of this card to "canvas"
   set the rect of image "canvas" of this card to 0,0,320,436
   set the layer of image "canvas" to 1
   unlock screen
Above, part of a handler that is doing just that... and acceleratedRendering is set to true

Dixie

Re: Blank Snapshot in iOS

Posted: Wed May 15, 2013 4:37 pm
by endernafi
Thank you Dixie, I think I've found the problem { this time I'm sure 8) }.
I {and probably Roger, too} was using import snapshot from rect tRect
You used import snapshot from rect tRect of this card.
When I added of this card, it suddenly worked.
It has to do with the implementation of the commands, I assume, based on the discussions on the user list.

Thanks again.

Roger,
I don't know if you keep following this thread,
but you don't need to temporarily turn off and on the a-R property.
Just use import snapshot from rect tRect of this card notation.


Best,

~ Ender Nafi

Re: Blank Snapshot in iOS

Posted: Wed May 15, 2013 6:36 pm
by Dixie
Nice one, Ender... I would not have picked up on that !...:-)