1mlib_ImageDivAlpha(3MLIB) mediaLib Library Functions mlib_ImageDivAlpha(3MLIB)
2
3
4

NAME

6       mlib_ImageDivAlpha - alpha channel division
7

SYNOPSIS

9       cc [ flag... ] file... -lmlib [ library... ]
10       #include <mlib.h>
11
12       mlib_status mlib_ImageDivAlpha(mlib_image *dst, const mlib_image *src,
13            mlib_s32 cmask);
14
15

DESCRIPTION

17       The  mlib_ImageDivAlpha()  function divides color channels by the alpha
18       channel on a pixel-by-pixel basis.
19
20
21       For the MLIB_BYTE image, it uses the following equation:
22
23         dst[x][y][c] = src[x][y][c] / (src[x][y][a] * 2**(-8))
24
25
26
27       For the MLIB_SHORT image, it uses the following equation:
28
29         dst[x][y][c] = src[x][y][c] / (src[x][y][a] * 2**(-15))
30
31
32
33       For the MLIB_USHORT image, it uses the following equation:
34
35         dst[x][y][c] = src[x][y][c] / (src[x][y][a] * 2**(-16))
36
37
38
39       For the MLIB_INT image, it uses the following equation:
40
41         dst[x][y][c] = src[x][y][c] / (src[x][y][a] * 2**(-31))
42
43
44
45       where c and a are the indices for the  color  channels  and  the  alpha
46       channel, respectively, so c != a.
47
48
49       In the case of src[x][y][a] = 0,
50
51         dst[x][y][c] = 0              if src[x][y][c] = 0
52         dst[x][y][c] = DATA_TYPE_MAX  if src[x][y][c] > 0
53         dst[x][y][c] = DATA_TYPE_MIN  if src[x][y][c] < 0
54
55
56
57       where  DATA_TYPE  is  MLIB_U8,  MLIB_S16,  MLIB_U16, or MLIB_S32 for an
58       image of type MLIB_BYTE, MLIB_SHORT, MLIB_USHORT, or MLIB_INT,  respec‐
59       tively.
60

PARAMETERS

62       The function takes the following arguments:
63
64       dst      Pointer to destination image.
65
66
67       src      Pointer to source image.
68
69
70       cmask    Channel  mask  to  indicate the alpha channel. Each bit of the
71                mask represents a channel in the  image.  The  channel  corre‐
72                sponding to the 1 bit of cmask is the alpha channel.
73
74

RETURN VALUES

76       The  function  returns MLIB_SUCCESS if successful. Otherwise it returns
77       MLIB_FAILURE.
78

ATTRIBUTES

80       See attributes(5) for descriptions of the following attributes:
81
82
83
84
85       ┌─────────────────────────────┬─────────────────────────────┐
86       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
87       ├─────────────────────────────┼─────────────────────────────┤
88       │Interface Stability          │Committed                    │
89       ├─────────────────────────────┼─────────────────────────────┤
90       │MT-Level                     │MT-Safe                      │
91       └─────────────────────────────┴─────────────────────────────┘
92

SEE ALSO

94       mlib_ImageDivAlpha_Inp(3MLIB),            mlib_ImageDivAlpha_Fp(3MLIB),
95       mlib_ImageDivAlpha_Fp_Inp(3MLIB), attributes(5)
96
97
98
99SunOS 5.11                        2 Mar 2007         mlib_ImageDivAlpha(3MLIB)
Impressum