• Advertisement
Sign in to follow this  

Getting RotateFlip to work (C#)

This topic is 3393 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not much of a C# whiz, so my knowledge with the system.drawing library is basically non-existent. I've got an animation tool where I need to apply rotations and mirroring to my image. The rotation code below works fine, but I can't seem to get RotateFlip to work. My guess is something stupid trivial, so please enlighten :)
//Create a new bitmap to render into
Bitmap bitmap = new Bitmap((int)cell.w, (int)cell.h);
Graphics g = Graphics.FromImage(bitmap);

//if (cell.mirror == true)

//Perform transformations
g.TranslateTransform((float)bitmap.Width / 2, (float)bitmap.Height / 2);
g.TranslateTransform(-(float)bitmap.Width / 2, -(float)bitmap.Height / 2);

//Render to the bitmap
Rectangle rt = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
g.DrawImage(ActiveTexture, rt, cell.tx, cell.ty, cell.w, cell.h, GraphicsUnit.Pixel);

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement