groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] filled polygons in pic


From: Ted Harding
Subject: Re: [Groff] filled polygons in pic
Date: Mon, 12 Apr 2010 09:54:32 +0100 (BST)

On 12-Apr-10 07:06:17, Patrik Schindler wrote:
> 
> Am 12.04.2010 um 04:31 schrieb Doug McIlroy:
> 
>> It it seems like a good idea, I might volunteer to try to do it right.
> 
> 
>  From my point of view, it absolutely makes sense. I also missed polys 
> from time to time.

The fundamental issue is the small repertoire of fillable,
colourable or shadeable objects in pic -- basically box,
circle, ellipse.

A closely related question came up in 2005, which led to a quite
deep discussion. The thread starts with a post from Ole Schoenig
on 13 September 2005, and can be found at

  http://lists.gnu.org/archive/html/groff/2005-09/msg00018.html

One idea which came to me in the course of that was that it
would be useful to be able to assign a "closed" attribute to
an object drawn by pic, which could then embed its PostScript
execution in a "newpath ... closepath" with an optional "fill",
"coloured" or "shaded" attribute which would then additionaly
cause PostScript to apply an appropriate "fill". I gave a
hypothetical example:

  [ arc down rad 1; arc rad 1;
    line up 0.5 left 0.75; 
    line left 0.5; 
    line left 0.75 down 0.5 ] closed shaded "green"

  (being the part of a house+garden plan showing the grass lawn).

  The idea here is that anything within [ ... ] consisting of
  a series of connected segments, arcs of circles or ellipses,
  splines, etc. can be made into a closed object with the 'closed'
  attribute and subsequently shaded (with "shaded" or filled (with
  "fill").

However, inmplementing this sort of thing would involve modifying
pic extensively at a deep level.

Another approach (which I have recently been playing with for
arbitrary rotations in pic) is to implement PostScript commands
as troff strings (e.g. ".ds PSop1 \X'ps: exec ... '") and
then you can plant them as "troff text" within pic code.
For examples of what can be done on the rotation front have
a look at the thread "[Groff] A little Greetings card," which
starts on 29 December 2010 near the bottom of

  http://lists.gnu.org/archive/html/groff/2009-12/threads.html

There are follow-ups, implementing the "\X'ps: exec ... '"
mechanism more explicitly, at

  http://lists.gnu.org/archive/html/groff/2010-01/msg00007.html
  [Groff] Rotating element of a PIC fogure

  http://lists.gnu.org/archive/html/groff/2010-01/msg00008.html
  [Groff] More on rotation in PIC

I will try to see what can be done along similar lines for
implementing arbitrary closed and filled/coloured/shaded objects
in pic.

Another approach one could consider for shaded polygons is to
exploit pic's capabilities as a numerical computing engine.
This would basically use pic to compute the troff "\D'P ... '"
command for drawing a closed polygon, and combining this
with the appropriate commands to set fill level or colour.
I will look into this too.

I have, indeed, a somewhat intermittent project in hand to
implement a fairly general repertoire of such things for pic.
The general idea is to get pic to construct something which
is then dropped into a constructed PostScript context to be
further processed by PostScript when grops gets at it. The
"\*[rotate] ... \*[restore]" method implemented in the last
two URLs above is a simple instance of the kind of thing I
have in mind.

Hoping this is helpful!
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 12-Apr-10                                       Time: 09:54:24
------------------------------ XFMail ------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]