本文整理汇总了Python中PySide.QtGui.QColor.rgb方法的典型用法代码示例。如果您正苦于以下问题:Python QColor.rgb方法的具体用法?Python QColor.rgb怎么用?Python QColor.rgb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QColor
的用法示例。
在下文中一共展示了QColor.rgb方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_metallic_roughness_map
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import rgb [as 别名]
def _create_metallic_roughness_map(self, metal_map, rough_map):
metal = QImage(metal_map)
rough = QImage(rough_map)
metal_pixel = QColor()
metal = metal.convertToFormat(QImage.Format_RGB32);
rough = rough.convertToFormat(QImage.Format_RGB32);
metal_uchar_ptr = metal.bits()
rough_uchar_ptr = rough.bits()
if (not metal.width() == rough.width()
or not metal.height() == rough.height()):
raise RuntimeError("Error processing material: {}. Metallic map and roughness map must have same dimensions.".format(self.maya_node))
width = metal.width();
height = metal.height();
i = 0
for y in range(height):
for x in range(width):
metal_color = struct.unpack('I', metal_uchar_ptr[i:i+4])[0]
rough_color = struct.unpack('I', rough_uchar_ptr[i:i+4])[0]
metal_pixel.setRgb(0, qGreen(rough_color), qBlue(metal_color))
metal_uchar_ptr[i:i+4] = struct.pack('I', metal_pixel.rgb())
i+=4
output = ExportSettings.out_dir + "/"+self.name+"_metalRough.jpg"
return output, metal
示例2: paint
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import rgb [as 别名]
def paint(self, canvas, is_secondary_color=False, additional_flag=False):
if is_secondary_color:
switch_color = self.data_singleton.secondary_color
else:
switch_color = self.data_singleton.primary_color
# TODO: не заливает, если кликать на transparent фон
x, y = self._start_point.x(), self._start_point.y()
pixel = canvas.image.pixel(x, y)
old_color = QColor(pixel)
if switch_color != old_color:
self.fill_recurs(x, y, switch_color.rgb(), old_color.rgb(), canvas.image)
canvas.edited = True
canvas.update()