Bu sayfadaki yazılar
Sayfanın metni
Sayfa 151
{ x--; a -= x; } }
// İkinci yarıyı çiz x = 0; y = r; a = 0; while(y >= x) { Plot(cx + x, cy + y, color); Plot(cx + x, cy - y, color); Plot(cx - x, cy + y, color); Plot(cx - x, cy - y, color); x++; a += x; if(a > y) { y--; a -= y; } } }
/** * Name : DrawCircle * Desc : Overloaded DrawCircle fonksiyonu. (x1,y1) yerine POINT2D * sınıfından bir değişken kullanılır. * Input : (POINT2D *)p2dPoint * (int)r * (unsigned char)color */ void DrawCircle(POINT2D *p2dPoint, int r, unsigned char color) { DrawCircle(p2dPoint->getX(), p2dPoint->getY(), r, color); }
/** * Name : FillRectangle * Desc : Parametreden gelen (x1,y1)-(x2,y2) koordinatları arasına * içi dolu dikdörtgen çeker. 'a ihtiyaç duymaz. * Input : (int)x1 * (int)y1 * (int)x2 * (int)y2 * (unsigned char)color */ void FillRectangle(int x1, int y1, int x2, int y2, unsigned char color) { int x, y; if(y1 < y2) { for(y = y1; y <= y2; y++) { if(x1 < x2) { for(x = x1; x <= x2; x++) Plot(x, y, color); } else { for(x = x2; x <= x1; x++) Plot(x, y, color); }
Klavyeyle gezinmek için ← ve → tuşları.
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)