* externalfigure rotation @ 2007-09-17 13:38 Santy, Michael 2007-09-19 11:55 ` Wolfgang Schuster 0 siblings, 1 reply; 4+ messages in thread From: Santy, Michael @ 2007-09-17 13:38 UTC (permalink / raw) To: ntg-context [-- Attachment #1.1: Type: text/plain, Size: 1018 bytes --] Hello, I'm looking to rotate an externalfigure inside of its bounding box in increments of 90 deg. Its real easy with 0 and 180, you can just do: \externalfigure[blah.pdf][width=5.0in, height=2.0in] \rotate[rotation=180]{\externalfigure[blah.pdf][width=5.0in, height=2.0in]} Both commands result with an image that is 5.0in wide and 2.0in tall. But the problem comes when rotating a externalfigure at 90 and 270 degrees (or more generally, anything besides 0 and 180). The rotation is applied to the whole bounding box instead of rotating the picture within a bounding box. The following images will be rendered 2.0in wide and 5.0in tall. \rotate[rotation=90]{\externalfigure[blah.pdf][width=5.0in, height=2.0in]} \rotate[rotation=270]{\externalfigure[blah.pdf][width=5.0in, height=2.0in]} Are there any plans to add support for specify an externalfigure's rotation within its bounding box, similar to this: \externalfigure[blah.pdf][width=5.0in, height=2.0in, rotation=90] Cheers, Mike [-- Attachment #1.2: Type: text/html, Size: 1473 bytes --] [-- Attachment #2: Type: text/plain, Size: 487 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: externalfigure rotation 2007-09-17 13:38 externalfigure rotation Santy, Michael @ 2007-09-19 11:55 ` Wolfgang Schuster 2007-09-19 22:31 ` Duane Johnson 0 siblings, 1 reply; 4+ messages in thread From: Wolfgang Schuster @ 2007-09-19 11:55 UTC (permalink / raw) To: ntg-context On Mon, 17 Sep 2007 08:38:06 -0500 "Santy, Michael" <Michael.Santy@dynetics.com> wrote: > > Hello, > > I'm looking to rotate an externalfigure inside of its bounding box in increments of 90 deg. Its real easy with 0 and 180, you can just do: > > \externalfigure[blah.pdf][width=5.0in, height=2.0in] > \rotate[rotation=180]{\externalfigure[blah.pdf][width=5.0in, height=2.0in]} > > Both commands result with an image that is 5.0in wide and 2.0in tall. > > But the problem comes when rotating a externalfigure at 90 and 270 degrees (or more generally, anything besides 0 and 180). The rotation is applied to the whole bounding box instead of rotating the picture within a bounding box. The following images will be rendered 2.0in wide and 5.0in tall. > > \rotate[rotation=90]{\externalfigure[blah.pdf][width=5.0in, height=2.0in]} > \rotate[rotation=270]{\externalfigure[blah.pdf][width=5.0in, height=2.0in]} > > Are there any plans to add support for specify an externalfigure's rotation within its bounding box, similar to this: > \externalfigure[blah.pdf][width=5.0in, height=2.0in, rotation=90] > > Cheers, > Mike Hi Mike, you can control the rotation placement with the location key and the value middle for location seems to be what you want but the the result looks to me weird or broken and tried to fix this with the new value center, you can see the results in small example below. \unprotect \def\dodorotatenextbox#1#2% quite some trial and error -) {\dontshowcomposition \dontcomplain \ifnum#2=\plusfour % new, location=middle \!!widthb \nextboxwd \!!heightb\nextboxht \!!depthb \nextboxdp \setbox\nextbox\vbox{\vskip.5\nextboxht\hskip-.5\nextboxwd \flushnextbox}% \smashbox\nextbox \else\ifnum#2=\plusfive % wolf: location=center \!!widthb \nextboxwd \!!heightb\nextboxht \!!depthb \nextboxdp \setbox\nextbox\vbox{\vskip.5\nextboxht\hskip-.5\nextboxwd \flushnextbox}% \smashbox\nextbox \fi\fi \!!widtha \nextboxwd \!!heighta\nextboxht \!!deptha \nextboxdp \!!doneafalse \!!donebfalse \ifcase#2\or % 1: fit \or % 2: depth, not fit \!!doneatrue \!!donebtrue \or % 3: depth, fit \!!donebtrue \fi \setbox\nextbox\vbox{\hbox{\raise\nextboxdp\flushnextbox}}% \!!dimena \nextboxht \calculatecos\@@rorotation\edef\cos{\calculatedcos\@@rorotation}% \calculatesin\@@rorotation\edef\sin{\calculatedsin\@@rorotation}% \@@layerxpos\zeropoint \@@layerypos\zeropoint \@@layerxoff\zeropoint \@@layeryoff\zeropoint \ifdim\sin\points>\zeropoint \ifdim\cos\points>\zeropoint \@@layerxsiz \cos\!!widtha \@@layerysiz \sin\!!widtha \advance\@@layerxsiz \sin\!!dimena \advance\@@layerysiz \cos\!!dimena \@@layerypos \cos\!!dimena \if!!donea \@@layerxoff \negated\sin\!!dimena \advance\@@layerxoff \sin\!!deptha \fi \if!!doneb \@@layeryoff \cos\!!deptha \fi \dododorotatenextbox \else \@@layerxsiz \negated\cos\!!widtha \@@layerysiz \sin\!!widtha \advance\@@layerxsiz \sin\!!dimena \advance\@@layerysiz \negated\cos\!!dimena \@@layerxpos \negated\cos\!!widtha \if!!donea \@@layerxoff -\@@layerxsiz \advance\@@layerxoff \sin\!!deptha \fi \if!!doneb \@@layeryoff \negated\cos\!!heighta \fi \dododorotatenextbox \wd\nextbox\if!!donea\sin\!!deptha\else\@@layerxsiz\fi \fi \else \ifdim\cos\points<\zeropoint \@@layerxsiz \negated\cos\!!widtha \@@layerysiz \negated\sin\!!widtha \advance\@@layerxsiz \negated\sin\!!dimena \advance\@@layerysiz \negated\cos\!!dimena \@@layerxpos \@@layerxsiz \@@layerypos \negated\sin\!!widtha \if!!donea \@@layerxoff -\@@layerxsiz \advance\@@layerxoff \negated\sin\!!heighta \fi \if!!doneb \@@layeryoff \@@layerysiz \advance\@@layeryoff \cos\!!deptha \fi \dododorotatenextbox \wd\nextbox\if!!donea\negated\sin\!!heighta\else\@@layerxsiz\fi \else \@@layerxsiz \cos\!!widtha \@@layerysiz \negated\sin\!!widtha \advance\@@layerxsiz \negated\sin\!!dimena \advance\@@layerysiz \cos\!!dimena \ifdim\sin\points=\zeropoint \@@layerxpos \zeropoint \@@layerxoff \zeropoint \@@layerypos \@@layerysiz \if!!doneb \@@layeryoff \!!deptha \fi \else \@@layerypos \@@layerysiz \@@layerxpos \negated\sin\!!dimena \if!!donea \@@layerxoff -\@@layerxsiz \advance\@@layerxoff \negated\sin\!!heighta \fi \if!!doneb \@@layeryoff \negated\sin\!!deptha \fi \fi \dododorotatenextbox \ifdim\sin\points=\zeropoint \else \wd\nextbox\if!!donea\negated\sin\!!heighta\else\@@layerxsiz\fi \fi \fi \fi % new, location=middle \ifnum#2=\plusfour \setbox\nextbox\vbox{\vskip-.5\!!heightb\hskip.5\!!heightb \flushnextbox}% \nextboxwd\!!widthb \nextboxht\!!heightb \nextboxdp\!!depthb \else\ifnum#2=\plusfive % wolf: location=center \setbox\nextbox\vbox{\vskip.5\!!heightb\ifnum#1=270\relax\hskip2\!! heightb\fi\flushnextbox}% \nextboxwd\!!widthb \nextboxht\!!heightb \nextboxdp\!!depthb \fi\fi} \def\complexrotate[#1]% framed met diepte ! {\getparameters[\??ro][#1]% \processaction [\@@rolocation] [ \v!depth=>\!!counta\plusthree\donefalse,% depth fit - raw box \v!fit=>\!!counta\plustwo \donefalse,% depth tight - raw box \v!broad=>\!!counta\plusone \donefalse,% nodepth fit - raw box \v!high=>\!!counta\plusone \donetrue ,% nodepth fit - framed \v!middle=>\!!counta\plusfour \donefalse,% centered, keep dimensions \v!center=>\!!counta\plusfive \donefalse,% \s!default=>\!!counta\plusthree\donetrue ,% depth fit - framed \s!unknown=>\!!counta\plusthree\donetrue ]% depth fit - framed \ifdone \def\docommand{\localframed[\??ro][#1,\c!location=]}% \else \let\docommand\relax \fi \dowithnextbox{\dorotatenextbox\@@rorotation\!!counta\egroup}\vbox \docommand} \protect \setuppapersize[A4,landscape][A4,landscape] \starttext \input knuth \rotate[rotation=0]{\framed[width=4cm,height=2cm,align={middle,lohi}] {Text}} text \rotate[rotation=90,location=center]{\framed [width=4cm,height=2cm,align={middle,lohi}]{Text}} text \rotate [rotation=180]{\framed[width=4cm,height=2cm,align={middle,lohi}]{Text}} text \rotate[rotation=270,location=center]{\framed [width=4cm,height=2cm,align={middle,lohi}]{Text}} text %\rotate [rotation=270]{\framed[width=4cm,height=2cm,align={middle,lohi}]{Text}} \input knuth \stoptext Wolfgang ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: externalfigure rotation 2007-09-19 11:55 ` Wolfgang Schuster @ 2007-09-19 22:31 ` Duane Johnson 0 siblings, 0 replies; 4+ messages in thread From: Duane Johnson @ 2007-09-19 22:31 UTC (permalink / raw) To: mailing list for ConTeXt users Thanks for sharing this, Wolfgang. Very nice effects! Duane Johnson (canadaduane) On Sep 19, 2007, at 5:55 AM, Wolfgang Schuster wrote: > Hi Mike, > > you can control the rotation placement with the location key and the > value middle for location seems to be what you want but the the result > looks to me weird or broken and tried to fix this with the new value > center, you can see the results in small example below. > > \unprotect > > \def\dodorotatenextbox#1#2% quite some trial and error -) > {\dontshowcomposition > \dontcomplain > \ifnum#2=\plusfour > % new, location=middle > \!!widthb \nextboxwd > \!!heightb\nextboxht > \!!depthb \nextboxdp > \setbox\nextbox\vbox{\vskip.5\nextboxht\hskip-.5\nextboxwd > \flushnextbox}% \smashbox\nextbox > \else\ifnum#2=\plusfive > % wolf: location=center > \!!widthb \nextboxwd > \!!heightb\nextboxht > \!!depthb \nextboxdp > \setbox\nextbox\vbox{\vskip.5\nextboxht\hskip-.5\nextboxwd > \flushnextbox}% \smashbox\nextbox > \fi\fi > \!!widtha \nextboxwd > \!!heighta\nextboxht > \!!deptha \nextboxdp > \!!doneafalse > \!!donebfalse > \ifcase#2\or > % 1: fit > \or > % 2: depth, not fit > \!!doneatrue > \!!donebtrue > \or > % 3: depth, fit > \!!donebtrue > \fi > \setbox\nextbox\vbox{\hbox{\raise\nextboxdp\flushnextbox}}% > \!!dimena \nextboxht > \calculatecos\@@rorotation\edef\cos{\calculatedcos\@@rorotation}% > \calculatesin\@@rorotation\edef\sin{\calculatedsin\@@rorotation}% > \@@layerxpos\zeropoint > \@@layerypos\zeropoint > \@@layerxoff\zeropoint > \@@layeryoff\zeropoint > \ifdim\sin\points>\zeropoint > \ifdim\cos\points>\zeropoint > \@@layerxsiz \cos\!!widtha > \@@layerysiz \sin\!!widtha > \advance\@@layerxsiz \sin\!!dimena > \advance\@@layerysiz \cos\!!dimena > \@@layerypos \cos\!!dimena > \if!!donea > \@@layerxoff \negated\sin\!!dimena > \advance\@@layerxoff \sin\!!deptha > \fi > \if!!doneb > \@@layeryoff \cos\!!deptha > \fi > \dododorotatenextbox > \else > \@@layerxsiz \negated\cos\!!widtha > \@@layerysiz \sin\!!widtha > \advance\@@layerxsiz \sin\!!dimena > \advance\@@layerysiz \negated\cos\!!dimena > \@@layerxpos \negated\cos\!!widtha > \if!!donea > \@@layerxoff -\@@layerxsiz > \advance\@@layerxoff \sin\!!deptha > \fi > \if!!doneb > \@@layeryoff \negated\cos\!!heighta > \fi > \dododorotatenextbox > \wd\nextbox\if!!donea\sin\!!deptha\else\@@layerxsiz\fi > \fi > \else > \ifdim\cos\points<\zeropoint > \@@layerxsiz \negated\cos\!!widtha > \@@layerysiz \negated\sin\!!widtha > \advance\@@layerxsiz \negated\sin\!!dimena > \advance\@@layerysiz \negated\cos\!!dimena > \@@layerxpos \@@layerxsiz > \@@layerypos \negated\sin\!!widtha > \if!!donea > \@@layerxoff -\@@layerxsiz > \advance\@@layerxoff \negated\sin\!!heighta > \fi > \if!!doneb > \@@layeryoff \@@layerysiz > \advance\@@layeryoff \cos\!!deptha > \fi > \dododorotatenextbox > \wd\nextbox\if!!donea\negated\sin\!!heighta\else\@@layerxsiz\fi > \else > \@@layerxsiz \cos\!!widtha > \@@layerysiz \negated\sin\!!widtha > \advance\@@layerxsiz \negated\sin\!!dimena > \advance\@@layerysiz \cos\!!dimena > \ifdim\sin\points=\zeropoint > \@@layerxpos \zeropoint > \@@layerxoff \zeropoint > \@@layerypos \@@layerysiz > \if!!doneb > \@@layeryoff \!!deptha > \fi > \else > \@@layerypos \@@layerysiz > \@@layerxpos \negated\sin\!!dimena > \if!!donea > \@@layerxoff -\@@layerxsiz > \advance\@@layerxoff \negated\sin\!!heighta > \fi > \if!!doneb > \@@layeryoff \negated\sin\!!deptha > \fi > \fi > \dododorotatenextbox > \ifdim\sin\points=\zeropoint > \else > \wd\nextbox\if!!donea\negated\sin\!!heighta\else > \@@layerxsiz\fi > \fi > \fi > \fi > % new, location=middle > \ifnum#2=\plusfour > \setbox\nextbox\vbox{\vskip-.5\!!heightb\hskip.5\!!heightb > \flushnextbox}% \nextboxwd\!!widthb > \nextboxht\!!heightb > \nextboxdp\!!depthb > \else\ifnum#2=\plusfive > % wolf: location=center > \setbox\nextbox\vbox{\vskip.5\!!heightb\ifnum#1=270\relax > \hskip2\!! > heightb\fi\flushnextbox}% \nextboxwd\!!widthb > \nextboxht\!!heightb > \nextboxdp\!!depthb > \fi\fi} > > \def\complexrotate[#1]% framed met diepte ! > {\getparameters[\??ro][#1]% > \processaction > [\@@rolocation] > [ \v!depth=>\!!counta\plusthree\donefalse,% depth fit - raw > box \v!fit=>\!!counta\plustwo \donefalse,% depth tight - raw box > \v!broad=>\!!counta\plusone \donefalse,% nodepth fit - raw > box \v!high=>\!!counta\plusone \donetrue ,% nodepth fit - framed > \v!middle=>\!!counta\plusfour \donefalse,% centered, keep > dimensions \v!center=>\!!counta\plusfive \donefalse,% > \s!default=>\!!counta\plusthree\donetrue ,% depth fit - > framed > \s!unknown=>\!!counta\plusthree\donetrue ]% depth fit - > framed > \ifdone > \def\docommand{\localframed[\??ro][#1,\c!location=]}% > \else > \let\docommand\relax > \fi > \dowithnextbox{\dorotatenextbox\@@rorotation\!!counta\egroup}\vbox > \docommand} > > \protect > > \setuppapersize[A4,landscape][A4,landscape] > > \starttext > > \input knuth > \rotate[rotation=0]{\framed[width=4cm,height=2cm,align={middle,lohi}] > {Text}} text \rotate[rotation=90,location=center]{\framed > [width=4cm,height=2cm,align={middle,lohi}]{Text}} text \rotate > [rotation=180]{\framed[width=4cm,height=2cm,align={middle,lohi}] > {Text}} > text \rotate[rotation=270,location=center]{\framed > [width=4cm,height=2cm,align={middle,lohi}]{Text}} text %\rotate > [rotation=270]{\framed[width=4cm,height=2cm,align={middle,lohi}] > {Text}} > \input knuth > > \stoptext > > Wolfgang > ______________________________________________________________________ > _____________ > If your question is of interest to others as well, please add an > entry to the Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ > ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : https://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ______________________________________________________________________ > _____________ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <mailman.1923.1190214383.2346.ntg-context@ntg.nl>]
* Re: externalfigure rotation [not found] <mailman.1923.1190214383.2346.ntg-context@ntg.nl> @ 2007-09-19 18:18 ` Santy, Michael 0 siblings, 0 replies; 4+ messages in thread From: Santy, Michael @ 2007-09-19 18:18 UTC (permalink / raw) To: ntg-context [-- Attachment #1.1: Type: text/plain, Size: 1199 bytes --] > Hi Mike, > > you can control the rotation placement with the location key and the > value middle for location seems to be what you want but the the result > looks to me weird or broken and tried to fix this with the new value > center, you can see the results in small example below. I really appreciate the response, but I'm afraid I don't understand how it addresses my question. I'm not having trouble with the rotation pivot point (i.e., placement), but instead the order in which rotation and scaling are applied to a figure. I am wanting to rotate a figure within a defined bounding box. Mojca was kind enough to point out the following technique. \scale[width=5in, height=2in]{\rotate[rotation=90]{\externalfigure[yourfig]}} It creates a bounding box 5 inches wide and 2 inches tall, rotates the figure 90 degrees and scales the image to fit in the 5x2" bounding box. This approach meets my needs except that the scaling is applied non-isomorphically if both dimensions are specified for the bounding box. I'm now trying to figure out how to optionally scale the image to fit the bounding box while keeping the same aspect ratio. Any thoughts? Cheers, Mike [-- Attachment #1.2: Type: text/html, Size: 1697 bytes --] [-- Attachment #2: Type: text/plain, Size: 487 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-09-19 22:31 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-09-17 13:38 externalfigure rotation Santy, Michael 2007-09-19 11:55 ` Wolfgang Schuster 2007-09-19 22:31 ` Duane Johnson [not found] <mailman.1923.1190214383.2346.ntg-context@ntg.nl> 2007-09-19 18:18 ` Santy, Michael
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).