1mlib_ImageBlendColor(3MLIB)mediaLib Library Functionsmlib_ImageBlendColor(3MLIB)
2
3
4
6 mlib_ImageBlendColor - blend an image and a color
7
9 cc [ flag... ] file... -lmlib [ library... ]
10 #include <mlib.h>
11
12 mlib_status mlib_ImageBlendColor(mlib_image *dst, const mlib_image *src,
13 const mlib_s32 *color, mlib_s32 cmask);
14
15
17 The mlib_ImageBlendColor() function blends an image and a color with
18 the alpha channel.
19
20
21 It uses the following equation:
22
23 Cd = Cs*As + Cc*(1 - As)
24 Ad = 1.0
25
26
27
28 where, Cs and Cd are the RGB color components of the source and desti‐
29 nation images, respectively. As and Ad are the alpha components of the
30 source and destination images, respectively. Cc is the color component
31 of the constant color.
32
33
34 For MLIB_BYTE images, the alpha coefficients are in Q8 format. For
35 MLIB_SHORT images, the alpha coefficients are in Q15 format and must be
36 positive. For MLIB_USHORT images, the alpha coefficients are in Q16
37 format. For MLIB_INT images, the alpha coefficients are in Q31 format
38 and must be positive.
39
40
41 The images can have two to four channels. The length of color array
42 must not be less than the number of channels in the images.
43
45 The function takes the following arguments:
46
47 dst Pointer to destination image.
48
49
50 src Pointer to source image.
51
52
53 color Array of constant color components.
54
55
56 cmask Channel mask to indicate the alpha channel. Each bit of cmask
57 represents a channel in the image. The channel corresponding
58 to the highest bit with value 1 is the alpha channel.
59
60
62 The function returns MLIB_SUCCESS if successful. Otherwise it returns
63 MLIB_FAILURE.
64
66 See attributes(5) for descriptions of the following attributes:
67
68
69
70
71 ┌─────────────────────────────┬─────────────────────────────┐
72 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
73 ├─────────────────────────────┼─────────────────────────────┤
74 │Interface Stability │Committed │
75 ├─────────────────────────────┼─────────────────────────────┤
76 │MT-Level │MT-Safe │
77 └─────────────────────────────┴─────────────────────────────┘
78
80 mlib_ImageBlendColor_Inp(3MLIB), mlib_ImageBlendColor_Fp(3MLIB),
81 mlib_ImageBlendColor_Fp_Inp(3MLIB), attributes(5)
82
83
84
85SunOS 5.11 2 Mar 2007 mlib_ImageBlendColor(3MLIB)