Question: The purpose is to complete the Python class graphics Window found in file graphics Window.py. You are asked to program a method drawLine(p1,p2.color) that draws

 The purpose is to complete the Python class graphics Window found

The purpose is to complete the Python class graphics Window found in file graphics Window.py. You are asked to program a method drawLine(p1,p2.color) that draws a line in the image from point p1 to point p2 with color color. The points p1 and p2 are expressed as matrices (x, y) (column vectors). The color is a tuple of the form (r,g,b), where r,g,b are values between 0 and 255. The method drawLine(p1,p2 color) must implement Bresenham's integer line drawing algorithm correctly, for lines of all slopes, and be properly documented (Header comments: description of parameters, what the method does, and description of output. Code comments: description of non-obvious sections of code). The class graphics Window is available in the Resources Section of OWL, under Python Programs Do not change file name nor the actual name of the graphics Window class Make sure your method drawLine(p1,p2color) is actually called drawLine Respect the type and order of the parameters Use the program testAssignment1.py to test drawLine(p1, p2, color). This program is available in the Resources Section of OWL, under Python Programs The output of the test program should correspond exactly to the image assig rent1Image.png. This image is available in the Resources Section of OWL, under Python Programs Use OWL to submit the file graphics Window.py, containing your methoddrawLine(p1.p2,color) #graphics Windows.py import operator from PIL import Image class graphics Window: 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 draw Point(self, point,color): if 0

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!