1mlib_ImageDivAlpha_Inp(3MLImBe)diaLib Library Functiomnlsib_ImageDivAlpha_Inp(3MLIB)
2
3
4
6 mlib_ImageDivAlpha_Inp - alpha channel division, in place
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageDivAlpha_Inp(mlib_image *srcdst, mlib_s32 cmask);
13
14
16 The mlib_ImageDivAlpha_Inp() function divides color channels by the
17 alpha channel on a pixel-by-pixel basis, in place.
18
19
20 For the MLIB_BYTE image, it uses the following equation:
21
22 srcdst[x][y][c] = srcdst[x][y][c] / (srcdst[x][y][a] * 2**(-8))
23
24
25
26 For the MLIB_SHORT image, it uses the following equation:
27
28 srcdst[x][y][c] = srcdst[x][y][c] / (srcdst[x][y][a] * 2**(-15))
29
30
31
32 For the MLIB_USHORT image, it uses the following equation:
33
34 srcdst[x][y][c] = srcdst[x][y][c] / (srcdst[x][y][a] * 2**(-16))
35
36
37
38 For the MLIB_INT image, it uses the following equation:
39
40 srcdst[x][y][c] = srcdst[x][y][c] / (srcdst[x][y][a] * 2**(-31))
41
42
43
44 where c and a are the indices for the color channels and the alpha
45 channel, respectively, so c != a.
46
47
48 In the case of srcdst[x][y][a] = 0,
49
50 srcdst[x][y][c] = 0 if srcdst[x][y][c] = 0
51 srcdst[x][y][c] = DATA_TYPE_MAX if srcdst[x][y][c] > 0
52 srcdst[x][y][c] = DATA_TYPE_MIN if srcdst[x][y][c] < 0
53
54
55
56 where DATA_TYPE is MLIB_U8, MLIB_S16, MLIB_U16, or MLIB_S32 for an
57 image of type MLIB_BYTE, MLIB_SHORT, MLIB_USHORT, or MLIB_INT, respec‐
58 tively.
59
61 The function takes the following arguments:
62
63 srcdst Pointer to source and destination image.
64
65
66 cmask Channel mask to indicate the alpha channel. Each bit of the
67 mask represents a channel in the image. The channel corre‐
68 sponding to the 1 bit of cmask is the alpha channel.
69
70
72 The function returns MLIB_SUCCESS if successful. Otherwise it returns
73 MLIB_FAILURE.
74
76 See attributes(5) for descriptions of the following attributes:
77
78
79
80
81 ┌─────────────────────────────┬─────────────────────────────┐
82 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
83 ├─────────────────────────────┼─────────────────────────────┤
84 │Interface Stability │Committed │
85 ├─────────────────────────────┼─────────────────────────────┤
86 │MT-Level │MT-Safe │
87 └─────────────────────────────┴─────────────────────────────┘
88
90 mlib_ImageDivAlpha(3MLIB), mlib_ImageDivAlpha_Fp(3MLIB), mlib_ImageDi‐
91 vAlpha_Fp_Inp(3MLIB), attributes(5)
92
93
94
95SunOS 5.11 2 Mar 2007 mlib_ImageDivAlpha_Inp(3MLIB)