Scaling love.graphics geometric shapes like bitmap pics?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
veethree
Inner party member
Posts: 875
Joined: Sat Dec 10, 2011 7:18 pm

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by veethree »

If the things you're trying to scale are static perhaps using love.graphics.newScreenshot could be an option. But you definitely don't want to be calling that every frame.
EDIT: On 2nd thought that's probably stupid.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by Lafolie »

veethree wrote:If the things you're trying to scale are static perhaps using love.graphics.newScreenshot could be an option. But you definitely don't want to be calling that every frame.
EDIT: On 2nd thought that's probably stupid.
Thought of this too, but decided not to post it as it's pretty bad advice, haha. Theoretically though, it gets the job done!
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
Daniel Eakins
Citizen
Posts: 99
Joined: Thu Jul 18, 2013 9:14 pm
Location: France

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by Daniel Eakins »

I guess I'll try to use pre-rendered images when possible, and ImageData otherwise. Thanks for the replies!
bizziboi
Citizen
Posts: 57
Joined: Sat Apr 16, 2011 9:24 am

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by bizziboi »

Alternatively, make a sprite of a line and scale and rotate it to match desired begin and end position. To get similar pixelation for short and long lines you could make a long line sprite and only draw a part of it that is sized relative to the length of the desired line segment.
Hope you paid attention in trig :op

That gives no perf overhead but will pixelate (if set to point filtering that is)
User avatar
Daniel Eakins
Citizen
Posts: 99
Joined: Thu Jul 18, 2013 9:14 pm
Location: France

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by Daniel Eakins »

bizziboi wrote:Alternatively, make a sprite of a line and scale and rotate it to match desired begin and end position. To get similar pixelation for short and long lines you could make a long line sprite and only draw a part of it that is sized relative to the length of the desired line segment.
Hope you paid attention in trig :op

That gives no perf overhead but will pixelate (if set to point filtering that is)
With a pre-rendered image of a horizontal (or whatever) line? This doesn't work; love.graphics.rotate doesn't pixellate (result is similar to the white line in the first post).
Zeliarden
Party member
Posts: 139
Joined: Tue Feb 28, 2012 4:40 pm

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by Zeliarden »

Use a custom line function
here is an example using https://github.com/kikito/bresenham.lua
Attachments
example2.love
(2.47 KiB) Downloaded 69 times
User avatar
Daniel Eakins
Citizen
Posts: 99
Joined: Thu Jul 18, 2013 9:14 pm
Location: France

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by Daniel Eakins »

Zeliarden wrote:Use a custom line function
here is an example using https://github.com/kikito/bresenham.lua
Wow, thanks! That's perfect. I'm really amazed by what LÖVE is capable of :awesome:
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by Lafolie »

Daniel Eakins wrote: Wow, thanks! That's perfect. I'm really amazed by what kikito is capable of :awesome:
Fixed that for you ;)
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
bizziboi
Citizen
Posts: 57
Joined: Sat Apr 16, 2011 9:24 am

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by bizziboi »

With a pre-rendered image of a horizontal (or whatever) line? This doesn't work; love.graphics.rotate doesn't pixellate (result is similar to the white line in the first post).
You already have a solution, but I still think this would have worked - you'd use a lower res texture for the line image and scale it up with point filtering - that would have given you larger pixels.
User avatar
DaedalusYoung
Party member
Posts: 407
Joined: Sun Jul 14, 2013 8:04 pm

Re: Scaling love.graphics geometric shapes like bitmap pics?

Post by DaedalusYoung »

Yes, but you can't rotate that image, so you would either need Megabytes full of prerendered shapes, or generate the image on the fly.
Post Reply

Who is online

Users browsing this forum: No registered users and 87 guests