I've looked into the transformation matrices and I came up with the
following idea.
I can calculate the matrix after my three transformations.
If I want the image to be in the correct place I have to do a final matrix
transformation:
current_matrix = transformation_matrix . desired_matrix
I have a couple of questions:
- Will the above idea give me the desired result
- Is my assumption correct that if I rotate the image not around the
origin, but some other point that the matrix looks as follows:
cos(a) -sin(a) cx
sin(a) cos(a) cy
0 0 1
- Is my assumption correct that the desired matrix I want looks like this:
1 0 width_transform
0 1 height_transform
0 0 1
Or will it have to look something like this:
curr_matrix_value curr_matrix_value width_transform
curr_matrix_value curr_matrix_value height_transform
0 0 1
Thanks,
Chantal
>> I think it has something to do with the changed coordinate systems due
>> to
>> the rotation and scaling.
>
> Yeah, this is what's happening. I ran into this problem trying to apply
> multiple translations, scaling, and rotation on an element. Do a Google
> search for "AffineTransformUtil" which I wrote to deal with this. It
> basically gives you the results you're looking for. When you translate,
> it removes rotation and scaling, applies the translation, then reapplies
> the scaling and rotation. This makes it so the scaling and rotation don't
> affect your calculated translation difference.
>
> Michael
>
> ________________________________
>
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tue 10/7/2008 2:50 AM
> To: [email protected]
> Subject: Re: nested image transformations
>
>
>
> Hi,
>
> What I want is to add a image from disk to my document.
> That image has the correct sizes to fit into a rectangle I draw right
> after placing the image.
> That image is rotated 90 degrees, so I have to rotate it back. Because of
> the rotation, I have to scale the image back to it's original size. This
> all works fine, I have a rotated image at the right size. Now I want to
> place the image into my rectangle. When I try to place the image at the
> correct place (as I think it should be) it doesn't place the image at the
> correct position (it is placed somewhat higher and more to the left as I
> expect it to be).
>
>
> I think it has something to do with the changed coordinate systems due to
> the rotation and scaling. I can place the image manually with some values
> to the right position, but I like to have a generic solution, because not
> all the documents I generate have the same measurements and sizes.
>
> Is there such a generic solution?
>
> I hope this clarifies what I want to do, and what exactly is wrong.
>
> Chantal
>
>>
>> Can you describe what you want where? Simply saying what you
>> have is wrong isn't enough for anyone to help you fix it...
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]