1mlib_GraphicsDrawTriangle(3mMeLdIiBa)Lib Library Funcmtliiobn_sGraphicsDrawTriangle(3MLIB)
2
3
4
6 mlib_GraphicsDrawTriangle, mlib_GraphicsDrawTriangle_8, mlib_Graphics‐
7 DrawTriangle_32, mlib_GraphicsDrawTriangle_X_8, mlib_GraphicsDrawTrian‐
8 gle_X_32, mlib_GraphicsDrawTriangle_A_8, mlib_GraphicsDrawTrian‐
9 gle_A_32, mlib_GraphicsDrawTriangle_B_8, mlib_GraphicsDrawTrian‐
10 gle_B_32, mlib_GraphicsDrawTriangle_G_8, mlib_GraphicsDrawTrian‐
11 gle_G_32, mlib_GraphicsDrawTriangle_Z_8, mlib_GraphicsDrawTrian‐
12 gle_Z_32, mlib_GraphicsDrawTriangle_AB_8, mlib_GraphicsDrawTrian‐
13 gle_AB_32, mlib_GraphicsDrawTriangle_ABG_8, mlib_GraphicsDrawTrian‐
14 gle_ABG_32, mlib_GraphicsDrawTriangle_ABGZ_8, mlib_GraphicsDrawTrian‐
15 gle_ABGZ_32, mlib_GraphicsDrawTriangle_ABZ_8, mlib_GraphicsDrawTrian‐
16 gle_ABZ_32, mlib_GraphicsDrawTriangle_AG_8, mlib_GraphicsDrawTrian‐
17 gle_AG_32, mlib_GraphicsDrawTriangle_AGZ_8, mlib_GraphicsDrawTrian‐
18 gle_AGZ_32, mlib_GraphicsDrawTriangle_AZ_8, mlib_GraphicsDrawTrian‐
19 gle_AZ_32, mlib_GraphicsDrawTriangle_BG_8, mlib_GraphicsDrawTrian‐
20 gle_BG_32, mlib_GraphicsDrawTriangle_BGZ_8, mlib_GraphicsDrawTrian‐
21 gle_BGZ_32, mlib_GraphicsDrawTriangle_BZ_8, mlib_GraphicsDrawTrian‐
22 gle_BZ_32, mlib_GraphicsDrawTriangle_GZ_8, mlib_GraphicsDrawTrian‐
23 gle_GZ_32 - draw triangle
24
26 cc [ flag... ] file... -lmlib [ library... ]
27 #include <mlib.h>
28
29 mlib_status mlib_GraphicsDrawTriangle_8(mlib_image *buffer, mlib_s16 x1,
30 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
31 mlib_s32 c);
32
33
34 mlib_status mlib_GraphicsDrawTriangle_32(mlib_image *buffer, mlib_s16 x1,
35 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
36 mlib_s32 c);
37
38
39 mlib_status mlib_GraphicsDrawTriangle_X_8(mlib_image *buffer, mlib_s16 x1,
40 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
41 mlib_s32 c, mlib_s32 c2);
42
43
44 mlib_status mlib_GraphicsDrawTriangle_X_32(mlib_image *buffer, mlib_s16 x1,
45 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
46 mlib_s32 c, mlib_s32 c2);
47
48
49 mlib_status mlib_GraphicsDrawTriangle_A_8(mlib_image *buffer, mlib_s16 x1,
50 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
51 mlib_s32 c);
52
53
54 mlib_status mlib_GraphicsDrawTriangle_A_32(mlib_image *buffer, mlib_s16 x1,
55 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
56 mlib_s32 c);
57
58
59 mlib_status mlib_GraphicsDrawTriangle_B_8(mlib_image *buffer, mlib_s16 x1,
60 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
61 mlib_s32 c, mlib_s32 a);
62
63
64 mlib_status mlib_GraphicsDrawTriangle_B_32(mlib_image *buffer, mlib_s16 x1,
65 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
66 mlib_s32 c, mlib_s32 a);
67
68
69 mlib_status mlib_GraphicsDrawTriangle_G_8(mlib_image *buffer, mlib_s16 x1,
70 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
71 mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
72
73
74 mlib_status mlib_GraphicsDrawTriangle_G_32(mlib_image *buffer, mlib_s16 x1,
75 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
76 mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
77
78
79 mlib_status mlib_GraphicsDrawTriangle_Z_8(mlib_image *buffer,
80 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
81 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2,
82 mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c);
83
84
85 mlib_status mlib_GraphicsDrawTriangle_Z_32(mlib_image *buffer,
86 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
87 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2,
88 mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c);
89
90
91 mlib_status mlib_GraphicsDrawTriangle_AB_8(mlib_image *buffer, mlib_s16 x1,
92 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
93 mlib_s32 c, mlib_s32 a);
94
95
96 mlib_status mlib_GraphicsDrawTriangle_AB_32(mlib_image *buffer,
97 mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3,
98 mlib_s16 y3, mlib_s32 c, mlib_s32 a);
99
100
101 mlib_status mlib_GraphicsDrawTriangle_ABG_8(mlib_image *buffer,
102 mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3,
103 mlib_s16 y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
104
105
106 mlib_status mlib_GraphicsDrawTriangle_ABG_32(mlib_image *buffer,
107 mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3,
108 mlib_s16 y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
109
110
111 mlib_status mlib_GraphicsDrawTriangle_ABGZ_8(mlib_image *buffer,
112 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
113 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
114 mlib_s16 z3, mlib_s32 c1,
115 mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
116
117
118 mlib_status mlib_GraphicsDrawTriangle_ABGZ_32(mlib_image *buffer,
119 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
120 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
121 mlib_s16 z3, mlib_s32 c1,
122 mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
123
124
125 mlib_status mlib_GraphicsDrawTriangle_ABZ_8(mlib_image *buffer,
126 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
127 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
128 mlib_s16 z3, mlib_s32 c,
129 mlib_s32 a);
130
131
132 mlib_status mlib_GraphicsDrawTriangle_ABZ_32(mlib_image *buffer,
133 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
134 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
135 mlib_s16 z3, mlib_s32 c,
136 mlib_s32 a);
137
138
139 mlib_status mlib_GraphicsDrawTriangle_AG_8(mlib_image *buffer, mlib_s16 x1,
140 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
141 mlib_s32 c1,mlib_s32 c2, mlib_s32 c3);
142
143
144 mlib_status mlib_GraphicsDrawTriangle_AG_32(mlib_image *buffer,
145 mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3,
146 mlib_s16 y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
147
148
149 mlib_status mlib_GraphicsDrawTriangle_AGZ_8(mlib_image *buffer,
150 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
151 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
152 mlib_s16 z3, mlib_s32 c1,
153 mlib_s32 c2, mlib_s32 c3);
154
155
156 mlib_status mlib_GraphicsDrawTriangle_AGZ_32(mlib_image *buffer,
157 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
158 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
159 mlib_s16 z3, mlib_s32 c1,
160 mlib_s32 c2, mlib_s32 c3);
161
162
163 mlib_status mlib_GraphicsDrawTriangle_AZ_8(mlib_image *buffer,
164 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
165 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2,
166 mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c);
167
168
169 mlib_status mlib_GraphicsDrawTriangle_AZ_32(mlib_image *buffer,
170 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
171 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
172 mlib_s16 z3, mlib_s32 c);
173
174
175 mlib_status mlib_GraphicsDrawTriangle_BG_8(mlib_image *buffer, mlib_s16 x1,
176 mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
177 mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
178
179
180 mlib_status mlib_GraphicsDrawTriangle_BG_32(mlib_image *buffer,
181 mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3,
182 mlib_s16 y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
183
184
185 mlib_status mlib_GraphicsDrawTriangle_BGZ_8(mlib_image *buffer,
186 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
187 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
188 mlib_s16 z3, mlib_s32 c1,
189 mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
190
191
192 mlib_status mlib_GraphicsDrawTriangle_BGZ_32(mlib_image *buffer,
193 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
194 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
195 mlib_s16 z3, mlib_s32 c1,
196 mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
197
198
199 mlib_status mlib_GraphicsDrawTriangle_BZ_8(mlib_image *buffer,
200 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
201 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2,
202 mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c, mlib_s32 a);
203
204
205 mlib_status mlib_GraphicsDrawTriangle_BZ_32(mlib_image *buffer,
206 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
207 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
208 mlib_s16 z3, mlib_s32 c,
209 mlib_s32 a);
210
211
212 mlib_status mlib_GraphicsDrawTriangle_GZ_8(mlib_image *buffer,
213 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
214 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2,
215 mlib_s16 x3, mlib_s16 y3,
216 mlib_s16 z3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
217
218
219 mlib_status mlib_GraphicsDrawTriangle_GZ_32(mlib_image *buffer,
220 mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1,
221 mlib_s16 x2, mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3,
222 mlib_s16 z3, mlib_s32 c1,
223 mlib_s32 c2, mlib_s32 c3);
224
225
227 Each of the mlib_GraphicsDrawTriangle_*() functions draws a triangle
228 with the vertices at (x1,y1), (x2,y2), and (x3,y3).
229
230
231 Each of the mlib_GraphicsDrawTriangle_X_*() functions draws a triangle
232 in Xor mode as follows:
233
234 data[x,y] ^= c ^ c2
235
236
237
238 Each of the mlib_GraphicsDrawTriangle_A_*() functions draws a triangle
239 with antialiasing.
240
241
242 Each of the mlib_GraphicsDrawTriangle_B_*() functions draws a triangle
243 with alpha blending as follows:
244
245 data[x,y] = (data[x,y] * (255 - a) + c * a) / 255
246
247
248
249 Each of the mlib_GraphicsDrawTriangle_G_*() functions draws a triangle
250 with Gouraud shading.
251
252
253 Each of the mlib_GraphicsDrawTriangle_Z_*() functions draws a triangle
254 with Z buffering.
255
256
257 Each of the other functions draws a triangle with a combination of two
258 or more features like antialiasing (A), alpha blending (B), Gouraud
259 shading (G), and Z buffering (Z).
260
262 Each of the functions takes some of the following arguments:
263
264 buffer Pointer to the image into which the function is drawing.
265
266
267 zbuffer Pointer to the image that holds the Z buffer.
268
269
270 x1 X coordinate of the first vertex.
271
272
273 y1 Y coordinate of the first vertex.
274
275
276 z1 Z coordinate of the first vertex.
277
278
279 x2 X coordinate of the second vertex.
280
281
282 y2 Y coordinate of the second vertex.
283
284
285 z2 Z coordinate of the second vertex.
286
287
288 x3 X coordinate of the third vertex.
289
290
291 y3 Y coordinate of the third vertex.
292
293
294 z3 Z coordinate of the third vertex.
295
296
297 c Color used in the drawing.
298
299
300 c1 Color of the first vertex.
301
302
303 c2 Color of the second vertex, or the alternation color in Xor
304 Mode.
305
306
307 c3 Color of the third vertex.
308
309
310 a Alpha value for blending. 0 ≤ a ≤ 255.
311
312
314 Each of the functions returns MLIB_SUCCESS if successful. Otherwise it
315 returns MLIB_FAILURE.
316
318 See attributes(5) for descriptions of the following attributes:
319
320
321
322
323 ┌─────────────────────────────┬─────────────────────────────┐
324 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
325 ├─────────────────────────────┼─────────────────────────────┤
326 │Interface Stability │Committed │
327 ├─────────────────────────────┼─────────────────────────────┤
328 │MT-Level │MT-Safe │
329 └─────────────────────────────┴─────────────────────────────┘
330
332 mlib_GraphicsFillTriangle(3MLIB), attributes(5)
333
334
335
336SunOS 5.11 2 Mar 2007 mlib_GraphicsDrawTriangle(3MLIB)