Programación en VGA modo 13h, Exercises of Computer science

Programación en VGA modo 13h para computador

Typology: Exercises

2020/2021

Uploaded on 02/22/2021

francisco-aranda-landa
francisco-aranda-landa 🇲🇷

2 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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 = -1
si no
y_sign = 1
si ((right - left) < 0)
x_sign = -1
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 =0
mientras y <= bottom
inicio
si flag >= dy
inicio
pf2

Partial preview of the text

Download Programación en VGA modo 13h and more Exercises Computer science in PDF only on Docsity!

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 --- */