display.save boundaries issue in letterbox format

Hi Rob,

Yes, I looked at the ‘captureScreen’ function but it only save the image in the device’s photo library,

asking user for special permissions to do so (which will be weird to just share a screenshot as I use it for).

Plus it places the resulting image on top of the screen (even if manually removed, not really ideal).

Is there another way to just let ‘display.save’ capture the whole screen ?

Should I fill a bug report or feature request ?

Thanks,

GoG

I’d file it as a bug report.  

Rob

Thanks Rob,

I just reported it as a bug.

Hope it will be fix soon…

GoG

Hello!

Try following:

[lua]

local function onCapture()

    local captureObject = display.captureBounds {

        xMin = display.safeScreenOriginX,

        yMin = display.safeScreenOriginY,

        xMax = display.actualContentWidth,

        yMax = display.actualContentHeight,

    }

    local saveGroup = display.newGroup( )

    saveGroup:insert( captureObject )

    display.save( saveGroup, { filename=“capture.png”, baseDir=system.DocumentsDirectory,

                  captureOffscreenArea=true, backgroundColor={0} } )

    saveGroup:removeSelf( )

    cptTxt.text = “Done”

end

[/lua]

add the origins to xMax/yMax (else w/h alone won’t form proper bounds when non-zero origin)

Hello,

Thank you for your support.
The workaround seems to work nicely.

@davebollinger: you’re right, it won’t save non-safe areas (e.g. area under status bar) with these parameters.

The suggested changes to ‘display.save’ API might still be interesting for future releases, I think.

Regards,
GoG

if you want to capture everything on screen then simply do this

 local capture = display.captureScreen(true) display.remove(capture) capture = nil