'\" te .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved .TH mlib_ImageBlendColor 3MLIB "2 Mar 2007" "SunOS 5.11" "mediaLib Library Functions" .SH NAME mlib_ImageBlendColor \- blend an image and a color .SH SYNOPSIS .LP .nf cc [ \fIflag\fR... ] \fIfile\fR... \fB-lmlib\fR [ \fIlibrary\fR... ] #include \fBmlib_status\fR \fBmlib_ImageBlendColor\fR(\fBmlib_image *\fR\fIdst\fR, \fBconst mlib_image *\fR\fIsrc\fR, \fBconst mlib_s32 *\fR\fIcolor\fR, \fBmlib_s32\fR \fIcmask\fR); .fi .SH DESCRIPTION .sp .LP The \fBmlib_ImageBlendColor()\fR function blends an image and a color with the alpha channel. .sp .LP It uses the following equation: .sp .in +2 .nf Cd = Cs*As + Cc*(1 - As) Ad = 1.0 .fi .in -2 .sp .LP where, Cs and Cd are the RGB color components of the source and destination images, respectively. As and Ad are the alpha components of the source and destination images, respectively. Cc is the color component of the constant color. .sp .LP For \fBMLIB_BYTE\fR images, the alpha coefficients are in Q8 format. For \fBMLIB_SHORT\fR images, the alpha coefficients are in Q15 format and must be positive. For \fBMLIB_USHORT\fR images, the alpha coefficients are in Q16 format. For \fBMLIB_INT\fR images, the alpha coefficients are in Q31 format and must be positive. .sp .LP The images can have two to four channels. The length of color array must not be less than the number of channels in the images. .SH PARAMETERS .sp .LP The function takes the following arguments: .sp .ne 2 .mk .na \fB\fIdst\fR\fR .ad .RS 9n .rt Pointer to destination image. .RE .sp .ne 2 .mk .na \fB\fIsrc\fR\fR .ad .RS 9n .rt Pointer to source image. .RE .sp .ne 2 .mk .na \fB\fIcolor\fR\fR .ad .RS 9n .rt Array of constant color components. .RE .sp .ne 2 .mk .na \fB\fIcmask\fR\fR .ad .RS 9n .rt Channel mask to indicate the alpha channel. Each bit of cmask represents a channel in the image. The channel corresponding to the highest bit with value 1 is the alpha channel. .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_ImageBlendColor_Inp\fR(3MLIB), \fBmlib_ImageBlendColor_Fp\fR(3MLIB), \fBmlib_ImageBlendColor_Fp_Inp\fR(3MLIB), \fBattributes\fR(5)