On Mar 31, 2005, at 12:17 PM, David Niemeijer wrote:
This was, as sometimes happens, an historical decision that
"seemed right at the time." This function was originally used for
easy layout in N-up printing. In that case, it seemed better to
avoid scaling up a PDF file when it was smaller than the page rect
- instead, we kept the size unchanged and centered the PDF in the
page rect. Unfortunately, this particular behavior now makes it
necessary to jump through some hoops if you want uniform scaling
both up and down.
And, probably those hoops are simple for you as you must be using
transformations all the time, but I have been puzzling on this now
for some time and cannot seem to figure out how to do this
correctly. I can scale easily, but then my image also needs to be
translated to keep it within my rectangle (if I just scale, it
walks out of my rect as I make the rect bigger and bigger). What
would be the correct way to do the upscaling taking into account
the image's art box and the rect I want to display it in?
A scale is always relative to the current origin. The easiest way
to get the scale you expect is to first translate the origin so that
it's at the point on your PDF that you expect to remain unchanged by
the scale (i.e., generally either the upper-left or lower-left
corner). If you scale and then translate it can be more confusing
because you're actually translating in the scaled coordinate system.
That makes sense, but the rectangle into which I want to draw, itself
has a non-zero origin and then we get the transform that
CGPDFPageGetDrawingTransform does. I wish there was some straight
forward example on how to achieve proper translation and scaling when
going from one rectangle with its coordinates to another rectangle
with its own coordinates. For example, the art box of the PDF looks
like this:
x 258.215 y 371.517
width 82.9009 height 104.702
and the rectangle I want to draw into looks like this:
x 4.9 y 12.375
width 88.2 height 129.25
What transforms would one use to properly scale and translate to get
the PDF art to draw into that rectangle?
I am already using this code to make sure the image does not appear
upside down:
david.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden