groff
[Top][All Lists]
Advanced

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

Re: [Groff] pic: "shaded" problem


From: Ted Harding
Subject: Re: [Groff] pic: "shaded" problem
Date: Sat, 17 Sep 2005 12:41:09 +0100 (BST)

On 17-Sep-05 Gaius Mulley wrote:
> Keith MARSHALL <address@hidden> writes:
>> [...]
>> Looks like you've discovered a bug in pic's shading code; it doesn't
>> seem to work for round cornered boxes, at least on the Win32 platform.
>> I've managed to achieve the effect I think you want, with the
>> following
>> quick and very dirty, and hideously ugly workaround:--
>> 
>> .PS
>> .fam H
>> boxrad = 0.15
>> [ box rad 0 width 1.5-2*0.15 shaded "green" invisible
>>   circle at last box.nw-(0.0,0.15) rad 0.15 shaded "green" invisible
>>   circle at last box.sw+(0.0,0.15) rad 0.15 shaded "green" invisible
>>   circle at last box.ne-(0.0,0.15) rad 0.15 shaded "green" invisible
>>   circle at last box.se+(0.0,0.15) rad 0.15 shaded "green" invisible
>> ]
>> box at last [].c width 1.5 height last [].height - 2.0*0.15 rad 0 \
>>   shaded "green" invisible
>> box at last [].c width 1.5 "some text"
>> .PE
>> 
>> Perhaps you could develop this into a macro, to work around the bug.
>> 
>> HTH.
>> 
>> Keith.
> 
> Hi Keith,
> 
> well done with the work around. I think this is the way to fix gpic,
> internally gpic will have to map a cornered box onto your multiple
> objects sequence as there isn't a "cornered box" glyph in gtroff.
> 
> regards,
> Gaius

As I pointed out earlier, this is in fact how gpic itself deals
with round-cornered boxes with the 'fill' attribute. So the
mechanism is already there. However, unfilled round-cornered
boxes are drawn as a succession of straight lines and arcs (and
for good reason -- you don't want to see the "internal" parts of
the circles, and the constituent rectangles, in an unfilled box).

The bug in gpic, now that it has "shaded", is that it also uses the
latter method  when drawing a round-cornered box with the 'shaded'
attribute, and such an entity is not, as it stands, a closed path,
so there is nothing to "fill" with the "currentcolor".

Filled circles, and boxes with square corners, are drawn as closed
entities (circles via gtroff '\D'C ...', boxes via '\D'P ...').

The simpler immediate fix would be to ensure that when a box has
the 'shaded' attribute and rounded corners, the 'fill' method of
drawing it is used.

However (something I've been pondering for a while), there is in
fact a need for a more general "filled object" mechanism in gpic.

Already one can draw arbitrary filled polygons (grey or colour)
in gtroff using '\D'P ...', though there is no provision in
gpic for generating such code except for boxes (unless you insert
it "by hand" using 'command' or by enclosing it in text, so that
it gets passed through to troff as-is).

The sort of thing I have in mind might, in gpic, look like

[ 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").

This could then strightforwardly include the existing special case
of filled/shaded boxes with rounded corners, since then the
"unshaded" method of drawing these as a sequence of straight lines
and arcs would be of such a type, and there would be no need for
the special "work-pound" that gpic already uses with "fill".

Another feature which is missing (and I'm actually surprised
that the original 'pic' did not provide for it) is the rotation
of entities.

E.g.

  box with .c at (0,0) rotate 30

for a box rotated through 30 degrees anticlockwise.

Howeve, these latter considerations are a longer-term target, since
they would involve altering gpic at a much deeper level. As things
stand, implementing the above "immediate fix" for round-cornered
shaded boxes may be much simpler!

Best wishes to all,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 17-Sep-05                                       Time: 12:40:48
------------------------------ XFMail ------------------------------




reply via email to

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