Hi Rob
This does not work:
Heres the code I used from examplefile, I just copied the files to the sandboxed temp folder and reloaded
[lua]
– list of effects
local composite_effect = {
“composite.add”,
“composite.average”,
“composite.colorBurn”,
“composite.colorDodge”,
“composite.darken”,
“composite.exclusion”,
“composite.glow”,
“composite.hardLight”,
“composite.hardMix”,
“composite.lighten”,
“composite.linearLight”,
“composite.multiply”,
“composite.negation”,
“composite.normalMapWith1DirLight”,
“composite.normalMapWith1PointLight”,
“composite.overlay”,
“composite.phoenix”,
“composite.pinLight”,
“composite.reflect”,
“composite.screen”,
“composite.softLight”,
“composite.subtract”,
“composite.vividLight”,
}
– setup the UI
local effectText = display.newText("", display.contentCenterX/2, 180, “Helvetica”, 32)
local effectText1 = display.newText(“Normal”, display.contentCenterX / 2 + display.contentCenterX, 180, “Helvetica”, 32)
local tapToStart = display.newText(“Tap anywhere to start”, display.contentCenterX, 60, “Helvetica”, 48)
– Declare the paint
local compositePaint =
{
type=“composite”,
paint1={ type=“image”, filename=“image01.jpg”, baseDir=system.TemporaryDirectory },
paint2={ type=“image”, filename=“images/texture3.jpg” }
}
– setup the comparison image
local base = display.newImageRect( “images/image01.jpg”, 600, 400 )
base.x = display.contentCenterX / 2 + display.contentCenterX
base.y = display.contentCenterY
– setup the image to modify
local object = display.newRect(0, 0, 600, 400)
object.x = display.contentCenterX / 2
object.y = display.contentCenterY
– start up the timer to loop through the effects
local startItUp
startItUp = function(event)
if event.phase == “ended” then
tapToStart.isVisible = false
Runtime:removeEventListener(“touch”, startItUp)
local index = 1
timer.performWithDelay(2000, function()
effectText.text = composite_effect[index]
object.fill = compositePaint
object.fill.effect = composite_effect[index]
index = index + 1
end, #composite_effect)
end
return true
end
Runtime:addEventListener(“touch”, startItUp)
[/lua]
The images are well known, I think you or Walter made the example ;D)
try it out and see for your self, I use: Version 2013.2036 (2013.07.15)