Hello,
I’d like to apply a gradient also to images. Now if you try to apply a gradient to an image you receive the following message from the simulator:
[bash]
2013-02-10 23:11:45.347 Corona Simulator[11594:f03] WARNING: o:setFillColor() Gradients cannot be applied to image objects.
[/bash]
I wrote the following test code (main.lua) to test this functionality for the future:
(you can find the b/w test image here)
[lua]
local screenWidth = display.contentWidth;
local screenHeight = display.contentHeight;
– Gradients
local backgroundGradient = graphics.newGradient({255,255,100},{150,255,100}, “down”);
local imageGradient = graphics.newGradient({255,50,0},{255,125,0}, “down”);
local background = display.newRect(0,0,screenWidth,screenHeight);
background:setFillColor(backgroundGradient);
background:setReferencePoint(display.CenterReferencePoint);
background.x = screenWidth*0.5;
background.y = screenHeight*0.5;
local myImage = display.newImageRect(“image.png”, 285, 299);
myImage:setFillColor(imageGradient);
myImage:setReferencePoint(display.CenterReferencePoint);
myImage.x = screenWidth*0.5;
myImage.y = screenHeight*0.5;
local myImageScale = math.min(1,screenWidth/myImage.width);
myImage.xScale = myImageScale;
myImage.yScale = myImageScale;
[/lua] [import]uid: 42955 topic_id: 35773 reply_id: 335773[/import]