ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Giuseppe Bilotta <gip.bilotta@iol.it>
Subject: Re[2]: Backgrounds
Date: Wed, 9 Apr 2003 18:57:18 +0200	[thread overview]
Message-ID: <122893905.20030409185718@iol.it> (raw)
In-Reply-To: <871y0biuyd.fsf@gundla.ch>

Wednesday, April 9, 2003 Patrick Gundlach wrote:

PG> Giuseppe Bilotta <gip.bilotta@iol.it> writes:

PG> Hello Giuseppe,

>> \startuseMPgraphic{mpos:par:columnset}
>>    path p, q;
>>    for i := 1 upto nofmultipars :
>>      p := counterclockwise simplified multipars[i] leftenlarged 5pt
>>    rightenlarged 5pt ;

PG> why did you use "counterclockwise simplified..." ? What is this?

I used that to make sure that p didn't have extra points
(simplified) and went in a specific direction (counterclockwise);
anyway, I rewrote my code:

===

\starttext

\setupcolors[state=start]

\definetextbackground[gb][state=start]

\startuseMPgraphic{mpos:par:columnset}
   pair urc, ulc, llc, lrc ; % corners
   path urcp, ulcp, llcp, lrcp ; % paths
   path q ;
   cornerradius := 5pt ;
   offset := 7.5pt ;
   color framecolor, backgroundcolor ;
   pen framepen ;
   framecolor := red ;
   framepen := pensquare rotated 45 ;
   framethickness := 2pt ;
   backgroundcolor := lightgray ;
   for i := 1 upto nofmultipars :
     urc := urcorner multipars[i] + (offset, offset) ;
     ulc := ulcorner multipars[i] + (-offset, offset) ;
     llc := llcorner multipars[i] + (-offset, -offset) ;
     lrc := lrcorner multipars[i] + (offset, -offset) ;
     ulcp := quartercircle
             rotated 90
             scaled (2*cornerradius)
             shifted (ulc + (cornerradius, -cornerradius)) ;
     urcp := quartercircle
             scaled (2*cornerradius)
             shifted (urc + (-cornerradius, -cornerradius)) ;
     llcp := quartercircle
             rotated 180
             scaled (2*cornerradius)
             shifted (llc + (cornerradius, cornerradius)) ;
     lrcp := quartercircle
             rotated -90
             scaled (2*cornerradius)
             shifted (lrc + (-cornerradius, cornerradius)) ;
     if multilocs[i] = 1 : % top
       q := lrc -- urcp -- ulcp -- llc ;
       fill q--cycle
            withcolor backgroundcolor ;
       draw q
            withcolor framecolor
            withpen framepen scaled framethickness ;
     elseif multilocs[i] = 2 :
       fill llc -- lrc -- urc -- ulc -- cycle
            withcolor backgroundcolor ;
       draw ulc -- llc
            withcolor framecolor
            withpen framepen scaled framethickness ;
       draw lrc -- urc
            withcolor framecolor
            withpen framepen scaled framethickness ;
     else:
       q := ulc -- llcp -- lrcp -- urc ;
       fill q--cycle
            withcolor backgroundcolor ;
       draw q
            withcolor framecolor
            withpen framepen scaled framethickness ;
     fi
   endfor ;
\stopuseMPgraphic

\starttextbackground[gb]
\input tufte
\stoptextbackground

\blank[2*big]

\starttextbackground[gb]
\dorecurse{5}{\input tufte \par}
\stoptextbackground
\blank \input tufte

\stoptext

===

Now the only thing we need is a way to know when the background is
split and when it's not. Hans?

-- 
Giuseppe "Oblomov" Bilotta

  reply	other threads:[~2003-04-09 16:57 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-25  8:46 Hans Hagen
2003-03-25 10:43 ` Re[3]: Backgrounds Giuseppe Bilotta
2003-03-25 12:25   ` Hans Hagen
2003-03-25 14:36     ` Re[4]: Backgrounds Giuseppe Bilotta
2003-03-25 15:18       ` Hans Hagen
2003-03-25 17:00         ` Re[5]: Backgrounds Giuseppe Bilotta
2003-04-09 14:52       ` Backgrounds Patrick Gundlach
2003-04-09 16:57         ` Giuseppe Bilotta [this message]
2003-04-10  9:50           ` Backgrounds Patrick Gundlach
2003-04-10 11:43             ` Re[2]: Backgrounds Giuseppe Bilotta
2003-04-18 14:33             ` Backgrounds Johannes Hüsing
2003-04-18 14:36               ` Re[2]: Backgrounds Giuseppe Bilotta
2003-04-19 13:35               ` Backgrounds Patrick Gundlach
2003-04-10 20:00           ` Re[2]: Backgrounds Hans Hagen
2003-04-11 13:35             ` Re[3]: Backgrounds Giuseppe Bilotta
2003-04-11 16:02               ` Hans Hagen
2003-04-11 16:21                 ` Backgrounds Patrick Gundlach
2003-04-11 17:15                 ` Re[4]: Backgrounds Giuseppe Bilotta
2003-04-11 17:40                 ` Re[3]: Backgrounds John Culleton
2003-04-13 23:06                 ` supp-emp.tex \EMlinewd Hartmut Henkel
2003-04-14  6:48                   ` Hans Hagen
2003-04-18 14:41                 ` Re[4]: Backgrounds Giuseppe Bilotta
2003-04-19 10:42                   ` Hans Hagen
2003-04-19 12:10                     ` Re[5]: Backgrounds Giuseppe Bilotta
2003-04-21 11:13                       ` Hans Hagen
2003-04-21 18:33                         ` Re[6]: Backgrounds Giuseppe Bilotta
2003-03-25 18:00   ` Error: /undefined in NP scarso luigi
2003-03-26 12:55     ` scarso luigi
2003-03-26 14:04       ` Jens-Uwe Morawski
2003-03-28  7:41         ` scarso luigi
  -- strict thread matches above, loose matches on Subject: below --
2003-03-24 16:45 Backgrounds Hans Hagen
2003-03-24 18:52 ` Re[2]: Backgrounds Giuseppe Bilotta

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=122893905.20030409185718@iol.it \
    --to=gip.bilotta@iol.it \
    --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).