

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Programación en VGA modo 13h para computador
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


void bressenham (left, top, right, bottom) inicio int dx, dy, temp, y_sign, x_sign, x, y, flag dx = abs (right - left) dy = abs (bottom - top) si (((dx >= dy) y (left > right)) o ((dy > dx) y (top > bottom))) inicio temp = left left = right right = temp temp = top top = bottom bottom = temp fin si ((bottom - top) < 0) y_sign = - si no y_sign = 1 si ((right - left) < 0) x_sign = - si no x_sign = 1 si (dx >= dy) inicio x = left y = top flag = 0 mientras x <= right inicio si (flag >= dx) inicio flag -= dx y = y + y_sign fin putPixel (g, x, y); x = x + 1 flag = flag + dy fin /* --- fin del mientras --- / fin / --- fin del si --- */ si no inicio x = left y = top flag = mientras y <= bottom inicio si flag >= dy inicio
flag = flag - dy x = x + x_sign fin putPixel (g, x, y); y = y + 1 flag = flag + dx fin /* --- fin del mientras --- / fin / --- fin del si --- / fin / --- fin del metodo --- */