Hi all:
I posted this same thing before but nobody understood what I wanted.
I would like to try again so here goes:
I have an ALLEGRO_BITMAP *image. I want to rotate that image 45 degrees.
No problem! How on this earth do I save that rotated bitmap (image) so
I can use it later in my program? If later I call that bitmap (image)
I get the bitmap before it was rotated. I want the bitmap after it was
rotated.
I tried this:
al_save_bitmap("temp.png", image);
temp_image = al_load_bitmap("temp.png");
It does NOT work! temp_image shows the image BEFORE ROTATION.
This is a big problem for me and it comes up all the time.
Hopefully someone can help me. We had this discussion before and they
did try to help but didn't understand what I wanted,
Thanks guys!!!!!!!!!!
You probably saved the wrong bitmap, then? It's easier to help if you post your actual code
You can't save a rotated bitmap. You can DRAW your rotated bitmap onto another rectangular bitmap and then save that.
Original rotation confusion...
This code will do exactly what you want. Attached are the original image and rotated image after saving.
EDIT: Fixed to use proper 45 degree (radians) angle.
Hi Dizzy:
Thanks! That did it:
This was a great learning exercise for me.
Now I know more about how to use the backbuffer in allegro5.
Thanks again, have a great day!
EDIT: deleted drunk post.
Here's an updated version that will work with non-square images:
Drawing only affects the target bitmap. So target a buffer that's big enough, draw your rotated bitmap onto it, and then save the buffer.