[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] Drawing filled circle segments
From: |
Ted Harding |
Subject: |
Re: [Groff] Drawing filled circle segments |
Date: |
Fri, 28 Oct 2005 14:49:09 +0100 (BST) |
On 28-Oct-05 Werner LEMBERG wrote:
>
>> I need to use drawing requests (\D'...') directly (without
>> using PIC) to make pie-chart segments that can be filled with
>> color.
>
> This isn't possible directly in groff (nor it is possible directly
> with pic). It is not too difficult to write a macro which constructs
> the segment itself with \D'l...' and \D'a...', but there's no way to
> fill it. The only solution is to approximate the segment with a
> filled polygon.
>
> Let's see what Ted will cook :-)
>
>
> Werner
Well, here's a skeleton with an example of use. Basically, as it is,
you invoke in-line it with
\*[wedge radius(pts) Red Green Blue Angle1 Angle2]
and carry on from there ... I was toying with the idea of building
a full macro out of this, but then I thought that different people
will want to arrange things in different ways, so provided you
have the basic "wedge" building-block you can build your own.
And of course you can tweak its functionality.
Here's the sample troff code (".LP" from ms macros; vary to taste):
\X'ps: def \
/wedge { gsave \
currentpoint translate 1 -1 scale \
/ang2 exch def \
/ang1 exch def \
/B exch def /G exch def /R exch def \
/rad exch def \
R G B setrgbcolor \
newpath \
0 0 moveto \
0 0 rad ang1 ang2 arc \
closepath \
fill stroke \
grestore \
} def
.ds wedge \Z'\X'ps: exec \\$1 \\$2 \\$3 \\$4 \\$5 \\$6 wedge''
.LP
\&
.sp 1i
This is a line with_\h'0.5i'\
\*[wedge 36 1.0 0.0 0.0 000 045]\
\*[wedge 36 0.5 0.5 0.0 045 100]\
\*[wedge 36 0.0 1.0 0.0 100 170]\
\*[wedge 36 0.0 0.5 0.5 170 250]\
\*[wedge 36 0.0 0.0 1.0 250 360]\
\h'0.5i'_in the middle of it.
.sp 1i
That was a line with a bar-chart.
Best wishes to all,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 28-Oct-05 Time: 14:49:05
------------------------------ XFMail ------------------------------
- [Groff] Drawing filled circle segments, Clarke Echols, 2005/10/25
- Re: [Groff] Drawing filled circle segments,
Ted Harding <=
- Re: [Groff] Drawing filled circle segments, Ted Harding, 2005/10/28
- Re: [Groff] Drawing filled circle segments, Ted Harding, 2005/10/28
- Re: [Groff] Drawing filled circle segments, Ted Harding, 2005/10/28
- Re: [Groff] Drawing filled circle segments, Tadziu Hoffmann, 2005/10/28
- Re: [Groff] Drawing filled circle segments, Tadziu Hoffmann, 2005/10/28
- Re: [Groff] Drawing filled circle segments, Ted Harding, 2005/10/28
- Re: [Groff] Drawing filled circle segments, Werner LEMBERG, 2005/10/28
- Re: [Groff] Drawing filled circle segments, Ted Harding, 2005/10/28