Reputation: 3967
I'm trying to draw a image to pdf page with rotate transform. The problem is when I draw it without any transform the coordinate is right so the image is putted correctly(here is x = 0 and y = 0). But when I try to rotate(90Deg) the image before drawing, event if I set new coordinate, the image is not putted at the point that I want to.
Here's I tried:
gp.TranslateTransform(modelWidth / 2, modelHeight / 2);
if (angle > 0)
{
gp.RotateTransform(angle);
}
gp.TranslateTransform(-modelWidth / 2, -modelHeight / 2);
/*----------------------------------------------------------------*/
gp.DrawImage(xImg, new Drawing.Point(0, 0));
Thanks!
Upvotes: 2
Views: 1878
Reputation: 21729
You don't rotate the Image, you rotate the graphics context.
The co-ordinates passed to DrawImage must reflect the transformations.
See also:
http://pdfsharp.net/wiki/Graphics-sample.ashx#Draw_an_image_transformed_22
Upvotes: 3