本文整理汇总了Python中PySide.QtGui.QImage.bits方法的典型用法代码示例。如果您正苦于以下问题:Python QImage.bits方法的具体用法?Python QImage.bits怎么用?Python QImage.bits使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QImage
的用法示例。
在下文中一共展示了QImage.bits方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_metallic_roughness_map
# 需要导入模块: from PySide.QtGui import QImage [as 别名]
# 或者: from PySide.QtGui.QImage import bits [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: end_adding
# 需要导入模块: from PySide.QtGui import QImage [as 别名]
# 或者: from PySide.QtGui.QImage import bits [as 别名]
def end_adding(self, gl):
self.texture.bind(gl)
'''
IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT
The image has to be mirrored for some reason
'''
img = QImage(self.bitmap.toImage()).mirrored()
img = QGLWidget.convertToGLFormat(img)
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGB, img.width(), img.height(), 0, gl.GL_RGBA,
gl.GL_UNSIGNED_BYTE, str(img.bits()))
# This particular bitmap is no longer needed
self.bitmap = None
示例3: create_texture_from_resource
# 需要导入模块: from PySide.QtGui import QImage [as 别名]
# 或者: from PySide.QtGui.QImage import bits [as 别名]
def create_texture_from_resource(self, gl, resource_id):
'''
Unlike the original java source, convertToGLFormat is used
'''
text = self.create_texture_internal(gl)
img = QImage("assets/drawable/" + self.images[resource_id] + ".png")
img = QGLWidget.convertToGLFormat(img)
text.bind(gl)
gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR);
gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR);
gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_S, gl.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_WRAP_T, gl.GL_CLAMP_TO_EDGE);
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGB, img.width(), img.height(), 0, gl.GL_RGBA,
gl.GL_UNSIGNED_BYTE, str(img.bits()))
return text