Path: csiph.com!feeder.erje.net!2.us.feeder.erje.net!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!panix.com!forkosh From: JohnF Newsgroups: comp.lang.postscript Subject: Re: Need a PS Procedure to calculate different shades of Lab Date: Wed, 6 Apr 2016 07:37:39 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 66 Message-ID: References: <50ff0d33-e68c-4b34-bf54-31ac170b1f82@googlegroups.com> NNTP-Posting-Host: panix3.panix.com X-Trace: reader1.panix.com 1459928259 2717 166.84.1.3 (6 Apr 2016 07:37:39 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Wed, 6 Apr 2016 07:37:39 +0000 (UTC) User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (NetBSD/6.1.5 (i386)) Xref: csiph.com comp.lang.postscript:2492 alamraquib@gmail.com wrote: > I would like to generate Type 2 shading in device N color space > to preserve SPOT inks. I am able to do that using DeviceCMYK as > the alternate color space of Device. I am interested in Lab color > as the alternate color space of the device N and here i need the > PS procedure. Any help would be highly appreciated. > Thanks in Advance. Can't help myself, but Gernot Hoffmann has done lots of stuff like this, and googling him might turn up exactly what you're looking for. He wrote an hls-to-rgb ps procedure that I use in ps files. It's input is your h l s, and output is corresponding r g b, used like this... h l s HLStoRGB r g b setrgbcolor Here's his procedure for that. Not what you want, but illustrates the kind of thing you might be able to find... % --- entry point --- /HLStoRGB % HLS Foley algorithm {/sat exch def /lig exch def /hue exch def hue 360 gt {/hue 360 sub def} if hue 0 lt {/hue 360 add def} if lig 1.0 gt {/lig 1.0 def } if lig 0.0 lt {/lig 0.0 def } if sat 1.0 gt {/sat 1.0 def } if sat 0.0 lt {/sat 0.0 def } if lig 0.5 le {/max 1.0 sat add lig mul def} {/max lig sat add lig sat mul sub def} ifelse /min lig 2 mul max sub def /mmm max min sub 60 div def /hux hue 120 add def 1 { hux 360 gt {/hux hux 360 sub def } if hux 60 lt {/col min mmm hux mul add def exit} if hux 180 lt {/col max def exit} if hux 240 lt {/col min mmm 240 hux sub mul add def exit} if /col min def } repeat /Red col def /hux hue def 1 { hux 60 lt {/col min mmm hux mul add def exit} if hux 180 lt {/col max def exit} if hux 240 lt {/col min mmm 240 hux sub mul add def exit} if /col min def } repeat /Grn col def /hux hue 120 sub def 1 { hux 0 lt {/hux hux 360 add def} if hux 60 lt {/col min mmm hux mul add def exit} if hux 180 lt {/col max def exit} if hux 240 lt {/col min mmm 240 hux sub mul add def exit} if /col min def } repeat /Blu col def /r Red def /g Grn def /b Blu def } bind def % --- end-of-function HLStoRGB --- -- John Forkosh ( mailto: j@f.com where j=john and f=forkosh )