Snapshots created with half the size passed to newSnapshot

Hello,

I’m trying to create a full-screen snapshot like this:

local snapshot = display.newSnapshot(display.contentWidth, display.contentHeight) snapshot.anchorX = 0 snapshot.anchorY = 0 snapshot.x = 0 snapshot.y = 0

But the content of the snapshot is only visible in the top-left quadrant of the screen. I have to do this to make it actually full-screen:

local snapshot = display.newSnapshot(display.contentWidth \* 2, display.contentHeight \* 2)

Why is that?

Note: I’m also running Graphics 1.0 compatibility mode.

Thanks,

George

EDIT: I’m on build 2014.2162.

I’ve migrated my project to Graphics 2.0, and the positioning behavior of snapshots is still very strange. Has anybody else had any problems with snapshots in this regard?

I should mention that I’m doing this in my main.lua:

display.setDefault("anchorX", 0) display.setDefault("anchorY", 0)  

Because my project depends on this. If I don’t set these, it seems to be working correctly. But I’m setting the anchor on the snapshot though. Why should this affect the snapshot at all?

I’ve removed the setDefault calls and I’m now creating by snapshot this way:

function ui.newFullSnapshot()     local snapshot = display.newSnapshot(display.contentWidth, display.contentHeight)     snapshot.anchorX, snapshot.anchorY = 0, 0     snapshot.x, snapshot.y = 0, 0          --I tried this too, nothing --snapshot.group.anchorChildren = true     --snapshot.group.anchorX, snapshot.group.anchorY = 0, 0     --snapshot.group.x, snapshot.group.y = 0, 0        return snapshot end

Can someone please tell me *why* this snapshot is drawn in the bottom-right quadrant of the screen, instead of the whole screen? This is driving me nuts!

I’ve attached a sample app that shows this behavior. Can someone please look at it?

OK, if I modify the attached code to this:

local snapshot = display.newSnapshot(display.contentWidth, display.contentHeight) snapshot.anchorX, snapshot.anchorY = 0, 0 snapshot.x, snapshot.y = 0, 0 local background = display.newImageRect("background.jpg", display.contentWidth, display.contentHeight) background.anchorX, background.anchorY = 0,0 background.x, background.y = -display.contentWidth/2, -display.contentHeight/2 snapshot.group:insert(background)

I get the result that I want. So, does this mean that a snapshot’s origin is always its center, regardless of the anchorX / anchorY properties?

I’ve migrated my project to Graphics 2.0, and the positioning behavior of snapshots is still very strange. Has anybody else had any problems with snapshots in this regard?

I should mention that I’m doing this in my main.lua:

display.setDefault("anchorX", 0) display.setDefault("anchorY", 0)  

Because my project depends on this. If I don’t set these, it seems to be working correctly. But I’m setting the anchor on the snapshot though. Why should this affect the snapshot at all?

I’ve removed the setDefault calls and I’m now creating by snapshot this way:

function ui.newFullSnapshot()     local snapshot = display.newSnapshot(display.contentWidth, display.contentHeight)     snapshot.anchorX, snapshot.anchorY = 0, 0     snapshot.x, snapshot.y = 0, 0          --I tried this too, nothing --snapshot.group.anchorChildren = true     --snapshot.group.anchorX, snapshot.group.anchorY = 0, 0     --snapshot.group.x, snapshot.group.y = 0, 0        return snapshot end

Can someone please tell me *why* this snapshot is drawn in the bottom-right quadrant of the screen, instead of the whole screen? This is driving me nuts!

I’ve attached a sample app that shows this behavior. Can someone please look at it?

OK, if I modify the attached code to this:

local snapshot = display.newSnapshot(display.contentWidth, display.contentHeight) snapshot.anchorX, snapshot.anchorY = 0, 0 snapshot.x, snapshot.y = 0, 0 local background = display.newImageRect("background.jpg", display.contentWidth, display.contentHeight) background.anchorX, background.anchorY = 0,0 background.x, background.y = -display.contentWidth/2, -display.contentHeight/2 snapshot.group:insert(background)

I get the result that I want. So, does this mean that a snapshot’s origin is always its center, regardless of the anchorX / anchorY properties?

Yep, you’re right.

And coupled with this bug, http://forums.coronalabs.com/topic/50862-groups-within-groups-within-snapshots/ means that full screen snapshots where groups are involved are not a fun time.

Yep, you’re right.

And coupled with this bug, http://forums.coronalabs.com/topic/50862-groups-within-groups-within-snapshots/ means that full screen snapshots where groups are involved are not a fun time.