Question: implement Bresenham's integer line drawing algorithm correctly, for lines of all slopes in python as1.py: from math import * from graphicsWindow import graphicsWindow window =

implement Bresenham's integer line drawing algorithm correctly, for lines of all slopes in python

as1.py:

from math import * from graphicsWindow import graphicsWindow window = graphicsWindow(512,512) t = 0.0 dt = 2.0*pi/200.0 color = (255,255,255) while t  

graphicsWindow.py

from PIL import Image class graphicsWindow: def __init__(self,width=640,height=480): self.__mode = 'RGB' self.__width = width self.__height = height self.__canvas = Image.new(self.__mode,(self.__width,self.__height)) self.__image = self.__canvas.load() def getWidth(self): return self.__width def getHeight(self): return self.__height def drawPixel(self,pixel,color): self.__image[pixel[0],pixel[1]] = color def saveImage(self,fileName): self.__canvas.save(fileName)  def drawLine(self,start,end,color):  # this section will be your area to implement

result as following

implement Bresenham's integer line drawing algorithm correctly, for lines of all slopes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!