As you can see, there's 5 separated image in that file and I want to make a program which does extracts those 5 images. I have every data that I need to extract the image, so this is just a math problem (yea, I'm bad at math anyway).
I can simply copy the first image (the big one) into another buffer because it doesn't rotated nor flipped. But take a look at the images below it (the second image), it's both flipped and rotated.
I have the second image Vertex & UV coordinates map. Here it is:
Vertex 0: 0 0; UV 0: 0 0.6328125
Vertex 1: 88 0; UV 1: 0 0.71875
Vertex 2: 88 640; UV 2: 0.625 0.71875
Vertex 3: 0 640; UV 3: 0.625 0.6328125
Now, I want to copy that image to specific buffer. How can I make the buffer contain something like this?
I did not use OpenGL nor DirectX because it's not an application to render an image, rather than converting image. I just want to copy the transformed image into the buffer and save it as PNG (I already know how to save the buffer as PNG).
To make it clear: Example the coordinates 0,0 of that image is 0,735 in that texture. What is the formula to make 40,122 (in image) = 122,696 (in texture)?
Anyone can help me about this? (Google doesn't give anything useful or I'm typing wrong keyword).
PS: I'm dealing with 4 Bytes per Pixel.