Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 tgraphicsWindow.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 implementresult as following
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started