Build new image base on newQuads

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.
Post Reply
shaan1974
Prole
Posts: 11
Joined: Sat Jan 14, 2023 8:26 pm

Build new image base on newQuads

Post by shaan1974 »

Hello,

I'v got a base image with flags. Base on this image:
https://github.com/lafeber/world-flags- ... lags32.png

I want to create a new image related to defined flags that i need. By ex i need only flags of France, Italy and Spain.

I know that it's possible to get the 3 flags i need with Quads.

But after i'v got my 3 quads, is it possible to create a new image on the fly containing the 3 flags ? Like witdh of 100px and height of 300px.
And defined flag position y at 0px (FR) 100px (IT) and 200px (SP).

Thanks
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Build new image base on newQuads

Post by Bigfoot71 »

You might as well keep only the images you need and everything is said in the wiki, I don't see what to add.

If you want to have them at the size you want, use the sx,sy parameters of love.graphics.draw.

The target size is 100px and the original size is 32px so to get the scaling value you do: 100/32=3.125 -> 3.125*32=100

Then draw the whole thing in a canvas if you want to make an image of it.

https://love2d.org/wiki/love.graphics.newQuad
https://love2d.org/wiki/love.graphics.newCanvas
https://love2d.org/wiki/love.graphics.draw
Attachments
flags.love
(2.34 KiB) Downloaded 17 times
My avatar code for the curious :D V1, V2, V3.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests