Plazma sayı 2, sayfa 144

Bu sayfadaki yazılar

Sayfanın metni

Sayfa 144

void Plot(POINT2D *p2dPoint, unsigned char color); void DrawLine(int x1, int y1, int x2, int y2, unsigned char color); void DrawLine(POINT2D *p2dPoint1, POINT2D *p2dPoint2, unsigned char color); void DrawLine(RECT *rctRect, unsigned char color); void DrawRectangle(int x1, int y1, int x2, int y2, unsigned char color); void DrawRectangle(POINT2D *p2dPoint1, POINT2D *p2dPoint2, unsigned char color); void DrawRectangle(RECT *rctRect, unsigned char color); void DrawCircle(int cx, int cy, int r, unsigned char color); void DrawCircle(POINT2D *p2dPoint, int r, unsigned char color); void FillRectangle(int x1, int y1, int x2, int y2, unsigned char color); void FillRectangle(POINT2D *p2dPoint1, POINT2D *p2dPoint2, unsigned char color); void FillRectangle(RECT *rctRect, unsigned char color); void FillCircle(int cx, int cy, int r, unsigned char color); void FillCircle(POINT2D *p2dPoint, int r, unsigned char color);

/** * Ana Fonksiyon */ void main() { // Değişken tanımları int x, y, i; POINT2D myPoint1; POINT2D myPoint2(40, 40); RECT myRect1; myPoint1.setX(30); myPoint1.setY(30);

// 320x200 256 renk ekran moduna geç SetScreen(VGA13);

// Palet oluştur // 0 - 63 kırmızı tonları (0 : en koyu @siyah@; 63 : en açık @kırmızı@) // 64 - 127 yeşil tonları (64 : en koyu @siyah@; 127 : en açık @yeşil@) // 128 - 191 mavi tonları (128 : en koyu @siyah@; 191 : en açık @mavi@) // 192 - 255 gri tonları (192 : en koyu @siyah@; 255 : en açık @beyaz@) for(i = 0; i <= 63; i++) SetColor(i, i, 0, 0); // kırmızı for(i = 64; i <= 127; i++) SetColor(i, 0, (i - 64), 0); // yeşil for(i = 128; i <= 191; i++) SetColor(i, 0, 0, (i - 128)); // mavi for(i = 192; i <= 255; i++) SetColor(i, (i - 192), (i - 192), (i - 192)); // gri

// Ekrana birkaç örnek nokta bas Plot(30, 40, 234); // Birinci kullanım biçimi Plot(&myPoint1, 60); // İkinci kullanım biçimi Plot(&myPoint2, 92); Plot(&POINT2D(40, 30), 182); // Üçüncü kullanım biçimi

// Ekrana birkaç örnek çizgi çek // Çizgilerin başlangıç ve bitişlerini plot ile işaretle

// Çizgi 1 myPoint1.setX(80); myPoint1.setY(150); myPoint2.setX(213); myPoint2.setY(48); DrawLine(&myPoint1, &myPoint2, 63); Plot(&myPoint1, 255); Plot(&myPoint2, 255);

// Çizgi 2 myPoint1.setX(80); myPoint1.setY(48); myPoint2.setX(213); myPoint2.setY(150); DrawLine(&myPoint1, &myPoint2, 63); Plot(&myPoint1, 255);

Klavyeyle gezinmek için ← ve → tuşları.