# [texhax] Placing unknown images arbitrarily by lower left corner

Peter Davis pfd at pfdstudio.com
Mon Apr 4 17:42:11 CEST 2011

On Sun, Apr 3, 2011 at 5:14 PM, Peter Davis <pfd at pfdstudio.com> wrote:

> I've been going around and around on this, and still have not come up with
> a general solution.  I'm at my wit's end.  (Apparently not a very long
> distance to travel.)
>
> The XML gives a rectangular region on the page (<fo:block-container>), a
> path to an image of unknown dimensions, and possible a transform matrix to
> apply to that image.
>
> Even ignoring rotation and shear at this point, the problem is:
>
> 1) \begin{textblock}[w](x,y) sets the width and the upper left corner of
> the <fo:block-container>
>
> 2) I have to get to the lower left corner to place the image with
> \includegraphics.  I can do that with \raisebox or with Heiko's settobox
> package, using \setboxlower, or probably 3 or 4 other technique.
>
> 3) I then also have to translate the lower left corner by an amount
> specified by a transformation matrix in the XML.  This is where I'm getting
> hung up, I think.  I can't find any way to both position the lower left
> corner, and then translate the image by some amount relative to that.
>
>

Ok, I think I have a workable solution, at least for the cases I've tested
so far.  If the image specifies a transformation matrix, then I wind up
generating something like:

\begin{picture}(0,0)(0,h)  % h is the height of the image area
\put(tx,ty){\usebox{myimg}}
\end{picture}

On the other hand, if no transformation matrix is specified, I can just use:

\raisebox{-\height}{\usebox{myimg}}

There will be more complex cases where I have to scale the image to fit a
specified rectangle, or rotate or shear an image, but I think I can handle
those.  (Well, actually, *is* there a way to apply a shear transform to an
image or a block of text?)

Thanks!
-pd

--
----
The Tech Curmudgeon
http://www.techcurmudgeon.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110404/1a628312/attachment.html>