I am trying to make a small picture editing app. I used the API for taking a picture, but for some reason the picture shows up on the top left of the screen and is cut off. I cant figure out how to move it onto the middle of the screen. Heres my code, thanks in advance
[lua]
local widget = require “widget”
– forward declarations and other locals
local playBtn
– ‘onRelease’ event listener for playBtn
local function onPlayBtnRelease()
showPic()
return true – indicates successful touch
end
– create a widget button (which will loads level1.lua on release)
playBtn = widget.newButton{
--label=“Play Now”,
--labelColor = { default={255}, over={128} },
default=“playbutton1.png”,
over=“playbutton2.png”,
width=230, height=65,
onRelease = onPlayBtnRelease – event listener function
}
playBtn:setReferencePoint( display.CenterReferencePoint )
playBtn.x = display.contentWidth*0.5
playBtn.y = display.contentHeight - 545
playBtn.xScale = 2.5
playBtn.yScale = 2.5
– all display objects must be inserted into group
–local function doWithPicture(event)
–if media.hasSource( media.Camera ) then
– media.show( media.Camera, onComplete )
–else
– native.showAlert( “Corona”, “This device does not have a camera.”, { “OK” } )
–end
–end
function showPic(event)
local onComplete = function(event)
local photo = event.target
print( "photo w,h = " … photo.width … “,” … photo.height )
end
if media.hasSource( media.Camera ) then
local pic = media.show( media.Camera, onComplete )
else
native.showAlert( “Corona”, “This device does not have a camera.”, { “OK” } )
end
end
[/lua]