for(intj = 0;j< 16;j++)
{
char byte = font [16 * (*str) + j];
for (int i = 0; i < 8; i++, byte «= 1 ) if ( byte & 0x80 )
dritePixel ( x+i, y+j, color);
}
}
void show360x480 () {
RGB pal [256];
setX360x480 (); // set 320x480 256 colors X-mode
for (int i = 0; i < 256; i++ ) {
int c = i & 0x40 ? i & 0x3F : 0x3F - (i & 0x3F );
pal [i].red = c;
pal [ij.green = c * c / 0x3F;
pal [i].blue =i&0x80?
0x3F - (i » 1 ) & 0x3F : (i » 1 ) & 0x3F;
}
setPalette ( pal, 256 );
for(intx = 0;x< 180; x++) for (int y = 0; y < 240; y++ )
{
unsigned long x2 = ( x + 1 ) * (long)( 360 - x );
unsigned long y2 = ( y + 1 ) * (long)( 480 - y );
int color = (int)((x2*x2)/y2/113);
writePixel (x, y, color);
writePixel ( 359 - x, y, color); writePixel ( x, 479 - y, color); writePixel ( 359 - x, 479 - y, color);
}
}
main ()
{
if (IfindVGA ()) {
printf ("\nVGA compatible card not found."); return -1;
}
setX320x240 (); // set 320x240 256 colors X-mode
font = findROMFont ( 16 ); for (int j = 1; j < 220; j += 21 )

4. Работа с основными графическими устройствами

for (int і = 1; і < 300; і +=21 )
bar (і, j, і+20, j+20, ((j/21*15)+і/21) & OxFF );
drawString ( 110, 100, "Page 0", 70 ); getch ();
setActivePage ( 1 ); setVisualPage ( 1 ); bar ( 10, 20, 300, 200, 33 ); drawString ( 110, 100, "Page 1", 75 ); getch ();
setActivePage ( 2 ); setVisualPage (2 ); bar ( 10, 20, 300, 200, 39 ); drawString ( 110, 100, "Page 2", 80 ); getch ();
setVisualPage (0 ); getch ();
setVisualPage ( 1 ) getch ();
setVisualPage ( 2 ) getch ();
show360x480 (); getch ();
setVideoMode (3 );
}

4.10. Программирование SVGA-адаптеров Существует большое количество видеокарт, хотя и совместимых с VGA, но предоставляющих достаточно большой набор дополнительных режимов. Обычно такие карты называют SuperVGA или SVGA. SVGA-карты различных производителей, весьма различаются по основным возможностям и, как правило, несовместимы друг с другом. Сам термин "SVGA" обозначает скорее не стандарт (как VGA), а некоторое его расширение.


⇐ Предыдущая| |Следующая ⇒