screenshot =love.graphics.newScreenshot()
filedate = love.image.newEncodedImageData(screenshot,"tga")
success = love.filesystem.write( "image.tga", filedate)
found the image.tga is reversal,change the image format to "bmp",also the image.bmp is reversal.
Is this a issue or by design?
THK
The image of the save the screenshot is reversal
-
- Prole
- Posts: 47
- Joined: Thu Sep 24, 2009 1:49 pm
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: The image of the save the screenshot is reversal
It is a bug, I think it is fixed in the next version of LÖVE.
Help us help you: attach a .love.
Re: The image of the save the screenshot is reversal
Edit: It's fixed in 0.8.0.
In the meantime you could use a cheap workaround. Not all ImageData are affected by this origin problem. It will be correct for images loaded from encoded formats. To exploit this you have to create a dummy image with the width and height of your original image and then paste it over the new image:
Code: Select all
function forceTopLeftOrigin(img)
local imgWidth, imgHeight = img:getWidth(), img:getHeight()
local PBM = string.format("P4\n%d %d\n%s", imgWidth, imgHeight, ("\255"):rep(math.ceil(imgWidth*imgHeight/8)))
local imgFile = love.filesystem.newFileData(PBM, "temp.pbm", "file")
local newImg = love.image.newImageData(imgFile)
newImg:paste(img, 0, 0, 0, 0, imgWidth, imgHeight)
return newImg
end
That's of course not really fast.
Shallow indentations.
Who is online
Users browsing this forum: Bing [Bot] and 2 guests