groff
[Top][All Lists]
Advanced

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

Re: [Groff] A tip for arbitrary colours in PIC


From: Ted Harding
Subject: Re: [Groff] A tip for arbitrary colours in PIC
Date: Sun, 13 Sep 2009 14:05:42 +0100 (BST)

On 13-Sep-09 07:00:46, Werner LEMBERG wrote:
>> I don't know if this has been discussed before. If not, people may
>> be interested in the following technique for setting up arbitrary
>> ("RGB") colours in PIC.  [...]
> 
> Very nice!  Can you prepare a documentation patch which I can apply
> to pic.ms?
> 
>     Werner

I will hold back on that for the moment! I am still working on the
approach. For example, the following is an extension of the code
I posted before, which now shows how to draw a filled object with
a general colour.

The point is that if you use "colo[u]r[ed]" with a non-defined
colour-name (hence "wombat", "as-is", or whatever you like so long
as it hasn't been heard of), the result will be filled with the
ambient colour.

8<----------------------------------------------------------------

.PS 5i
for i=0 to 1000 do {
  red = i/1000 ; green = 1-red ; blue = red*green
  sprintf("\Z\'\X\'ps: exec %.4f %.4f 0 setrgbcolor\'\'",red,green)
  line from (0,5*i/1000) to (5,5*i/1000) thick 0.5
}
"\Z'\X'ps: exec 1 0 1 setrgbcolor''"
box wid 1 ht 1 at (2.5,2.5) colour "wombat"
"\Z'\X'ps: exec 0.50 0.25 0.85 setrgbcolor''"
circle rad 0.25 at (2.5,2.5) colour "as-is"
line from (0,0) to (5,0) to (5,5) to (0,5) to (0,0) colour "black"
.PE
\X'ps: exec 1 1 1 setrgbcolor'\c
.ce
\fBExample of Colour Shading with Box and Circle\fP

8<----------------------------------------------------------------

The main problem I'm still trying to find a good solution for is how
to fill an arbitrary closed contour with a chosen colour (this also
applies to colours which are defined, like "red" etc.).

The PIC objects which can be filled or coloured without special
manoeuvres are limited to "box," "circle" and "ellipse", and things
which can be constructed "Lego" style from these. Even a triangle
is not an avaiable entity (which could be useable for filling a
closed contour by triangulating its interior, working round from
a fixed internal point).

The line of solution I am thinking about just now involves using
PIC to compute a troff "\D'P ...'" command, since this will draw
a filled (in the ambient colour) closed polygon. However, there
are issues in integrating this with the rest of a picture drawn
using PIC!

More later ...
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 13-Sep-09                                       Time: 14:05:38
------------------------------ XFMail ------------------------------




reply via email to

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