'\" te .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved .TH mlib_ImageColorHSV2RGB 3MLIB "12 Sep 2007" "SunOS 5.11" "mediaLib Library Functions" .SH NAME mlib_ImageColorHSV2RGB \- HSV to RGB color conversion .SH SYNOPSIS .LP .nf cc [ \fIflag\fR... ] \fIfile\fR... \fB-lmlib\fR [ \fIlibrary\fR... ] #include \fBmlib_status\fR \fBmlib_ImageColorHSV2RGB\fR(\fBmlib_image *\fR\fIdst\fR, \fBconst mlib_image *\fR\fIsrc\fR); .fi .SH DESCRIPTION .sp .LP The \fBmlib_ImageColorHSV2RGB()\fR function performs a conversion from hue/saturation/value to red/green/blue. The source and destination images must be three-channel images. .sp .LP It uses the following equations: .sp .in +2 .nf P = V*(1 - S) Q = V*(1 - S*fraction(H*6)) T = V*(1 - S*(1 - fraction(H*6))) R, G, B = V, T, P if 0 \(<= H < 1/6 R, G, B = Q, V, P if 1/6 \(<= H < 2/6 R, G, B = P, V, T if 2/6 \(<= H < 3/6 R, G, B = P, Q, V if 3/6 \(<= H < 4/6 R, G, B = T, P, V if 4/6 \(<= H < 5/6 R, G, B = V, P, Q if 5/6 \(<= H < 1 .fi .in -2 .sp .LP where \fB0 \(<= H < 1\fR and \fB0 \(<= S, V, P, Q, T, R, G, B \(<= 1\fR. .sp .LP Assuming a pixel in the source image is \fB(h, s, v)\fR and its corresponding pixel in the destination image is \fB(r, g, b)\fR, then for \fBMLIB_BYTE\fR images, the following applies: .sp .in +2 .nf H = h/256 S = s/255 V = v/255 r = R*255 g = G*255 b = B*255 .fi .in -2 .sp .LP for \fBMLIB_SHORT\fR images, the following applies: .sp .in +2 .nf H = (h + 32768)/65536 S = (s + 32768)/65535 V = (v + 32768)/65535 r = R*65535 - 32768 g = G*65535 - 32768 b = B*65535 - 32768 .fi .in -2 .sp .LP for \fBMLIB_USHORT\fR images, the following applies: .sp .in +2 .nf H = h/65536 S = s/65535 V = v/65535 r = R*65535 g = G*65535 b = B*65535 .fi .in -2 .sp .LP and for \fBMLIB_INT\fR images, the following applies: .sp .in +2 .nf H = (h + 2147483648)/4294967296 S = (s + 2147483648)/4294967295 V = (v + 2147483648)/4294967295 r = R*4294967295 - 2147483648 g = G*4294967295 - 2147483648 b = B*4294967295 - 2147483648 .fi .in -2 .SH PARAMETERS .sp .LP The function takes the following arguments: .sp .ne 2 .mk .na \fB\fIdst\fR\fR .ad .RS 7n .rt Pointer to destination image. .RE .sp .ne 2 .mk .na \fB\fIsrc\fR\fR .ad .RS 7n .rt Pointer to source image. .RE .SH RETURN VALUES .sp .LP The function returns \fBMLIB_SUCCESS\fR if successful. Otherwise it returns \fBMLIB_FAILURE\fR. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBmlib_ImageColorHSV2RGB_Fp\fR(3MLIB), \fBmlib_ImageColorRGB2HSV\fR(3MLIB), \fBmlib_ImageColorRGB2HSV_Fp\fR(3MLIB), \fBattributes\fR(5)