当前位置: 首页>>代码示例>>Python>>正文


Python Color.get_rgb方法代码示例

本文整理汇总了Python中colour.Color.get_rgb方法的典型用法代码示例。如果您正苦于以下问题:Python Color.get_rgb方法的具体用法?Python Color.get_rgb怎么用?Python Color.get_rgb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在colour.Color的用法示例。


在下文中一共展示了Color.get_rgb方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_points

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import get_rgb [as 别名]
 def add_points(self, points, rgbs = None, color = None):
     """
     points must be a Nx3 numpy array, as must rgbs if it is not None
     """
     if not isinstance(points, np.ndarray):
         points = np.array(points)
     num_new_points = points.shape[0]
     self.points = np.append(self.points, points, axis = 0)
     if rgbs is None:
         color = Color(color) if color else self.color
         rgbs = np.array([color.get_rgb()] * num_new_points)
     elif rgbs.shape != points.shape:
         raise Exception("points and rgbs must have same shape")
     self.rgbs = np.append(self.rgbs, rgbs, axis = 0)
     if self.has_normals:
         self.unit_normals = np.append(
             self.unit_normals,
             np.apply_along_axis(self.unit_normal, 1, points),
             axis = 0
         )
     return self
开发者ID:mherkazandjian,项目名称:manim,代码行数:23,代码来源:mobject.py

示例2: add_points

# 需要导入模块: from colour import Color [as 别名]
# 或者: from colour.Color import get_rgb [as 别名]
 def add_points(self, points, rgbs = None, color = None):
     """
     points must be a Nx3 numpy array, as must rgbs if it is not None
     """
     points = np.array(points)
     num_new_points = points.shape[0]
     self.points = np.append(self.points, points)
     self.points = self.points.reshape((self.points.size / 3, 3))
     if rgbs is None:
         color = Color(color) if color else self.color
         rgbs = np.array([color.get_rgb()] * num_new_points)
     else:
         if rgbs.shape != points.shape:
             raise Exception("points and rgbs must have same shape")
     self.rgbs = np.append(self.rgbs, rgbs)
     self.rgbs = self.rgbs.reshape((self.rgbs.size / 3, 3))
     if self.has_normals:
         self.unit_normals = np.append(
             self.unit_normals,
             np.array([self.unit_normal(point) for point in points])
         ).reshape(self.points.shape)
     return self
开发者ID:nachinius,项目名称:animations,代码行数:24,代码来源:mobject.py


注:本文中的colour.Color.get_rgb方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。