Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #745

Re: setrgbcolor with lineto/curveto

From JohnF <john@please.see.sig.for.email.com>
Newsgroups comp.lang.postscript
Subject Re: setrgbcolor with lineto/curveto
Date 2012-06-14 04:05 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <jrbntd$ips$1@reader1.panix.com> (permalink)
References <jra5b7$mqu$1@reader1.panix.com> <a3rlm7Fl6gU1@mid.individual.net> <odysseus1479-at-8CE2C0.20202513062012@news.eternal-september.org>

Show all headers | View raw


Odysseus <odysseus1479-at@yahoo-dot.ca> wrote:
> Helge Blischke <h.blischke@acm.org> wrote:
>> JohnF wrote:
>> 
>> > Apologies if this is simple, but I don't know postscript
>> > very well, and failed to google it...
>> > I'd like to draw a lineto/curveto with the color varying
>> > from one endpoint to the other. That is, it should start
>> > with  a b c setrgbcolor  at one endpoint and end up with
>> > a' b' c' setrgbcolor  at the other end. It's decorative,
>> > so a-->a', b-->b', c-->c' can vary linearly, or anything
>> > like that, along the line's length. Thanks,
>> 
>> You will have to (1) encapsulate your path to be drawn into gsave and 
>> grestore to prevent unwanted side effects and (2) define a shading pattern 
>> and then do the stroke.
>> 
>> For the details see the PLRM (Postscript Language Reference Manual).
>> Note that shading is a level3 feature.
> 
> Another possibility, which doesn't need Level 3, is to use *strokepath* 
> to convert the line to a closed path, and then *clip* to restrict 
> subsequent painting operations to that region (e.g. a loop that paints a 
> series of lines or rectangles in incrementally varying colours). It 
> would be very easy to fill a straight line with a linear gradient this 
> way, but making the graduations follow a curved path would be more 
> complicated.
> 
> John, do you know in advance what the path will look like, or must the 
> procedure work entirely from whatever arbitrary path is active when it's 
> called? A general solution for the latter case will be much harder to 
> develop.

Thanks, Odysseus (watch out for those pesky rocks!).
Known in advance, but drawing many lines.
It's all just decorative, see http://www.forkosh.com/lineart.html
for the application, and click the "download postscript" button
to get any example file you want. That file will have many explicit
move/line/curve-to's whose endpoints are calculated outside the file,
rather than a loop inside the file that "does the math".
I suppose inside-the-file-math would facilitate the color gradient
stuff, but that would be a non-trivial change to the existing code.

But any way you slice it, I see I'll have some not-quite-so-trivial
postscript to learn. I had just picked up the few trivial commands
illustrated in the file needed to do that pretty simple job.
   And those commands elicited some deja vu, vis-a-vis an HP pen
plotter I'd first used in the early 1970's to draw one or two of
those designs (after seeing them above a secretary's desk, who'd
fabricated them using string and pins). That pen plotter had
exactly the same moveto command, but also had penup and pendown
commands rather than lineto. I'm guessing HP evolved that kind
of early command set until it eventually became postscript.
-- 
John Forkosh  ( mailto:  j@f.com  where j=john and f=forkosh )

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

setrgbcolor with lineto/curveto JohnF <john@please.see.sig.for.email.com> - 2012-06-13 13:41 +0000
  Re: setrgbcolor with lineto/curveto Helge Blischke <h.blischke@acm.org> - 2012-06-13 16:16 +0200
    Re: setrgbcolor with lineto/curveto JohnF <john@please.see.sig.for.email.com> - 2012-06-13 16:04 +0000
    Re: setrgbcolor with lineto/curveto Odysseus <odysseus1479-at@yahoo-dot.ca> - 2012-06-13 20:20 -0600
      Re: setrgbcolor with lineto/curveto JohnF <john@please.see.sig.for.email.com> - 2012-06-14 04:05 +0000
      Re: setrgbcolor with lineto/curveto luser- -droog <mijoryx@yahoo.com> - 2012-06-16 14:45 -0700
  Re: setrgbcolor with lineto/curveto luser- -droog <mijoryx@yahoo.com> - 2012-06-13 16:20 -0700
    Re: setrgbcolor with lineto/curveto luser- -droog <mijoryx@yahoo.com> - 2012-06-13 17:16 -0700
      Re: setrgbcolor with lineto/curveto luser- -droog <mijoryx@yahoo.com> - 2012-06-13 17:36 -0700
        Re: setrgbcolor with lineto/curveto JohnF <john@please.see.sig.for.email.com> - 2012-06-14 04:11 +0000
          Re: setrgbcolor with lineto/curveto luser- -droog <mijoryx@yahoo.com> - 2012-06-14 09:05 -0700
  Re: setrgbcolor with lineto/curveto gernot.hoffmann@hs-emden-leer.de - 2012-06-16 11:00 -0700
  Re: setrgbcolor with lineto/curveto gernot.hoffmann@hs-emden-leer.de - 2012-06-16 10:55 -0700
    Re: setrgbcolor with lineto/curveto gernot.hoffmann@hs-emden-leer.de - 2012-06-16 11:23 -0700
    Re: setrgbcolor with lineto/curveto JohnF <john@please.see.sig.for.email.com> - 2012-06-19 07:00 +0000
      Re: setrgbcolor with lineto/curveto gernot.hoffmann@hs-emden-leer.de - 2012-06-19 00:34 -0700
        Re: setrgbcolor with lineto/curveto JohnF <john@please.see.sig.for.email.com> - 2012-06-19 08:12 +0000
  Re: setrgbcolor with lineto/curveto John Deubert <john@acumentraining.com> - 2012-06-30 10:20 -0700
    Re: setrgbcolor with lineto/curveto JohnF <john@please.see.sig.for.email.com> - 2012-07-04 03:07 +0000
      Re: setrgbcolor with lineto/curveto luser- -droog <mijoryx@yahoo.com> - 2012-07-05 16:24 -0700
        Re: setrgbcolor with lineto/curveto JohnF <john@please.see.sig.for.email.com> - 2012-07-06 14:23 +0000
          Re: setrgbcolor with lineto/curveto JohnF <john@please.see.sig.for.email.com> - 2012-07-11 01:57 +0000
        Re: setrgbcolor with lineto/curveto tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-07-11 01:08 -0400
          Re: setrgbcolor with lineto/curveto luser- -droog <mijoryx@yahoo.com> - 2012-07-12 03:12 -0700
            Re: setrgbcolor with lineto/curveto tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2012-07-12 22:20 -0400

csiph-web