cc [ flag... ] file... –lmlib [ library... ] #include <mlib.h> mlib_status mlib_ImageScale2(mlib_image *dst, const mlib_image *src, const mlib_d64 *alpha, const mlib_d64 *beta);
The mlib_ImageScale2() function performs a linear scaling on the pixels of the source image by multiplying the data by a scale factor and then adding an offset. Images must have the same size, and number of channels. They can have 1, 2, 3, or 4 channels.
The following equation is used:
dst[x][y][i] = src[x][y][i] * alpha[i] + beta[i]
If the result of the operation underflows/overflows the minimum/maximum value supported by the destination image, then it will be clamped to the minimum/maximum value respectively.
See the following table for available variations of this linear scaling function.
[*] Each row represents a source data type. Each column represents a destination data type.
The function takes the following arguments:
Pointer to destination image.
Pointer to source image.
Scaling factor. alpha[i] contains the scaling factor for channel i.
Offset value. beta[i] contains the offset for channel i.
The function returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE.
See attributes(5) for descriptions of the following attributes: