mlib_GraphicsDrawTriangle(3MLIB) mlib_GraphicsDrawTriangle(3MLIB)
NAME
mlib_GraphicsDrawTriangle, mlib_GraphicsDrawTriangle_8, mlib_GraphicsDrawTriangle_32, mlib_GraphicsDrawTriangle_X_8, mlib_GraphicsDrawTri-
angle_X_32, mlib_GraphicsDrawTriangle_A_8, mlib_GraphicsDrawTriangle_A_32, mlib_GraphicsDrawTriangle_B_8, mlib_GraphicsDrawTriangle_B_32,
mlib_GraphicsDrawTriangle_G_8, mlib_GraphicsDrawTriangle_G_32, mlib_GraphicsDrawTriangle_Z_8, mlib_GraphicsDrawTriangle_Z_32, mlib_Graph-
icsDrawTriangle_AB_8, mlib_GraphicsDrawTriangle_AB_32, mlib_GraphicsDrawTriangle_ABG_8, mlib_GraphicsDrawTriangle_ABG_32, mlib_Graphics-
DrawTriangle_ABGZ_8, mlib_GraphicsDrawTriangle_ABGZ_32, mlib_GraphicsDrawTriangle_ABZ_8, mlib_GraphicsDrawTriangle_ABZ_32, mlib_Graphics-
DrawTriangle_AG_8, mlib_GraphicsDrawTriangle_AG_32, mlib_GraphicsDrawTriangle_AGZ_8, mlib_GraphicsDrawTriangle_AGZ_32, mlib_GraphicsDraw-
Triangle_AZ_8, mlib_GraphicsDrawTriangle_AZ_32, mlib_GraphicsDrawTriangle_BG_8, mlib_GraphicsDrawTriangle_BG_32, mlib_GraphicsDrawTrian-
gle_BGZ_8, mlib_GraphicsDrawTriangle_BGZ_32, mlib_GraphicsDrawTriangle_BZ_8, mlib_GraphicsDrawTriangle_BZ_32, mlib_GraphicsDrawTrian-
gle_GZ_8, mlib_GraphicsDrawTriangle_GZ_32 - draw triangle
SYNOPSIS
cc [ flag... ] file... -lmlib [ library... ]
#include <mlib.h>
mlib_status mlib_GraphicsDrawTriangle_8(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
mlib_s32 c);
mlib_status mlib_GraphicsDrawTriangle_32(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
mlib_s32 c);
mlib_status mlib_GraphicsDrawTriangle_X_8(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
mlib_s32 c, mlib_s32 c2);
mlib_status mlib_GraphicsDrawTriangle_X_32(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c, mlib_s32 c2);
mlib_status mlib_GraphicsDrawTriangle_A_8(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
mlib_s32 c);
mlib_status mlib_GraphicsDrawTriangle_A_32(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c);
mlib_status mlib_GraphicsDrawTriangle_B_8(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
mlib_s32 c, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_B_32(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_G_8(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16 y3,
mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
mlib_status mlib_GraphicsDrawTriangle_G_32(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
mlib_status mlib_GraphicsDrawTriangle_Z_8(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c);
mlib_status mlib_GraphicsDrawTriangle_Z_32(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c);
mlib_status mlib_GraphicsDrawTriangle_AB_8(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_AB_32(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_ABG_8(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_ABG_32(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_ABGZ_8(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_ABGZ_32(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_ABZ_8(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_ABZ_32(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_AG_8(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
mlib_status mlib_GraphicsDrawTriangle_AG_32(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
mlib_status mlib_GraphicsDrawTriangle_AGZ_8(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
mlib_status mlib_GraphicsDrawTriangle_AGZ_32(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
mlib_status mlib_GraphicsDrawTriangle_AZ_8(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c);
mlib_status mlib_GraphicsDrawTriangle_AZ_32(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c);
mlib_status mlib_GraphicsDrawTriangle_BG_8(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_BG_32(mlib_image *buffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 x2, mlib_s16 y2, mlib_s16 x3, mlib_s16
y3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_BGZ_8(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_BGZ_32(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_BZ_8(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_BZ_32(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c, mlib_s32 a);
mlib_status mlib_GraphicsDrawTriangle_GZ_8(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
mlib_status mlib_GraphicsDrawTriangle_GZ_32(mlib_image *buffer, mlib_image *zbuffer, mlib_s16 x1, mlib_s16 y1, mlib_s16 z1, mlib_s16 x2,
mlib_s16 y2, mlib_s16 z2, mlib_s16 x3, mlib_s16 y3, mlib_s16 z3, mlib_s32 c1, mlib_s32 c2, mlib_s32 c3);
Each of the mlib_GraphicsDrawTriangle_*() functions draws a triangle with the vertices at (x1,y1), (x2,y2), and (x3,y3).
Each of the mlib_GraphicsDrawTriangle_X_*() functions draws a triangle in Xor mode as follows:
data[x,y] ^= c ^ c2
Each of the mlib_GraphicsDrawTriangle_A_*() functions draws a triangle with antialiasing.
Each of the mlib_GraphicsDrawTriangle_B_*() functions draws a triangle with alpha blending as follows:
data[x,y] = (data[x,y] * (255 - a) + c * a) / 255
Each of the mlib_GraphicsDrawTriangle_G_*() functions draws a triangle with Gouraud shading.
Each of the mlib_GraphicsDrawTriangle_Z_*() functions draws a triangle with Z buffering.
Each of the other functions draws a triangle with a combination of two or more features like antialiasing (A), alpha blending (B), Gouraud
shading (G), and Z buffering (Z).
Each of the functions takes some of the following arguments:
buffer Pointer to the image into which the function is drawing.
zbuffer Pointer to the image that holds the Z buffer.
x1 X coordinate of the first vertex.
y1 Y coordinate of the first vertex.
z1 Z coordinate of the first vertex.
x2 X coordinate of the second vertex.
y2 Y coordinate of the second vertex.
z2 Z coordinate of the second vertex.
x3 X coordinate of the third vertex.
y3 Y coordinate of the third vertex.
z3 Z coordinate of the third vertex.
c Color used in the drawing.
c1 Color of the first vertex.
c2 Color of the second vertex, or the alternation color in Xor Mode.
c3 Color of the third vertex.
a Alpha value for blending. 0 <= a <= 255.
Each of the functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE.
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Evolving |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
mlib_GraphicsFillTriangle(3MLIB), attributes(5)
7 Mar 2005 mlib_GraphicsDrawTriangle(3MLIB)