Blank Snapshot in iOS

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Fri Apr 28, 2006 12:10 am
Location: Seattle

Blank Snapshot in iOS

Post by RogGuay » Thu May 09, 2013 4:10 pm

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

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: Blank Snapshot in iOS

Post by endernafi » Thu May 09, 2013 4:25 pm

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
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Location: Thailand
Contact:

Re: Blank Snapshot in iOS

Post by dave_probertGA6e24 » Thu May 09, 2013 5:56 pm

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
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Fri Apr 28, 2006 12:10 am
Location: Seattle

Re: Blank Snapshot in iOS

Post by RogGuay » Thu May 09, 2013 7:31 pm

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

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Fri Apr 28, 2006 12:10 am
Location: Seattle

Re: Blank Snapshot in iOS

Post by RogGuay » Thu May 09, 2013 7:36 pm

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

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: Blank Snapshot in iOS

Post by endernafi » Thu May 09, 2013 9:18 pm

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
Attachments
zoomThing.zip
(70.6 KiB) Downloaded 257 times
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Fri Apr 28, 2006 12:10 am
Location: Seattle

Re: Blank Snapshot in iOS

Post by RogGuay » Thu May 09, 2013 11:21 pm

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

RogGuay
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 114
Joined: Fri Apr 28, 2006 12:10 am
Location: Seattle

Re: Blank Snapshot in iOS

Post by RogGuay » Tue May 14, 2013 1:17 pm

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

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Blank Snapshot in iOS

Post by Dixie » Tue May 14, 2013 1:45 pm

Roger..

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

Dixie

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: Blank Snapshot in iOS

Post by endernafi » Tue May 14, 2013 4:33 pm

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
Attachments
img1.jpg
img2.jpg
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Blank Snapshot in iOS

Post by Dixie » Tue May 14, 2013 4:50 pm

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
Attachments
iOS Simulator Screen shot 14 May 2013 16.42.50.png
iOS Simulator Screen shot 14 May 2013 16.42.32.png

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: Blank Snapshot in iOS

Post by endernafi » Tue May 14, 2013 11:33 pm

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
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Blank Snapshot in iOS

Post by Dixie » Wed May 15, 2013 12:23 pm

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

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: Blank Snapshot in iOS

Post by endernafi » Wed May 15, 2013 4:37 pm

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
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Blank Snapshot in iOS

Post by Dixie » Wed May 15, 2013 6:36 pm

Nice one, Ender... I would not have picked up on that !...:-)

Post Reply

Return to “iOS Deployment”