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


Groups > comp.lang.postscript > #2492

Re: Need a PS Procedure to calculate different shades of Lab

From JohnF <john@please.see.sig.for.email.com>
Newsgroups comp.lang.postscript
Subject Re: Need a PS Procedure to calculate different shades of Lab
Date 2016-04-06 07:37 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <ne2ec3$2kt$1@reader1.panix.com> (permalink)
References <50ff0d33-e68c-4b34-bf54-31ac170b1f82@googlegroups.com>

Show all headers | View raw


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 )

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


Thread

Need a PS Procedure to calculate different shades of Lab alamraquib@gmail.com - 2016-04-05 20:43 -0700
  Re: Need a PS Procedure to calculate different shades of Lab JohnF <john@please.see.sig.for.email.com> - 2016-04-06 07:37 +0000

csiph-web