Skip to content

Commit 5dc5482

Browse files
authored
New anti aliasing feature
1 parent 4ff48f1 commit 5dc5482

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

img_to_thread.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def getLine(self, start, end):
2929
p0 = self.nailToCoordinate(start)
3030
p1 = self.nailToCoordinate(end)
3131
sum = [0.0, 0.1]
32-
def pixel(img, p, color, alpha_correction, transparency):
32+
def pixel(img, p, color, transparency):
3333
sum[0] += transparency*img.getpixel(p)
3434
sum[1] += transparency
35-
self.bresenham(p0, p1, function=pixel)
35+
self.bresenham(p0, p1, 20, 1,pixel)
3636
return sum[0]/sum[1]
3737

3838
def drawLine(self, start, end, color=20, alpha_correction=1, function=None):
@@ -56,8 +56,8 @@ def invert(self):
5656
self.image = ImageOps.invert(self.image)
5757

5858
def bresenham(self, p0, p1, color=20, transparency=1, function=None):
59-
pass # implement anti aliasing of task 1 here
59+
pass # Implement anti aliasing
6060

6161
def printOperations(self, file=None):
62-
pass # first output number of nails then each in a new line the start and end nail of a line seperated by a " "
63-
62+
pass # the first line should contain the number of nails
63+
# The other line should be start_nail whitespace end_nail of a line

0 commit comments

Comments
 (0)