On 04/24/2015 07:31 AM, Pekka Paalanen wrote:

Would it be good to set a rule of thumb, that when you are scaling
images, first compute the final size, and then compute the
transformation paramaters for Pixman, regardless from which one you
start with?

If I understand what you are asking for, the answer is no.

When scaling images do not be confused by the pixel size or pixel centers. The correct transform is the one that places the outer corners of the source image (ie integers 0,0 and w,h for the entire contents of a w,h sized image) at the outer corners of the desired destination quadrilateral.

This will produce the correct filtering and the correct position for the image. If you gradually change the destination rectangle, the image will scale smoothly with it. Another way to look at is that this rule is the one so that if you transformed to an intermediate image and then did a further transform to the final, the result will not be shifted or scaled differently (it may be blurrier but that blur will be centered with no visible shift).

The confusion is that filtering will sample outside the source rectangle, and the filtering can produce non-zero outside the destination rectangle. This effects the calculation of bounding boxes, and yes it gets complicated if you want an accurate bounding box. But you should *not* use this to determine the desired transformation.
_______________________________________________
Pixman mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to