Page 1 of 1

How to scale extend width/height of border images without doubling the border thickness.

Posted: Mon Oct 09, 2017 1:27 pm
by lavrod
Hi,
How to scale extend width/height of border images without doubling the border thickness.

currently using love.graphics.setDefaultFilter("nearest","nearest",1)

For example I want to double the following image

111
101
111

to

1111
1001
1001
1111

not

111111
111111
110011
110011
111111
111111

Re: How to scale extend width/height of border images without doubling the border thickness.

Posted: Mon Oct 09, 2017 9:08 pm
by Merlin_ua
The usual scaling methods don't discriminate edge pixels vs center pixels, so you won't be able to achieve what you want.

However, this looks like a problem for the 9-patch images. You can read about them here: http://wiresareobsolete.com/2010/06/9-patches/ There is a Love2d library that you might try: https://github.com/excessive/patchy