Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def mixer(p1,p2,k):
- #@param p1: picture
- #@param p2:picture
- #@param k:int
- canvas= makeEmptyPicture(getHeight(p1),getWidth(p2),white)
- c=copy(p1,p2,canvas)
- for cont in range(0,k):
- for sourcex in range (0,getWidth(p2)):
- targetx=sourcex
- for sourcey in range (0,getHeight(p2)):
- targety=sourcey
- px1=getPixel(p1,targetx,targety)
- px2=getPixel(p2,targetx,targety)
- pc=getPixel(c,targetx,targety)
- setRed=(pc,(getRed(pc)+((getRed(px1)-getRed(px2))/k)))
- setGreen=(pc,(getGreen(pc)+((getGreen(px1)-getGreen(px2))/k)))
- setBlue=(pc,(getBlue(pc)+((getBlue(px1)-getBlue(px2))/k)))
- repaint(c)
- def copy(p1,p2,canvas):
- #paramp1:picture
- #paramp2:picture
- #param canvas :picture
- #return: pict
- for sourcex in range (0,getWidth(p2)):
- targetx=sourcex
- for sourcey in range (0, getHeight(p2)):
- targety=sourcey
- color=getColor(getPixel(p2,sourcex,sourcey))
- setColor(getPixel(canvas,targetx,targety),color)
- return canvas
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement