ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Vit Zyka <vit.zyka@seznam.cz>
Subject: shading box many times
Date: Mon, 28 Nov 2005 10:02:18 +0100	[thread overview]
Message-ID: <438AC79A.7070806@seznam.cz> (raw)

Dear Metafun Wizards,

I have noticed some strange behaviour with box shading. It works OK 
until some number of shadings. Please see example:
   http://typokvitek.com/tmp/shade-many.pdf
Any idea for solving? Next not-minimal but small and illustrative 
example can help.

Thanks in advance
Vit

--------------------------------------------------------------------
\def\Log#1{%
def log(expr Xstart, Xstop)=
   begingroup
     save x, y, D, w, P;
     pair D;
     path P;
     w := #1; w := w/2;
     D := unitvector(Xstop-Xstart) rotated 90;
     z1 = Xstart shifted (w*D);
     z2 = Xstop shifted (w*D);
     z3 = Xstop shifted (-w*D);
     z4 = Xstart shifted (-w*D);
     P := z1--z2{z2-z1}..{z4-z3}z3--z4{z4-z3}..{z2-z1}cycle;
     P
   endgroup
enddef;
}
\def\ObdobiFrame#1#2{%
def Rand(expr b) =
   (.5pt*(floor(uniformdeviate (2*b+1))-b))
enddef;

path P;
xBor := \overlaylinewidth;
yBor := #1;  yCor := 0pt;
x11 = x14 = 0;
x12 = x13 = \overlaywidth;
y11 = y31 = \overlayheight-yBor+yCor + Rand(2*#2);
y12 = y32 = \overlayheight-yBor+yCor + Rand(2*#2);
y13 = y33 = yBor + Rand(1*#2);
y14 = y34 = yBor + Rand(1*#2);
x21 = x31 = xBor + Rand(6*#2);
x24 = x34 = xBor + Rand(6*#2);
x22 = x32 = \overlaywidth-xBor + Rand(6*#2);
x23 = x33 = \overlaywidth-xBor + Rand(6*#2);
y21 = y22 = \overlayheight+yCor;
y23 = y24 = 0;
fill (z31--z32--z33--z34--cycle) withcolor \MPcolor{\overlaycolor};
P:= log(z11,z12); linear_shade(P,8,(1,1,1),(0,0,0)); draw P;
P:= log(z13,z14); linear_shade(P,8,(1,1,1),(0,0,0)); draw P;
P:= log(z21,z24); linear_shade(P,5,(1,1,1),(0,0,0)); draw P;
P:= log(z22,z23); linear_shade(P,5,(1,1,1),(0,0,0)); draw P;
}

\startuseMPgraphic{F}
   \Log{2.5pt}%
   \ObdobiFrame{3pt}{1}%
\stopuseMPgraphic

\defineoverlay[F][\uniqueMPgraphic{F}]
\defineframed[F]
   [offset=2mm,rulethickness=.5mm,align={middle,lohi},strut=yes,
    backgroundcolor=gray,background=F,frame=off,
   ]

\starttext
   \noindent\dorecurse{256}{\F{\recurselevel} }
\stoptext
----------------------------------------------------------------

             reply	other threads:[~2005-11-28  9:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-28  9:02 Vit Zyka [this message]
2005-11-28 11:16 ` Hans Hagen
2005-11-28 12:36   ` Taco Hoekwater
2005-11-28 13:38     ` Vit Zyka
2005-11-28 16:37       ` Peter Rolf
2005-11-28 13:56     ` Hans Hagen
2005-11-28 14:45       ` Taco Hoekwater
2005-11-28 15:43         ` Hans Hagen
2005-11-29  0:35       ` Vit Zyka
2005-11-29  8:59         ` Hans Hagen
2005-11-29 13:14           ` Vit Zyka
2005-11-29 14:42             ` Hans Hagen
2005-11-28 13:02   ` Vit Zyka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=438AC79A.7070806@seznam.cz \
    --to=vit.zyka@seznam.cz \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).