/* Affiche tous les pixels de la liste de lignes horizontales transmises, en mode 13h, le mode 320x200 256 couleurs du VGA. Emploie une approche lente pixel par pixel, dont l'avantage est de pouvoir être portée sur n'importe quel environnement. Compilé avec Borland C++ 4.02. Lié à L21-3.C. Testé par Jim Mischel 11/30/94. */ #include #include "polygon.h" #define SCREEN_WIDTH 320 #define SCREEN_SEGMENT 0xA000 static void DrawPixel(int, int, int); void DrawHorizontalLineList(struct HLineList * HLineListPtr, int Color) { struct HLine *HLinePtr; int Y, X; /* Pointe sur le descripteur XStart/XEnd de la première (la plus en haut) ligne horizontale */ HLinePtr = HLineListPtr->HLinePtr; /* Affiche chaque ligne horizontale l'une après l'autre, en commençant par celle du haut et en avançant d'une ligne à chaque fois */ for (Y = HLineListPtr->YStart; Y < (HLineListPtr->YStart + HLineListPtr->Length); Y++, HLinePtr++) { /* Affiche chaque pixel l'un après l'autre dans la ligne horizontale courante,en commençant par celui le plus à gauche */ for (X = HLinePtr->XStart; X <= HLinePtr->XEnd; X++) DrawPixel(X, Y, Color); } } /* Affiche le pixel en (X, Y) de couleur Color en mode 13h VGA*/ static void DrawPixel(int X, int Y, int Color) { unsigned char far *ScreenPtr; #ifdef __TURBOC__ ScreenPtr = MK_FP(SCREEN_SEGMENT, Y * SCREEN_WIDTH + X); #else /* MSC 5.0 */ FP_SEG(ScreenPtr) = SCREEN_SEGMENT; FP_OFF(ScreenPtr) = Y * SCREEN_WIDTH + X; #endif *ScreenPtr = (unsigned char)Color; }