Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #748
| From | gernot.hoffmann@hs-emden-leer.de |
|---|---|
| Newsgroups | comp.lang.postscript |
| Subject | Re: setrgbcolor with lineto/curveto |
| Date | 2012-06-16 11:00 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <4af5eb1e-4c3e-4586-bbc1-e833982dc80d@googlegroups.com> (permalink) |
| References | <jra5b7$mqu$1@reader1.panix.com> |
Posted once again.
Best regards --Gernot Hoffmann
----
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 340 340
%%Creator: Gernot Hoffmann
%%Title: Color interpolation along Curve
%%CreationDate: June 15 / 2012
/mm {2.834646 mul} def
% Bezier Reference:
% http://www.fho-emden.de/~hoffmann/bezier18122002.pdf
% page 2
% 4 control points
/p0x 1.0 def
/p0y 0.0 def
/p1x 1.0 def
/p1y 0.5 def
/p2x 0.5 def
/p2y 1.0 def
/p3x 0.0 def
/p3y 1.0 def
% Start and end color
/R0 0.0 def
/G0 0.5 def
/B0 0.0 def
/R3 1.0 def
/G3 0.5 def
/B3 0.0 def
/Coeff % coefficients see Ref. page 2
{
/ax p3x p2x 3 mul sub p1x 3 mul add p0x sub def
/bx p2x 3 mul p1x 6 mul sub p0x 3 mul add def
/cx p1x 3 mul p0x 3 mul sub def
/ay p3y p2y 3 mul sub p1y 3 mul add p0y sub def
/by p2y 3 mul p1y 6 mul sub p0y 3 mul add def
/cy p1y 3 mul p0y 3 mul sub def
} def
/Ipol % color interpolation
{/R R3 R0 sub t mul R0 add def
/G G3 G0 sub t mul G0 add def
/B B3 B0 sub t mul B0 add def
R G B setrgbcolor
} def
/Func % function, using Bezier by Horner scheme
{
/x ax t mul bx add t mul cx add t mul p0x add def
/y ay t mul by add t mul cy add t mul p0y add def
} def
100 mm 100 mm scale
0.1 0.1 translate
% black lines
0.001 setlinewidth
0 0 moveto 1 0 lineto stroke
0 0 moveto 0 1 lineto stroke
% black curve
0.04 setlinewidth
p0x p0y moveto
p1x p1y p2x p2y p3x p3y curveto stroke
% color curve
0.02 setlinewidth
/N 100 def % e.g. 100 subdivisions
/dt 1 N div def
Coeff
/t 0 def
Func
N
{
Ipol
/t t dt add def
x y moveto
Func
x y lineto stroke
} repeat
showpage
----
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar
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