Is there a way to rotate and scale an ImageData I want to paste into another ImageData?
I want to create sprites from bunch of building blogs. Like a varied animated characters that would be build from few blocks like shoes, pants, torso, etc. without having to create each building block in various rotations.
I could create huge amount of sprites with little work this way.
ImageData rotate and scale
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: ImageData rotate and scale
Not that I'm aware of right away, but I think you could try using Quads, and using the love.graphics.push/translate/rotate/.../pop functions. Somebody please correct me.
{Edit: see http://love2d.org/wiki/love.graphics.push and friends}
{Edit: see http://love2d.org/wiki/love.graphics.push and friends}
Help us help you: attach a .love.
Re: ImageData rotate and scale
Yeah, I've been trying to do a similar thing with Boxdude, trying to take a single Boxdude graphic and rotating it in the varying directions to save file space, increasing load time as a sacrifice. Just transforming every time causes slowdown when you aren't looking in the correct direction.
Good bye.
Re: ImageData rotate and scale
Transformations like rotation and scaling are only possible if you draw on the screen. In a future version of LÖVE you may also be able to draw into a non-visible frame buffer with the usual love.graphics.draw() operations, but we don't have that feature yet. So, with ImageData, we're stuck with the block copying operation and setting individual pixels.
It seems you only have two options for now.
1: Roll your own rotation and scaling code. There are plenty of examples to get you started; just do a web search. Doing this in pure Lua is not necessarily too slow: at least you should try it to see how fast you can make it go.
2: Actually draw on the screen, take a screen shot and read the pixels from the image data. This is obviously clumsy and visible to the user, but it might work well enough for some purposes.
Outside of LÖVE, you can also use image manipulation programs and APIs. I've found ImageMagick[1] to be quite useful. You could write simple shell or Lua scripts to drive it, and create a lot of images automatically. Of course, in this situation you are limited by the space all the images are going to take, since you would be creating them all in advance.
[1]: http://www.imagemagick.org/script/index.php
(Others might prefer GraphicsMagick to the above program. I sadly found it did not render certain SVG features very nicely yet (last time I tried, several months ago), so I was not fully happy with it. But you might want to try both anyway.)
It seems you only have two options for now.
1: Roll your own rotation and scaling code. There are plenty of examples to get you started; just do a web search. Doing this in pure Lua is not necessarily too slow: at least you should try it to see how fast you can make it go.
2: Actually draw on the screen, take a screen shot and read the pixels from the image data. This is obviously clumsy and visible to the user, but it might work well enough for some purposes.
Outside of LÖVE, you can also use image manipulation programs and APIs. I've found ImageMagick[1] to be quite useful. You could write simple shell or Lua scripts to drive it, and create a lot of images automatically. Of course, in this situation you are limited by the space all the images are going to take, since you would be creating them all in advance.
[1]: http://www.imagemagick.org/script/index.php
(Others might prefer GraphicsMagick to the above program. I sadly found it did not render certain SVG features very nicely yet (last time I tried, several months ago), so I was not fully happy with it. But you might want to try both anyway.)
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: ImageData rotate and scale
I'm with pekka on this one.
Use your graphic's program "rotate" or, if you need some kind of automation, go with imagemagick for now.
In any case, you will probably need to go over the generated images anyway in order to fix some of them.
Use your graphic's program "rotate" or, if you need some kind of automation, go with imagemagick for now.
In any case, you will probably need to go over the generated images anyway in order to fix some of them.
When I write def I mean function.
Re: ImageData rotate and scale
Hm...I'm going to try out the screenshot technique. I could have it so that on the Luiji Games Unincorporated screen that the different directions appear on the screen to sort of be a loading bar or something.
Good bye.
Who is online
Users browsing this forum: Google [Bot] and 3 guests