ah I changed the calculation of the angle
var angle = Math.PI * 90.0 / 180.0;
no it looks better but the width and height are still the original width
and height. Rotating an 1024x768 image by 90 degrees should result in
768x1024 - but it's still 1024x768
On Sun, Apr 1, 2012 at 1:40 PM, Christoph Schramm <[email protected]>wrote:
> So I tried
>
> var angle = 45.0;
> t.AddImage(img, (float)(maskw * Math.Cos(angle)), (float)(maskh *
> Math.Sin(angle)), (float)(maskw * -Math.Sin(angle)), (float)(maskh *
> Math.Cos(angle)), imageX, imageY);
>
> which should be the c# equivalent...
>
> Bad luck, the image gets screwed... original image is 1024x768, rotated
> image (by 45 degrees) is still 1024x768 but... screwed...
>
> On Sat, Mar 31, 2012 at 4:45 PM, Christoph Schramm <[email protected]>wrote:
>
>> Great answer, thank a lot for your help! I didn't notice that overload
>>
>> On Saturday, March 31, 2012, 1T3XT BVBA wrote:
>>
>>> On 31/03/2012 16:13, Christoph Schramm wrote:
>>> > It works well, but it ignores the rotation.
>>>
>>> You're mixing "let iText control things" with "let me control things"!
>>>
>>> If you declare a rotation, you say: "let iText control things". This
>>> means you intend to add the image to a Document with the Add method.
>>> However, if you add an Image to a PdfTemplate using addImage and you
>>> define a transformation matrix (maskw, 0, 0, maskh, imageX, imageY), you
>>> say "let me control things". The two zeros in your (maskw, 0, 0, maskh,
>>> imageX, imageY) tell me you're not rotating the image.
>>>
>>> > I already tried to put the original image in another template, rotate
>>> > that, get an image instance from that and at his image instance to my
>>> > PdfTemplate t. But that doesn't work neither.
>>>
>>> Either you do:
>>> img.RotationDegrees = (float)userbild.ImageFrame.rotation;
>>> And you add the image straight to a Document object.
>>>
>>> Or you want to add the image to a PdfTemplate, in which case you don't
>>> define RotationDegrees, but you use:
>>> t.AddImage(img, maskw * cosine(angle), maskh * sine(angle), maskw *
>>> -sine(angle), maskh * cosine(angle), imageX, imageY);
>>> I don't know the exact notation of the methods for sine and cosine in
>>> C#, but I hope you get the idea.
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> This SF email is sponsosred by:
>>> Try Windows Azure free for 90 days Click Here
>>> http://p.sf.net/sfu/sfd2d-msazure
>>> _______________________________________________
>>> iText-questions mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>>
>>> iText(R) is a registered trademark of 1T3XT BVBA.
>>> Many questions posted to this list can (and will) be answered with a
>>> reference to the iText book: http://www.itextpdf.com/book/
>>> Please check the keywords list before you ask for examples:
>>> http://itextpdf.com/themes/keywords.php
>>>
>>
>
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php