Advertisement
MaxDvc

diagonal

Dec 13th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. def diagonal(pict,x,y,color):
  2. #@param:
  3. #   pict: picture;
  4. #   x: int, starting x coordinate;
  5. #   y: int, starting y coordinate;
  6. #   color: color;
  7.     width = getWidth(pict)
  8.     height = getHeight(pict)
  9.     assert x<width and y<height and x>=0 and y>=0, "Invalid parameters, x or y is smaller than 0 or bigger than picture size."
  10.     i = 0
  11.     while i<width-x and i<height-y:
  12.         pix = getPixel(pict,x+i,y+i)
  13.         setColor(pix,color)
  14.         i +=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement