本文整理汇总了Python中picture.Picture.getPixelGreen方法的典型用法代码示例。如果您正苦于以下问题:Python Picture.getPixelGreen方法的具体用法?Python Picture.getPixelGreen怎么用?Python Picture.getPixelGreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类picture.Picture
的用法示例。
在下文中一共展示了Picture.getPixelGreen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: flipHorizontally
# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import getPixelGreen [as 别名]
def flipHorizontally(canvas):
w = canvas.getWidth()
h = canvas.getHeight()
new_canvas = Picture((w,h))
canvas.close()
for i in range(0,w):
for j in range(0,h):
r = canvas.getPixelRed(w-1-i,j)
g = canvas.getPixelGreen(w-1-i,j)
b = canvas.getPixelBlue(w-1-i,j)
new_canvas.setPixelColor(i,j,r,g,b)
for i in range(0,w):
for j in range(0,h):
r = new_canvas.getPixelRed(i,j)
g = new_canvas.getPixelGreen(i,j)
b = new_canvas.getPixelBlue(i,j)
canvas.setPixelColor(i,j,r,g,b)
return canvas