Older Newer
Sun, 24 Nov 2019 10:15:06 . . . . SyneRyder [First function definition]


Changes by last author:

Added:
= cmyk2rgb =

== Syntax ==

int cmyk2rgb(int c, int m, int y, int k, int z)

== Arguments ==

:c

::Cyan value

:m

::Magenta value

:y

::Yellow value

:k

::Black value

:z

::Determines which value is returned. z=0 for R (Red), z=1 for G (Green), z=2 for B (Blue)

== Return ==

Returns the R, G or B value from 0 to 255 depending on the value of z

== Description ==

Lets you convert CMYK color values to RGB color values.

== Example ==

<code>

%ffp

ctl(0): "Adjust C", Range=(-255,255), val=0

ctl(1): "Adjust M", Range=(-255,255), val=0

ctl(2): "Adjust Y", Range=(-255,255), val=0

ctl(3): "Adjust K", Range=(-255,255), val=0

ForEveryTile:{

int r,g,b,cyan,mag,yel,k;

for (y= y_start; y < y_end; y++) {

if (updateProgress(y, y_end)) abort();

for (x = x_start; x < x_end; x++) {

r = src(x,y,0);

g = src(x,y,1);

b = src(x,y,2);

cyan = rgb2cmyk(r,g,b,0);

mag = rgb2cmyk(r,g,b,1);

yel = rgb2cmyk(r,g,b,2);

k = rgb2cmyk(r,g,b,3);

// Do the CMYK adjustment

cyan = cyan + ctl(0);

mag = mag + ctl(1);

yel = yel + ctl(2);

k = k + ctl(3);

pset( x, y, 0, cmyk2rgb(cyan,mag,yel,k,0) );

pset( x, y, 1, cmyk2rgb(cyan,mag,yel,k,1) );

pset( x, y, 2, cmyk2rgb(cyan,mag,yel,k,2) );

}

}

return true;

}

</code>

== See Also ==

rgb2cmyk