[texhax] Problem about make a figure masked

Paulga abgoku at gmail.com
Thu Feb 24 23:44:29 CET 2011


Hi


Thanks! I didn't know the package overpic available.
The mask I want to place on the stress contour plot has an irregular shape
as a sin curve. I need to generate such a masking figure in photoshop first
then place it over the contour plot. so that the areas out of the two walls
are white. It is difficult to make this clear without actual pictures: The
two walls are sin curve instead of a line.
Thanks again.



Best wishes,
Jene




On Thu, Feb 24, 2011 at 9:16 AM, Steve Schwartz
<s.schwartz at imperial.ac.uk>wrote:

> Jene,
>
> On Wed, 2011-02-23 at 23:25 +0000, Paulga wrote:
>
> > I have a sinusoidal wave figure showing the contour of polymer stress.
> > When I place it into my pdf file I  would like to put a masking layer
> > on it so that only the part of contour between the top and bottom
> > walls of the wave is visible, the area outside blank. But I cannot
> > find any method how to achieve this. Any help would be appreciated.
> > Thanks in advance.
>
> I often do something similar to replace tiny graph labels with bigger
> ones by masking out the originals and placing my own.
>
> One solution is to use overpic and to draw the necessary blanking frame
> with picture commands, e.g.:
>
> \documentclass{article}
> \usepackage{graphicx}
> \usepackage{overpic}
> \usepackage{pict2e}
> \usepackage{color}
>
> \begin{document}
>
> Hello\par
> \framebox{
> \begin{overpic}[width=\textwidth,grid]{<image-file>}
>        \put(10,5){\linethickness{5\unitlength}\color{white}\line(1,0){40}}
> \end{overpic}
> }\par
> Goodbye
> \end{document}
>
> Some comments/explanations:
>
> I put the graphics in a framebox just so you can see the boundary
>
> overpic takes all the same arguments as \includegrahpics, plus a few.
>
> The grid option shows you a grid so you can easily place things, and
> overpic scales a dimension to \unitlength, which makes it easy to place
> things, decide thicknesses, etc., in a reasonably robust way.
>
> I've drawn one line, colored white, to get you started. I guess your
> mask would have 4 lines and obviously you need to adjust the position,
> thickness, and orientation of each one to create the desired mask.
>
> pict2e enables you to draw lines of arbitrary thickness
>
> An alternative approach, if it is always the outer boundary of the image
> you want to clip, is simply to use the graphicx capability to clip your
> image or redefine the bounding box. If you wanted blank space around it,
> you could put it inside a picture environment that was sized bigger than
> your image.
>
> HTH
> Steve
>
> --
> +-------------------------------------------------------------------+
> Professor Steven J Schwartz        Phone: +44-(0)20-7594-7660
> Head, Space & Atmospheric Physics  Fax:   +44-(0)20-7594-7772
> The Blackett Laboratory            E-mail: s.schwartz at imperial.ac.uk
> Imperial College London            Office: Huxley 6M67A
> London SW7 2AZ, U.K.               Web: www.sp.ph.ic.ac.uk/~sjs<http://www.sp.ph.ic.ac.uk/%7Esjs>
> +-------------------------------------------------------------------+
>
>


-- 
Best wishes,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110224/9717f064/attachment-0001.html>


More information about the texhax mailing list