• Keine Ergebnisse gefunden

Front-End Color Conversion

Im Dokument *Render Reference Manual for Paris (Seite 177-186)

Chapter 3 Math Routines

3.4 Front-End Color Conversion

This section documents the new *Render routines that convert color vectors between color spaces.

CMS~fe_rgb _to_cmy CMSR_fe_cmy_to_rgb

164 164

CMSR_fe_rgb_toJiq ... 166

CMSR_feJict..to_rgb ... 166

CMSR_fe_rgb_to_hsv ... 168

CMSR_fe_hsv_to_rgb CMSR_fe_rgb_to_hsl CMSR_fe_hsl_to_rgb

Version 2.0, November 1991

168 170 170

163

CMSR_fe_rgb_to_cmy

CMSR_fe_cmy_toJgb *Render Reference Manual for Paris

III III 1111 !II i 11111111111 !i !Iillill ill lllliiillllll!! Ii II llllliOiillillli :ml!ii Iii! I III: iii:]::: II : r: !IIi!! !i II;;;; I 'II. 1111 1il1:al . j : ::!!!i:[$:t@

CMSR_fe_rgb_to_cmy CMSR_fe_cmy_to_rgb

Converts color vector from RGB to CMY (CMY to RGB) color models.

SYNTAX

C Syntax

#include <cm/cmsr.h>

double

*

CMSR_fe_rqb_to_cmy (rgb_vector, cmy_vector);

double rgb_vector[3], cmy_vector[3];

double

*

CMSR_fe_CJnY_to_rqb (cmy_vector, rgb_vector);

double cmy_vector[3], rgb_vector[3];

Fortran Syntax

INCLUDE '/usr/include/cm/cmsr-math-fort.h'

INTEGER FUNCTION CMSR _FE _ RGB _ TO _ CMY (rgb _vector, cmy _vector) DOUBLE PRECISION rgb_vector(3), cmy_vector(3)

INTEGER FUNCTION CMSR _FE _ CMY _ TO _ RGB (cmy _vector, rgb _vector) DOUBLE PRECISION cmy_vector(3), rgb_vector(3)

Lisp Syntax

164

CMSR: fe-rqb-to-cmy (rgb-vector &optional cmy-vector) CMSR: fe-cmy-to-rqb (cmy-vector &optional rgb-vector)

Version 2.0, November 1991

\

CMSR_f8J9b_to_cmy

Chapter 3. Math Routines CMSR_f8_cmy_to_rgb

Hi II ! iii Ii m~!!!Im:I.: 1m : I I:: lllEi::!]!}!.::::: i lllii iilEI HI !!1IIE1Kii!ll : : :::m!!l ii :iIi] E Iii : : :: :i:::miE:iii:m: ii i: iIi 111:11111 i ! ili!l:::;mIC:;:iii!11

ARGUMENTS

DESCRIPTION

A one-dimensional array of 3 elements containing an RGB color triplet. The red intensity is in the first element, the green intensity is in the second element, and the blue intensity is in the third element. Each of the RGB color components should be in the range of [0,1].

A one-dimensional array of 3 elements containing a CMY color triplet. The cyan intensity is in the first element, the magenta intensity is in the second element, and the yellow intensity is in the third element. Each of the CMY color components should be in the range of [0,1].

CMSR _ fe _rqb _ to _ cmy converts the RGB triplet in rgb _vector to CMY triplet, places the result in cmy _vector, and returns a pointer to cmy _vector. The relationship is

(c,m,y) = (1,1,1) - (r,g,b)

CMSR_fe_CDlY_to_rqb converts the CMY triplet in cmy_vector to RGB, places the result in rgb_vector and returns a pointer to rgb_vector. The relationship is

(r,g,b) = (1,1,1) - (c,m,y)

Version 2.0, November 1991 165

CMSR_fe_rgb_toJiq

CMSR_feJI~to_rgb *Render Reference Manual for Paris

I Ii IIIIIII!I! iiill! 1[1111111 111111111111 i :1 :11 i ;:; III gii!!!illil II II!II I E II I iiiliiiliii!ii II I EIII I I Ii: I I II I11I I II Il!ill: 1111.1111 I II Ellll:::!!!I: ii::::::IIIi:::lllllilli:ii!1

CMSR_fe_rgb_to_yiq CMSR_fejliq_to_rgb

Converts color vector from ROB to YIQ (YIQ to ROB) color models.

SYNTAX C Syntax

#include <cm/cmsr.h>

double

*

CMSR _ fe _ rgb _to J i q (rgb _vector, yiq_vector) double rgb_vector[3] , yiq_vector[3];

double

*

CMSR_feJi<t..to_rgb (yiq_vector, rgb_vector) double yiq_vector[3], rgb_vector[3];

Fortran Syntax

INCLUDE '/usr/include/cm/cmsr-math-fort.h'

INTEGER FUNCTION CMSR_FE_RGB_TO_YIQ (rgb]ector, yiq_vector) DOUBLE PRECISION rgb_vector(3) , yiq_vector(3)

