suzan alamassy 0 Newbie Poster

please i want help :
i want rotate picture in (90) , (180) , (270) or any degress using this function ::

def rotating ( picture ,pict ) :
# we have to pick to picture and then put them as parameter in th function :
pic=makePicture(picture)
canvas=makePicture( pict )
# Now, do the actual copying
targetX = 0
width = getWidth(pic)
for sourceX in range(0,getWidth(pic)):
targetY = 0
for sourceY in range(0,getHeight(pic)):
color = getColor(getPixel(pic,sourceX,sourceY))
# here we do actual rotating :
setColor(getPixel(canvas,targetY,width - targetX - 1), color)
targetY = targetY + 1
targetX = targetX + 1
show(pic)
show(canvas)
return canvas


----->this function rotate picture (90) degress


def rotating2 ( picture ,pict ) :
# we have to pick to picture and then put them as parameter in th function :
pic=makePicture(picture)
canvas=makePicture( pict )
# Now, do the actual copying
targetX = 0
height = getHeight(pic)
for sourceX in range(0,getWidth(pic)):
targetY = 0
for sourceY in range(0,getHeight(pic)):
color = getColor(getPixel(pic,sourceX,sourceY))
# here we do actual rotating :
setColor(getPixel(canvas,height-targetY-1,targetX), color)
targetY = targetY + 1
targetX = targetX + 1
show(pic)
show(canvas)
return canvas

----->this function rotate picture (270) degress


Q : how can i rotate picture (180) and anther degress in JYTHON ??!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.