[NTG-context] blurred shadow on images?

Wolfgang Schuster schuster.wolfgang at googlemail.com
Wed Jun 30 22:47:58 CEST 2010


Am 30.06.10 14:39, schrieb Henning Hraban Ramm:
> Am 2010-06-21 um 08:42 schrieb Taco Hoekwater:
>> Creating a semi-transparent backdrop with metapost is quite simple,
>> but I am not sure whether that works with cmyk, you'll have to try
>> yourself. Code goes something like this:
>
> For the records: This is, how I'll use it:
>
> \startuniqueMPgraphic{texthole}
> for dx = 0 upto 40:
>      dy := dx;
>      wa := 10 + dx;
>      wb := \overlaywidth - dx - 10;
>      ha := dy + 10;
>      hb := \overlayheight - dy - 10;
>      fill (wa,ha)--(wb,ha)--(wb,hb)--(wa,hb)--cycle
>         withcolor transparent("normal", .04, black);
> endfor;
> \stopuniqueMPgraphic
>
> \defineoverlay[shaded][\useMPgraphic{texthole}]
>
> \starttext
>
> \rotate[rotation=12]{%
> \framed[height=50mm, width=50mm, frame=off, background=shaded, 
> backgroundoffset=5mm, align=middle]%
> {\offset[x=1mm,y=-2mm]{\externalfigure[koe][width=50mm]}}%
> }
>
> \stoptext
>
> I'm glad I found \offset, because framed's offset parameter can't 
> distinguish x and y offset.
> Positive offset moves right and down, negative offset moves just up - 
> I guess that's a buglet.

You can change the boundingbox in the metapost graphic (the white 
background was required
for the cow figure because it has a transparent background)

\startuniqueMPgraphic{shadow}
for dx = 0 upto 40:
      dy := dx ;
      wa := dx - 10 ;
      wb := \overlaywidth - dx + 10 ;
      ha := dy - 10 ;
      hb := \overlayheight - dy + 10 ;
      fill (wa,ha)--(wb,ha)--(wb,hb)--(wa,hb)--cycle
         withcolor transparent("normal", .04, black);
endfor;
setbounds currentpicture to OverlayBox ;
\stopuniqueMPgraphic

\defineoverlay[shadow][\useMPgraphic{shadow}]

\starttext
\externalfigure[cow][width=50mm,background={shadow,color},backgroundcolor=white]
\stoptext

Wolfgang



More information about the ntg-context mailing list