Picture Construction Techniques in Computer Graphics

Picture Construction Techniques:

Freehand Drawing Algorithm:

Left-click the mouse in the work area for the first point
GetMousePosition(button, x, y)
previous-x=x
previous-y=y
while the left button down
GetMousePosition(button, x, y)
If x is not equal to previous-x or y is not equal to previous-y then
Draw Line(previous-x, previous-y, x, y) using Bresenham’s algorithm
previous-x=x
previous-y=y
end if
end while

Brush Drawing Algorithm:
Left-click the mouse to select the first point, say p1=(x1, y1)
While left button down
GetMousePosition(button, x, y)
x2=x
y2=y
for each point (xk, yk) in the traced line
Draw circle with radius = n pixels and centre = (xk, yk) with
current Forecolor and fill the circle with the current Forecolor.
x1=x2
y1=y2
end while