function draw()
-- This sets a dark background color
if bga == 255 then
background(40, 40, 50,bga)
else
background(0,0,0,bga)
end
-- This sets the line thickness
strokeWidth(1)
stroke(255,alpha)
noFill()
rect(0,0,Capwidth,Capheight)
noStroke()
fill(0,0,255,buttonbga)
rect(125,497,25,12.5)
fill(255,0,0,buttonbga)
rect(179,499,17,9)
--500
fill(0, 0, 0, buttonbga)
rect(125,542.9,87,15)
rect(232.886,542.9,72,15)
-- Do your drawing here
font("Courier")
fontSize(13)
buttonbga = fontbga
fill(255,fontbga)
textWrapWidth(242)
text("Capture the background as well? ",172,527)
text("Yes",139,502) --497)
text("No",188,503) --510
font("Courier")
fontSize(13)
fill(255,fontbga)
textWrapWidth(181)
text("Fullscreen or Standard?",219,551)
if show == "full" then
displayMode(FULLSCREEN)
show = ""
elseif show == "stand" then
displayMode(STANDARD)
show = ""
end
if Your_Current_Image ~= fieldbackup[6] then
fieldbackup[1] = Capwidth
fieldbackup[2] = Capheight
fieldbackup[3] = Imgwidth
fieldbackup[4] = spritex
fieldbackup[5] = spritey
fieldbackup[6] = Your_Current_Image
clearParameters()
Capwidth = fieldbackup[1]
Capheight = fieldbackup[2]
width = fieldbackup[3]
spritex = fieldbackup[4]
spritey = fieldbackup[5]
Your_Current_Image = fieldbackup[6]
loadedsprite = readImage(Images[Your_Current_Image])
clearOutput()
dynameters()
Instructions_and_Results()
print("loaded")
end
if spritex > Capwidth or spritex < 0 then
fieldbackup[1] = Capwidth
fieldbackup[2] = Capheight
fieldbackup[3] = Imgwidth
fieldbackup[4] = spritex
fieldbackup[5] = spritey
fieldbackup[6] = Your_Current_Image
clearParameters()
Capwidth = fieldbackup[1]
Capheight = fieldbackup[2]
width = fieldbackup[3]
spritex = Capwidth/2
fieldbackup[4] = spritex
spritey = fieldbackup[5]
Your_Current_Image = fieldbackup[6]
dynameters()
end
if spritey > Capheight or spritey < 0 then
fieldbackup[1] = Capwidth
fieldbackup[2] = Capheight
fieldbackup[3] = Imgwidth
fieldbackup[4] = spritex
fieldbackup[5] = spritey
fieldbackup[6] = Your_Current_Image
clearParameters()
Capwidth = fieldbackup[1]
Capheight = fieldbackup[2]
width = fieldbackup[3]
spritex = fieldbackup[4]
spritey = Capheight/2
fieldbackup[5] = spritey
Your_Current_Image = fieldbackup[6]
dynameters()
end
sprite(loadedsprite,spritex,spritey,Imgwidth)
if andanother == "y" then
alpha = 0
if omitbg == "n" then
bga = 0
elseif omitbg == "y" then
bga = 255
end
fontbga = alpha
buttonbga = fontbga
clearOutput()
andanother = ""
SaveCap()
end
end
function touched(touch)
--touch based omission
if touch.x > 0 and touch.x < Capwidth + 1 and touch.y < Capheight + 1 and touch.y > 0 and savedCap ~= nil then
savedCap:set(touch.x,touch.y,0,0,0,0)
end
if touch.x >= 125 and touch.x <=125 + 87 and touch.y >= 542.9 and touch.y <= 542.9 + 15 then
show = "full"
elseif touch.x >= 232.886 and touch.x <= 232.886 + 72 and touch.y >= 542.9 and touch.y <= 542.9 + 15 then
show = "stand"
end
if touch.x > -1 and touch.tapCount == 2 then
if touch.state == BEGAN or touch.state == MOVING then
fontbga = 255
--elseif touch.state == ENDED then
--fontbga = 0
buttonbga = fontbga
end
if touch.x >= 125 and touch.x <= 125 + 25 and touch.y >= 497 and touch.y <= 497 + 12.5 then
omitbg = "y"
andanother = "y"
elseif touch.x >= 179 and touch.x <= 179 + 17 and touch.y >= 499 and touch.y <= 499 + 9 then
omitbg = "n"
andanother = "y"
end
end
end
--[[
fill(0,0,255,buttonbga)
rect(125,497,25,12.5)
fill(255,0,0,buttonbga)
rect(179,500,17,8.5)
--]]
function SaveCap()
if Capwidth == 768 and Capheight == 1024 then
if scrncp == nil then scrncp = 1 + screencaps else scrncp = scrncp + 1 end
savor = "Documents:ScreenCap"..tostring(scrncp)
elseif Capwidth == Capheight or Capwidth < 768 or Capheight < 1024 then
if imgcp == nil then imgcp = 1 + imagcaps else imgcp = imgcp + 1 end
savor = "Documents:ImagCnCap"..tostring(imgcp)
end
--ImagCnCap
savedCap = image(Capwidth,Capheight)
setContext(savedCap)
draw()
setContext()
saveImage(savor,savedCap)
alpha = 255
bga = alpha
show = "stand"
Instructions_and_Results()
print("saved")
end
Description = "ImagCon Guys this is it a way to capture, resize, and save what's on your screen. As well as a way to move, resize, capture, and save images you have in your spritepacks be it in your Documents folders or your camera roll . "..RETURN.."Special thanks to Simeon for the ScreenCap tutorial, without which none of this would be possible. As well as his image IO tutorial."
saveProjectInfo("Description",Description)
saveProjectInfo("Author","melrdmydea")
oh and incase you’re wondering it works. I’ve used it myself.
As for displaying it in one of your programs?
you’ll want to code in a sprite() function with a reference to the name of the image.
just code in sprite() then touch inside those () and you should bring up your spritepack. Go to documents and look for either ImagCnCap or ScreenCap. touch it and it will be assigned to that sprite