INTEGER FUNCTION CMSR_FE_YI<:LTO_RGB (yiq_vector, rgb_vector) DOUBLE PRECISION yiq_vector(3), rgb_vector(3)

Lisp Syntax

166

CMSR: fe-rgb-to-yiq (rgb-vector &optional yiq-vector) CMSR: fe-yiq-to-rgb (yiq-vector &optional rgb-vector)

Version 2.0, November 1991

CMSR_feJgb_toJlq

Chapter 3. Math Routines CMSR_feJlclJOJ9b

III : !IIi iii II :: Iii Il!Iilll!i!i!lil!lilliillllllll!llllllli ::III I!lIIiElIli : !iiIIIIIlill II I miiIlIIli!ii11 liIIl:ll! Ii Ii ilill Ii II III 11111111 liilll IIIIII! i jj I I I 1I1I111I IIIII1 1iI1!1!!!1I1I1!!III!1EI iIl!111

ARGUMENTS

DESCRIPTION

A one-dimensional array of 3 elements containing an RGB color triplet. The red intensity is in the first element, the green intensity is in the second element, and the blue intensity is in the third element. Each of the RGB color components should be in the range of [0,1].

A one-dimensional array of 3 elements containing a YIQ color triplet.

CMSR _fa _ rqb _ to ""'yiq converts an RGB triplet in rgb _vector to a YIQ triplet, places the result in yiq_vector, and returns a pointer to yiq_vector. Each of the RGB color components should be in the range [0,1].

CMSR _fa ""'yiCL to _ rqb converts a YIQ triplet in yiq_vector to an RGB triplet, places the result in rgb _vector, and returns a pointer to rgb _vector. Each of the YIQ color com-ponents should be in the range [0,1] but this restriction is not enforced.

Version 2.0, November 1991 167

CMSR_fe_rgb_to_hsv

CMSR_fe_hsv_to_rgb *Render Reference Manual for Paris

::IIii!lliliillllllllilil i ElIII i!Il1iliiillli illl 111111iI1:1 !1I1! JElill :111111111111:1:1 Ii Ilill1ll1Ei11li iillillliilllillliiilllliillii IIIII iiiii!lliIEl l1iiilllllllllill:::iIlI:llIi: 11II1 lllillllll!l!lIlll1i Ililillllllill

CMSR_fe_rgb_to_hsv CMSR_fe_hsv _to_rgb

Converts a color vector from ROB to HSV (HSV to ROB) color models.

SYNTAX

C Syntax

'include <cm/cmsr.h>

double

*

CMSR _ fe _ rqb _ to _ hsv (rgb _vector, hsv _vector) double rgb_vector[3], hsv_vector[3];

double

*

CMSR_fe_hsv_to_rqb (hsv_vector, rgb_vector) double hsv_vector[3], rgb_vector[3];

Fortran Syntax

INCLUDE '/usr/include/cm/cmsr-math-fort.h'

SUBROUTINE CMSR_fe_rqb_to_hsv (rgb_vector, hsv_vector) DOUBLE PRECISION rgb_vector(3), hsv_vector(3)

SUBROUTINE CMSR_fe_hsv_to_rqb (hsv_vector, rgb_vector) DOUBLE PRECISION hsv_vector(3), rgb_vector(3)

Lisp Syntax

168

CMSR: fe-rqb-to-hsv (rgb-vector &optional hsv-vector) CMSR: fe-hsv-to-rqb (hsv-vector &optional rgb-vector)

Version 2.0, November 1991

CMSR_feJgb_to_hsv

Chapter 3. Math Routines CMSR_fe_hsv_to_rgb

MUg : I !i!U:;:!lIi!I!Ii!::;:::::::iiillll:!I!lI!l!iiWiWii!liiili ::: l!ii.l!illiil Iii: II! Ii ! Ii :Ii mmE.::I Ii !Ii I ! I: i :!I :JIll. Ilml:!l! I!:: : l!!iil!!!:::i!Il!:!~

ARGUMENTS

hsv vector

DESCRIPTION

