9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] where to get color troff?
Date: Mon, 16 May 2011 09:36:04 -0400	[thread overview]
Message-ID: <BANLkTin=SPSMDyYtzda12y4Msv4q5F9OKQ@mail.gmail.com> (raw)
In-Reply-To: <252037CF-B6B1-4241-AC17-AC7CBBA7CB86@corpus-callosum.com>

> They work great for troff, now I just need to investigate applying the same technique to grap.

You can do it in pic (and I think grap) by just emitting some text
before drawing something.  In fact you can do arbitrary postscript
code.  This snippet uses the Pr string to push the current color
on the stack and then switch to gray.  The Pb string restores the
previous color from the stack.


.de XX
\\X'\\$1'
.br
.sp -1
..
.ie \n(yr>=100 .ds Ps "ps: exec
.el .ds Ps PS
.ds Pr "\*(Ps currentrgbcolor 0.75 0.75 0.75 setrgbcolor
.ds Pb "\*(Ps setrgbcolor

.G1
frame ht 1.5 wid 4 top invis right invis
label bot "Time"
label left "Goodput"
ticks left out at 0 "0", 1000000 "1Mbps"
.XX "\*(Pr
copy "/tmp/6.829/FQCBR:net0-stput-0.dat!" thru / next at $1,$2 /
new solid
.XX "\*(Pb
copy "/tmp/6.829/FQCBR:net0-stput-1.dat!" thru / next at $1,$2 /
new solid
copy "/tmp/6.829/FQCBR:net0-stput-2.dat!" thru / next at $1,$2 /
.G2


  reply	other threads:[~2011-05-16 13:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12  6:09 Fernan Bolando
2011-04-12  6:38 ` Peter A. Cejchan
2011-04-12  7:16   ` Fernan Bolando
2011-04-12  7:33     ` Sape Mullender
2011-04-12  8:24       ` Fernan Bolando
2011-04-12 12:31         ` pmarin
2011-05-14  0:43       ` Jeff Sickel
2011-05-16 13:36         ` Russ Cox [this message]
2011-05-16 14:56           ` Jeff Sickel

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='BANLkTin=SPSMDyYtzda12y4Msv4q5F9OKQ@mail.gmail.com' \
    --to=rsc@swtch.com \
    --cc=9fans@9fans.net \
    /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).