Pen^2 (./8) :
http://www.gamedev.net/page/resources/_/reference/programming/140/283/graphics-programming-black-book-r1698
Han, c'est nul, il n'y a aps un seul PDF qui contient tout

(bon en meme temps j'ai l'original, c'est carrement mieux ^^)
Edit:
J'ai ressortit d'un carton ce que j'avais fait il y a 2ans, c'est surement pas optimal, et je n'ai pas mis la fonction pixmal_Fill, elle est dépendante du framebuffer, mais c'est une fonciton optimisé pour dessiner un rectangle plein sur un framebuffer, mais c'est dépendant du FB, donc aucun interet a etre mis ici.
You are free to comment

/*
* This source code is licenced under the gPL v1 (godzil Public Licence version 1)
* You must conform with it for using the corresponding source code
*/
typedef struct point_t
{
uint32_t x, y;
} point_t;
typedef struct fpoint_t
{
float x, y;
} fpoint_t;
int drawHLine (int contextId, int32_t x1,
int32_t x2, int32_t y,
int32_t color)
{
int result = 0;
context_t *context = (context_t *) contextId;
int32_t xs, xe, w;
#ifdef DEBUG
printf("%s(%d, %d, %d, %d, %d)\n", __func__, contextId, x1, x2, y, color);
#endif
if (x1 < x2)
{ xs = x1; xe = x2; }
else
{ xs = x2; xe = x1; }
/* this is madnessssss !!!! */
result = pixmap_Fill(context->pixmapId, xs, y, xe-xs, 1, color);
#ifdef DEBUG
printf("%s return %d\n", __func__, result);
#endif
return result;
}
#define SetPoint(pt1,pt2) pt1.x=pt2.x; pt1.y=pt2.y
int drawFillTri (int contextId, point_t p1, point_t p2,
point_t p3, uint32_t color)
{
int result = 0;
context_t *context = (context_t *) contextId;
fpoint_t A, B, C, S, E;
float dx1, dx2, dx3;
#ifdef DEBUG
printf("%s(context:%d, p1:{%d, %d}, p2:{%d, %d}, p3:{%d, %d}, color: %d)\n", __func__,
contextId, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, color);
#endif
/* put ABC in the good order (A.y<=B.y<=C.y) */
if ((p1.y <= p2.y) && (p2.y <= p3.y))
{ /* 1 2 3 */
SetPoint(A,p1);
SetPoint(B,p2);
SetPoint(C,p3);
}
else if ((p1.y <= p3.y) && (p3.y <= p2.y))
{ /* 1 3 2 */
SetPoint(A,p1);
SetPoint(B,p3);
SetPoint(C,p2);
}
else if ((p2.y <= p1.y) && (p1.y <= p3.y))
{ /* 2 1 3 */
SetPoint(A,p2);
SetPoint(B,p1);
SetPoint(C,p3);
}
else if ((p2.y <= p3.y) && (p3.y <= p1.y))
{ /* 2 3 1 */
SetPoint(A,p2);
SetPoint(B,p3);
SetPoint(C,p1);
}
else if ((p3.y <= p1.y) && (p1.y <= p2.y))
{ /* 3 1 2 */
SetPoint(A,p3);
SetPoint(B,p1);
SetPoint(C,p2);
}
else/*if ((p3.y <= p2.y) && (p2.y <= p1.y))*/
{ /* 3 2 1 */
SetPoint(A,p3);
SetPoint(B,p2);
SetPoint(C,p1);
}
#ifdef DEBUG
if ((A.y > B.y) || (B.y > C.y) || (A.y > C.y))
{
printf("ERROR WHILE ORDERING ITEMS...\n");
goto exit;
}
#endif
if ((B.y-A.y) > 0) { dx1=(B.x-A.x)/(B.y-A.y); } else { dx1=0.0 };
if ((C.y-A.y) > 0) { dx2=(C.x-A.x)/(C.y-A.y); } else { dx2=0.0 };
if ((C.y-B.y) > 0) { dx3=(C.x-B.x)/(C.y-B.y); } else { dx3=0.0 };
#ifdef DEBUG
printf("dx1:%f dx2:%f dx3:%f\n", dx1, dx2, dx3);
#endif
S.x=E.x=A.x;
S.y=E.y=A.y;
/* Starting ugly code... */
if(dx1 > dx2)
{
#ifdef DEBUG
printf("dx1/dx2 >");
#endif
for(; S.y <= B.y ; S.y++, E.y++, S.x += dx2, E.x += dx1)
{
drawHLine(contextId, S.x ,E.x, S.y, color);
}
SetPoint(E, B);
#ifdef DEBUG
printf("dx2/dx3 >");
#endif
for(; S.y <= C.y ; S.y++, E.y++, S.x += dx2, E.x += dx3)
{
drawHLine(contextId, S.x, E.x, S.y, color);
}
}
else
{
#ifdef DEBUG
printf("dx1/dx2 <");
#endif
for(; S.y <= B.y ; S.y++, E.y++, S.x += dx1, E.x += dx2)
{
drawHLine(contextId, S.x, E.x, S.y, color);
}
SetPoint(S, B);
E.x-=dx2;
#ifdef DEBUG
printf("dx2/dx3 <");
#endif
for(; S.y <= C.y ; S.y++, E.y++, S.x += dx3, E.x += dx2)
{
drawHLine(contextId, S.x, E.x, S.y, color);
}
}
exit:
#ifdef DEBUG
printf("%s return %d", __func__, result);
#endif
return result;
}