'\" te .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved .TH mlib_ImageDivAlpha 3MLIB "2 Mar 2007" "SunOS 5.11" "mediaLib Library Functions" .SH NAME mlib_ImageDivAlpha \- alpha channel division .SH SYNOPSIS .LP .nf cc [ \fIflag\fR... ] \fIfile\fR... \fB-lmlib\fR [ \fIlibrary\fR... ] #include \fBmlib_status\fR \fBmlib_ImageDivAlpha\fR(\fBmlib_image *\fR\fIdst\fR, \fBconst mlib_image *\fR\fIsrc\fR, \fBmlib_s32\fR \fIcmask\fR); .fi .SH DESCRIPTION .sp .LP The \fBmlib_ImageDivAlpha()\fR function divides color channels by the alpha channel on a pixel-by-pixel basis. .sp .LP For the \fBMLIB_BYTE\fR image, it uses the following equation: .sp .in +2 .nf dst[x][y][c] = src[x][y][c] / (src[x][y][a] * 2**(-8)) .fi .in -2 .sp .LP For the \fBMLIB_SHORT\fR image, it uses the following equation: .sp .in +2 .nf dst[x][y][c] = src[x][y][c] / (src[x][y][a] * 2**(-15)) .fi .in -2 .sp .LP For the \fBMLIB_USHORT\fR image, it uses the following equation: .sp .in +2 .nf dst[x][y][c] = src[x][y][c] / (src[x][y][a] * 2**(-16)) .fi .in -2 .sp .LP For the \fBMLIB_INT\fR image, it uses the following equation: .sp .in +2 .nf dst[x][y][c] = src[x][y][c] / (src[x][y][a] * 2**(-31)) .fi .in -2 .sp .LP where \fBc\fR and \fBa\fR are the indices for the color channels and the alpha channel, respectively, so \fBc != a\fR. .sp .LP In the case of src[x][y][a] = 0, .sp .in +2 .nf dst[x][y][c] = 0 if src[x][y][c] = 0 dst[x][y][c] = DATA_TYPE_MAX if src[x][y][c] > 0 dst[x][y][c] = DATA_TYPE_MIN if src[x][y][c] < 0 .fi .in -2 .sp .LP where \fBDATA_TYPE\fR is \fBMLIB_U8\fR, \fBMLIB_S16\fR, \fBMLIB_U16\fR, or \fBMLIB_S32\fR for an image of type \fBMLIB_BYTE\fR, \fBMLIB_SHORT\fR, \fBMLIB_USHORT\fR, or \fBMLIB_INT\fR, respectively. .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\fIcmask\fR\fR .ad .RS 9n .rt Channel mask to indicate the alpha channel. Each bit of the mask represents a channel in the image. The channel corresponding to the 1 bit of \fBcmask\fR 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_ImageDivAlpha_Inp\fR(3MLIB), \fBmlib_ImageDivAlpha_Fp\fR(3MLIB), \fBmlib_ImageDivAlpha_Fp_Inp\fR(3MLIB), \fBattributes\fR(5)