Hello,
I have two questions related to maximum image size of a snapshot.
What is the maximum image size that can be added to a snapshot?
I noticed that when I create a rectangle and use an image for the fill, the snapshot will not render the image if one of its dimensions exceed 1024 (the snapshot will display all black).
I assumed the maximum size of my rectangle could not exceed the maximum texture size as defined by system.getInfo( “maxTextureSize” ), but it is actually a fourth of that in this case (the maxTextureSize is 4096). Is there some programatic way to determine the maximum size image? Will it always be maxTextureSize/4?
What is the maximum image size that can be added to a snapshot if the fill is rotated?
I noticed that if the fill is rotated then the snapshot will display all black if the dimensions of the image are 1024. But if I change the the dimensions to 1012 the snapshot renders properly. The code below renders all black on my ios device but if I remove the rotation or reduce the image height to 1012 then it renders properly.
local function createSnapshot()
local imageWidth = 675
local imageHeight = 1024
local rectangle = display.newRect(0, 0, imageWidth, imageHeight)
local paint = {
type = "image",
baseDir = system.ResourceDirectory,
filename = "test.png"
}
rectangle.fill = paint
rectangle.fill.rotation = 90 -- This rotation causes the snapshot not to render when imageHeight == 1024
local snapshot = display.newSnapshot( imageWidth, imageHeight )
snapshot.group:insert(rectangle)
snapshot:invalidate()
snapshot.x = display.actualContentWidth/2
snapshot.y = display.actualContentHeight/2
return snapshot
end