Advertisement
davide1409

diag45

Dec 24th, 2019
573
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. def diag45(pict,x,y,c):
  2. #@param pict: Picture
  3. #@param x: int
  4. #@param y: int
  5. #@param c: color
  6.  
  7.   w,h = getWidth(pict)-1, getHeight(pict)-1
  8.   if x<0 or x>=w or y<0 or y>=h:
  9.     return
  10.  
  11.   else:
  12.     iter = min(w-x,h-y)
  13.     px = getPixel(pict,x,y)
  14.     setColor(px,c)
  15.    
  16.     for i in range(iter):
  17.       x+=1
  18.       y+=1
  19.       px = getPixel(pict,x,y)
  20.       setColor(px,c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement