minetest/minetest — pull request #759 by khonkhortisan (2013-06-05 16:26:10+00:00)
Title: Scaling version of [combine

```
[combine:WxH:X,Y=filename:X,Y=filename2
[map:X1,Y1,X2,Y2=filename:X1,Y1,X2,Y2=filename2
```
`[combine` takes an image size if there's no existing image (which may be thought of as the maximum image size) and a corner **pixel** to start drawing the above image at.
`[map` takes an existing image (may be transparent, and the default expected size) and a **fraction** for both corners of where to draw the above image to. It scales both the base and above images until they both fit.
Consider the unified_skins/[skins](https://github.com/Zeg9/minetest-skins)/[3d_armor](http://forum.minetest.net/viewtopic.php?id=4654)/more_armor/
wieldview-generated image:
![character_21](https://f.cloud.github.com/assets/1996449/609788/1c6540a4-cd97-11e2-8b8b-e40c48d950b6.png)
It's a 64x64 image with the skin and armor drawn at (0,32), the item at (0,0), and the shield at (0,16) using `[combine`.
If any of the images change size (say, by a power of 2), they will overlap the others, go off the edge, or hide in a corner.
Using `[map`, it still starts off as a 64x64 transparent image, but with the skin and armor drawn at (0,0.5 to 1,1), the item at (0,0 to 0.25,0.25), and the shield at (0.25,0 to 0.5,0.25).
If any of the images change size (ditto), All the images will scale with it and maintain the same aspect ratio and placement.
This is what happens when the skin doubles in size with `[combine` (without armor to show the face-shirt) and with `[map`:

![minetestskin](https://f.cloud.github.com/assets/1996449/609808/63ce3922-cd98-11e2-82d0-341d061c19ac.png)
![minetestunified_skinsmap](https://f.cloud.github.com/assets/1996449/609826/0488c5c6-cd99-11e2-80ea-e200fefa024e.png)
These are recreations of the uv maps used:
![minetestskin2](https://f.cloud.github.com/assets/1996449/609856/88f42e44-cd9a-11e2-93c8-d71d1716eacd.png)
The skin is too large to fit and the face gets offset to where the chest is.
![minetestskin3](https://f.cloud.github.com/assets/1996449/609857/88f8bb8a-cd9a-11e2-942d-0d41bbb68be3.png)
The image is made larger for the skin to fit in, then the items are expanded to the size of their spots.

---
It doesn't have to be called `[map`, it may even be possible to combine it back with `[combine`.
`[map` uses lowest common multiple to increase both the image and baseimage. It has some math problems like crashing on a 1x1 baseimage, or fractions that don't go evenly to a baseimage pixel. I'm not sure floor and ceil are needed.
The flat images weren't directly taken from minetest, but were created separately after-the-fact. Though I can guarantee you they are correct.
So this is a proof-of-concept, and could use some testers to get it to merge quality.
![minetestmap](https://f.cloud.github.com/assets/1996449/609893/d391836e-cd9c-11e2-8fd6-3dbd10b6cd8b.png)
An inspiring [picture](http://forum.minetest.net/viewtopic.php?pid=91815#p91815)