Hi Brent,
Thanks for your interest.
I have attached the image another time…
The complete code is very long but I extract the important part. I need a composed png image that contents an image and a text. All this is inserted on a group called ‘quetionGroup’
On the final part I convert this group to a png image using the display.save… but I have got the problems.
I have 8 questions to convert every time. Normally 2 are bad transformed and the other 6 are perfect. The bad images not are the same every time I tried.
Here is the code:
local function createQuestion(filenameQUE)
------------------------------- Image -------------------------------
local questionGroup = display.newGroup()
local imagenCentral
local expImage = combat.soldiers[u].expImage
local margenImagenTexto = 0.6 – margen que se deja entre las imágenes de preguntas/respuestas y el texto inferior
if(expImage~=nil) then
local imageName = aq.imageFromURL(expImage)
–print (’ ---->>> Ruta de la imágen: ’ … imageName)
if(tools.existeFichero(imageName,system.DocumentsDirectory)==true) then
imagenCentral = display.newImage(imageName,system.DocumentsDirectory)
imagenCentral.x = display.contentCenterX + distancia
local prop = aq.imageProportions(imagenCentral,imagesWidth)
imagenCentral.xScale = prop
imagenCentral.yScale = prop
imagenCentral.y = 350 – 350 Modificado para FLIPP
questionGroup:insert(imagenCentral)
else
print("No se ha hallado el fichero de la imagen de la solapa: " … u)
end
else
print("No se ha hallado la imagen de la solapa: " … u)
end
---------------------- Text --------------------------------------------------
local textoPregunta = combat.soldiers[u].questionDesc
local YtextoPregunta = display.contentHeight*.5
if (imagenCentral~=nil) then
YtextoPregunta = imagenCentral.y + imagenCentral.contentHeight * margenImagenTexto
end
if (textoPregunta~=nil) then
local options =
{
text = textoPregunta,
x = display.contentCenterX + distancia,
y = YtextoPregunta,
width = display.contentWidth*0.75,
font = fontName,
fontSize = fontSize,
align = “center” – Alignment parameter
}
local questionDesc = display.newText(options)
questionDesc:setFillColor( darkBlue[1], darkBlue[2], darkBlue[3], darkBlue[4] )
questionGroup:insert(questionDesc)
end
– ====>>> HERE IS THE PROBLEM: Finally, we save the imageGroup into a png image file
local function saveWithDelay()
display.save (questionGroup,{filename = filenameQUE, baseDir = system.DocumentsDirectory, captureOffscreenArea=true, backgroundColor = {backgroundColor[1],backgroundColor[2],backgroundColor[3]}})
print ('Grabando la imagen de la pregunta: ’ … filenameQUE)
questionGroup:removeSelf()
end
timer.performWithDelay( 100, saveWithDelay )
end
Thanks!