Is it possible to scale an image without the image being all blury im scaling by an int and if i asked this twice im an idiot and you can find my project in the attachments
thanks in common
Scaling without bluring the pixels?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Scaling without bluring the pixels?
- Attachments
-
- gppcc11.zip
- (18.11 KiB) Downloaded 133 times
Re: Scaling without bluring the pixels?
Code: Select all
function love.load()
love.graphics.setDefaultFilter("nearest", "nearest")
end
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Scaling without bluring the pixels?
Grump is correct. Though that does set the default. If you later need to have an image use smoothing, you can use "linear" instead of "nearest" and apply it to just that one image like so:
Also note that there are two arguments. The first one affects images being scaled down from full size, the second scaling up. So you can have shrunken images smooth out, but scaled up ones be pixeled if you want.
Also also note that there's also a third argument, anisotropy, which you can use if you want. It's not required.
Do yourself a favor and check out the Wiki:
https://love2d.org/wiki/love.graphics.setDefaultFilter
https://love2d.org/wiki/love.graphics.s ... mageFilter
https://love2d.org/wiki/(Image):setFilter
Code: Select all
image:setFilter("linear", "linear")
Also also note that there's also a third argument, anisotropy, which you can use if you want. It's not required.
Do yourself a favor and check out the Wiki:
https://love2d.org/wiki/love.graphics.setDefaultFilter
https://love2d.org/wiki/love.graphics.s ... mageFilter
https://love2d.org/wiki/(Image):setFilter
Re: Scaling without bluring the pixels?
This doesn't work when using . Everything is still blurred. Is it possible to change this filter, too?
Code: Select all
love.graphics.scale()
Re: Scaling without bluring the pixels?
Jummit, this works perfect:
Code: Select all
function love.load()
love.window.setTitle("Cheeeers!! Point scale!")
img = love.graphics.newImage("enemy-mothership.png")
img:setFilter("nearest", "nearest")
end
function love.update(dt)
end
function love.draw()
love.graphics.scale(4)
love.graphics.draw(img)
end
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests