本文整理汇总了Python中color.Color.to_RGB方法的典型用法代码示例。如果您正苦于以下问题:Python Color.to_RGB方法的具体用法?Python Color.to_RGB怎么用?Python Color.to_RGB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类color.Color
的用法示例。
在下文中一共展示了Color.to_RGB方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compute
# 需要导入模块: from color import Color [as 别名]
# 或者: from color.Color import to_RGB [as 别名]
def compute(self, iterations, screen):
# these are used for calculating the points corresponding to the pixels
xStep = (self.xMax - self.xMin) / (screen.get_width() * 1.0)
yStep = (self.yMax - self.yMin) / (screen.get_height() * 1.0)
x = self.xMin * 1.0
y = self.yMin * 1.0
for i in range(0, screen.get_height()):
for j in range(0, screen.get_width()):
z = 0.0
zi = 0.0
inSet = True
for k in range(0, iterations):
# z^2 = (a+bi)(a+bi) = a^2 + 2abi - b^2
newZ = (z*z) - (zi*zi) + x
newZI = 2*z*zi + y
z = newZ
zi = newZI
if ((z*z) + (zi*zi)) > 4:
inSet = False
colour = k
k = iterations
if inSet:
pygame.draw.line(screen, Color.BLACK, (j,i),(j,i))
else:
pygame.draw.line(screen, Color.to_RGB(colour), (j,i),(j,i))
x += xStep
y += yStep
x = self.xMin