Colornames to RGB values

Alejandro Tejada capellan2000 at yahoo.com
Wed Dec 4 19:15:01 EST 2002


Hi Monte,

I've already used this code from the Borland site
in the utility stack epsImportV03p.

Here, I convert the cmyk color in Adobe Ilustrator
files to a rgb string.

The cmyk color is in decimal format
as (0.75 0.5 0.25 0)
Notice that I don't use the whole code from
the Borland site, just the part I need.

Function CMYKtoRGB cmyk
  replace space with comma in cmyk
  put cmyk into cmykVar
 
  repeat 4
    put trunc(item 1 of cmykVar * 255) & "," after
cmykVar2
    delete item 1 of cmykVar
  end repeat
  if item 1 of cmykVar2 = 0 and item 2 of cmykVar2 = 0
and item 3 of cmykVar2 = 0
  then
    put item 4 of cmykVar2 into R
    put item 4 of cmykVar2 into G
    put item 4 of cmykVar2 into B
  else
    if (item 1 of cmykVar2 + item 4 of cmykVar2) < 255
    then put 255 - (item 1 of cmykVar2 + item 4 of
cmykVar2) into R
    else put 0 into R
    if (item 2 of cmykVar2 + item 4 of cmykVar2) < 255
    then put 255 - (item 2 of cmykVar2 + item 4 of
cmykVar2) into G
    else put 0 into G
    if (item 3 of cmykVar2 + item 4 of cmykVar2) < 255
    then put 255 - (item 3 of cmykVar2 + item 4 of
cmykVar2) into B
    else put 0 into B
  end if
  -- put R & "," & G & "," & B -- Uncomment for debug
  return R & "," & G & "," & B
end CMYKtoRGB


> From: "Ken Ray" <kray at sonsothunder.com>
> Date: Wed, 4 Dec 2002 00:41:07 -0600

> Monte,
> 
> You might want to look at the Pascal(?) code at
> Borland's web site and see
> if you can convert it to Transcript:
> 
>
http://community.borland.com/article/0,1410,17948,00.html
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the Use-livecode mailing list