display.save

Hi all,

What are the prerequesits for display.save? especially:

-does the group have to be on screen?

-do I have to use it in a timer after after I transform the group?

-can the group be obstructed?

-is this different on devices and on the simulator?

I’d like to take a picture only of a certain group without flickering and such that the pngs are saved in a smaller resolution. What’s the best way to do that?

  • Yes.

  • No.

  • No, It will not be. Just the group is rendered, not the obstructions I believe.

  • Yes, the resolution is very different for one thing. Devices save in (very high denisty) device pixels, the sim not so HD. Permissions on Android are another potential issue I believe.

As far as not flickering, that’s pretty much dependent on what you do onscreen while you capture. But there’s no inherent reason it needs to flicker (unless you’re trying to make a movie and removing/adding a lot while capturing).

Note that “Stuttering” is different than flickering… If you’ve got lots of great 60 fps animation going on and you take a snapshot, you will likely see a frame or two drop (a stutter). This is of course technically different that a “flash” where some objects disappear for a frame or two then reappear…  Stutter you might get (and not too much you can do about it). Flashing though - shouldn’t happen unless you remove / re-order things when you take the picture.

As far as smaller resolution goes – the images will be taken at the current devices screen resolution. In the case of the iPad 3, that’s pretty high res. To make the image smaller, at the time of capture you can change the groups .xScale and .yScale, take the picture, and then set it back.

The first thing to play with for the group scale is setting it to display.ContentScaleX, display.ContentScaleY. Setting the scale to these will set the objects back to the original resolution for the save. From there, you may want to decrease the scaling further (the sim does not simulate this well - the resolutions are too low).

Interesting. In my experience, display.save immediately after a transformation doesn’t work. At least on the simulator. It will save the group disregarding the last transform (as of version 2014.2162). Perhaps the transformation will happen the next frame, whereas display.save does it’s thing in the same frame it’s used.

So I think we do need a timer.

That said: I want to take a screenshot of a thing in a smaller resolution. Because it has to be on the screen, I’d scale it down, display.save it, and scale up again. Then the timer introduces some sort of flickering.

How do you guys do that?

  • Yes.

  • No.

  • No, It will not be. Just the group is rendered, not the obstructions I believe.

  • Yes, the resolution is very different for one thing. Devices save in (very high denisty) device pixels, the sim not so HD. Permissions on Android are another potential issue I believe.

As far as not flickering, that’s pretty much dependent on what you do onscreen while you capture. But there’s no inherent reason it needs to flicker (unless you’re trying to make a movie and removing/adding a lot while capturing).

Note that “Stuttering” is different than flickering… If you’ve got lots of great 60 fps animation going on and you take a snapshot, you will likely see a frame or two drop (a stutter). This is of course technically different that a “flash” where some objects disappear for a frame or two then reappear…  Stutter you might get (and not too much you can do about it). Flashing though - shouldn’t happen unless you remove / re-order things when you take the picture.

As far as smaller resolution goes – the images will be taken at the current devices screen resolution. In the case of the iPad 3, that’s pretty high res. To make the image smaller, at the time of capture you can change the groups .xScale and .yScale, take the picture, and then set it back.

The first thing to play with for the group scale is setting it to display.ContentScaleX, display.ContentScaleY. Setting the scale to these will set the objects back to the original resolution for the save. From there, you may want to decrease the scaling further (the sim does not simulate this well - the resolutions are too low).

Interesting. In my experience, display.save immediately after a transformation doesn’t work. At least on the simulator. It will save the group disregarding the last transform (as of version 2014.2162). Perhaps the transformation will happen the next frame, whereas display.save does it’s thing in the same frame it’s used.

So I think we do need a timer.

That said: I want to take a screenshot of a thing in a smaller resolution. Because it has to be on the screen, I’d scale it down, display.save it, and scale up again. Then the timer introduces some sort of flickering.

How do you guys do that?