A one-dimensional array of 3 elements containing an RGB color triplet. The red intensity is in the fIrst element, the green intensity is in the second element, and the blue intensity is in the third element. Each of the RGB color components should be in the range of [0,1].

A one-dimensional array of 3 elements containing an HSV color triplet. The hue of the color is in the fIrst element, the saturation is in the second element, and the value is in the third element. Hue should be in the range [0, 2*pi], and saturation and value should be in the range [0,1].

CMSR_fe_rqb_to_hsv converts the RGB triplet in rgb_vectorto HSV, places the re-sult in hsv _vector, and returns a pointer to hsv _vector. Hue will be between 0.0 and 2*pi. If s is zero, h is irrelevant and is set to zero. Ifv is zero, h and s are irrelevant and are also set to zero.

CMSR_fe_hsv_to_rqb converts the HSV triplet in hsv_vector to an RGB triplet, places the result in rgb _vector and returns a pointer to rgb _vector. Hue is taken modulo 2 *pi. If s is zero, h is irrelevant. If v is zero, s and v are irrelevant.

Version 2.0, November 1991 169

CMSR_fe_rgb_to_hsl

CMSR_fe_hsUo_rgb "'Render Reference Manualfor Paris

II 11111111111111111111111 lIIl1lli11llllliliilllllllll:mlll!lIlliillHIl!!lIIIIIII[1 1111111111111 [1111i II il 1IIIIIi III Iii III 1 IIIIIIIII!IIIIIIIIIIIII Ilililllliillll!llllllllllllllIlJI 1IIIIIIIIIIilIIIIII

CMSR_fe_rgb_to_hsl CMSR_fe_hsl_to_rgb

Converts a color vector from ROB to HSL (HSL to ROB) color models.

SYNTAX C Syntax

'include <cm/cmsr.h>

double

*

CMSJLfe_rgb_to_hsl (rgb_vector, hsCvector) double rgb_vector[3], hsCvector[3];

double

*

CMSR._fe_hsl_to_rgb (hsZ_vector, rgb_vector) double hsZ_vector[3], rgb_vector[3];

Fortran Syntax

INCLUDE '/usr/include/cm/cmsr-math-fort.h'

SOBROUTINE CMSR. FE R.GB TO BSL (rgb _vector, hsCvector) DOUBLE PRECISION rgb_vector(3), hsv_vector(3)

SUBROUTINE CMSR._FE_BSL_TO_RGB (hsv_vector, rgb_vector) DOUBLE PRECISION hsv_vector(3), rgb_vector(3)

Lisp Syntax

170

CMSR.: fe-rgb-to-hsl (rgb-vector 'optional hsv-vector) CMSR.: fe-hsl-to-rgb (hsv-vector 'optional rgb-vector)

Version 2.0, November 1991

i

\

CMSR_fe_rgb_to_hsl

Chapter 3. Math Routines CMSR_fe_hsUo_rgb

il!lillllllllillll!ii11 111111111111 11111111111 1IIIilililElllllllillillli 1111111111 I1llllllliilllill [II! illli:::iilliliilllllllE i II : ! 1 I :: :: III iii II I I!illt::ll!llil ::::[1[11111:: I: I !llml::

ARGUMENTS

hsl vector

DESCRIPTION

A one-dimensional array of 3 elements containing an ROB color triplet. The red intensity is in the first element, the green intensity is in the second element, and the blue intensity is in the third element. Each of the ROB color components should be in the range of [0,1].

A one-dimensional array of 3 elements containing an HSL color triplet. The hue of the color is in the fIrSt element, the saturation is in the second element, and the lightness is in the third element.

Hue should be in the range [0, 2*pi], and saturation and lightness should be in the range [0,1].

CMSR_fe_rqb_to_hsl converts the ROB triplet in rgb_vector to an HSL triplet and places the result in hsC vector. CMSR _ fe _ hsl_ to _ rqb converts the HSL triplet in hsl_vector to an ROB triplet and places the result in rgb_vector.

In C and Lisp these routines also return a pointer to the result vector.

If saturation is zero, the resulting color is a gray shade. In this case hue is irrelevant and is set to zero. Iflightness is zero, the color is black. In this case both hue and saturation are irrelevant and are set to zero.

Version 2.0, November 1991 171

*Render Reference Manual for Paris

!!!I1i Iilillillllll!ililIII II III! I!IIII! :111111111 I E!i!1 !lllii!ll1il11 I I liliilliillliiiill!Jil!lIIllllliil I III I! 11111 Illiiii!IIIII!11 i: I: i iii !lIm! i Eii!'iliIlii

Im Dokument *Render Reference Manual for Paris (Seite 177-186)