Plazma sayı 2, sayfa 150

Bu sayfadaki yazılar

Sayfanın metni

Sayfa 150

Plot(x1, y, color); Plot(x2, y, color); } } else { for(y = y2; y <= y1; y++) { Plot(x1, y, color); Plot(x2, y, color); } } }

/** * Name : DrawRectangle * Desc : Overloaded DrawRectangle fonksiyonu. (x1,y1) ve (x2,y2) yerine * POINT2D sınıfından iki değişken kullanılır. * Input : (POINT2D *)p2dPoint1 * (POINT2D *)p2dPoint2 * (unsigned char)color */ void DrawRectangle(POINT2D *p2dPoint1, POINT2D *p2dPoint2, unsigned char color) { DrawRectangle(p2dPoint1->getX(), p2dPoint1->getY(), p2dPoint2->getX(), p2dPoint2->getY(), color); }

/** * Name : DrawRectangle * Desc : Overloaded DrawRectangle fonksiyonu. (x1,y1) ve (x2,y2) yerine * RECT sınıfından bir değişken kullanılır. * Input : (RECT *)rctRect * (unsigned char)color */ void DrawRectangle(RECT *rctRect, unsigned char color) { DrawRectangle(rctRect->getX1(), rctRect->getY1(), rctRect->getX2(), rctRect->getY2(), color); }

/** * Name : DrawCircle * Desc : Parametreden gelen (x,y) koordinatlarından itibaren r * yarıçaplı çember çizer. Bresenham algoritması kullanır. * 'a ihtiyaç duymaz. * Input : (int)x * (int)y * (int)r * (unsigned char)color */ void DrawCircle(int cx, int cy, int r, unsigned char color) { int x, y, a;

// İlk yarıyı çiz x = r; y = 0; a = 0; while(x >= y) { Plot(cx + x, cy + y, color); Plot(cx + x, cy - y, color); Plot(cx - x, cy + y, color); Plot(cx - x, cy - y, color); y++; a += y; if(a > x)

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