Python PyQt4.QtGui 模块,qRgba() 实例源码

我们从Python开源项目中,提取了以下13个代码示例,用于说明如何使用PyQt4.QtGui.qRgba()

项目:Danganronpa-Tools    作者:BlackDragonHunt    | 项目源码 | 文件源码
def convert_shtx_4bit(data):

  width  = to_u16(data[0:2])
  height = to_u16(data[2:4])
  unk    = data[4:12]
  p      = 12

  palette = []

  for i in range(16):
    palette.append(qRgba(data[p], data[p + 1], data[p + 2], data[p + 3]))
    p += 4

  pixels = data[p : p + (width * height / 2)]
  pixels2 = bytearray()

  for b in pixels:
    pixels2.append(b & 0x0F)
    pixels2.append(b >> 4)

  img = QImage(pixels2, width, height, QImage.Format_Indexed8)
  img.setColorTable(palette)

  return img
项目:imagepaste    作者:robinchenyu    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)


# :param im A PIL Image object, or a file name
# (given either as Python string or a PyQt string object)
项目:Projects    作者:it2school    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)
项目:workflows.kyoyue    作者:wizyoung    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)
项目:radar    作者:amoose136    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)


# :param im A PIL Image object, or a file name
# (given either as Python string or a PyQt string object)
项目:WXBotForPi    作者:nemoTyrant    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)


# :param im A PIL Image object, or a file name
# (given either as Python string or a PyQt string object)
项目:aws_lambda_backup_s3    作者:ogckw    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)
项目:teleport    作者:eomsoft    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)


# :param im A PIL Image object, or a file name
# (given either as Python string or a PyQt string object)
项目:teleport    作者:eomsoft    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)


# :param im A PIL Image object, or a file name
# (given either as Python string or a PyQt string object)
项目:face_rekognition    作者:cnidus    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)
项目:alfred-image-utilities    作者:danielecook    | 项目源码 | 文件源码
def rgb(r, g, b, a=255):
    """(Internal) Turns an RGB color into a Qt compatible color integer."""
    # use qRgb to pack the colors, and then turn the resulting long
    # into a negative integer with the same bitpattern.
    return (qRgba(r, g, b, a) & 0xffffffff)
项目:Danganronpa-Tools    作者:BlackDragonHunt    | 项目源码 | 文件源码
def convert_shtx_8bit(data):

  width  = to_u16(data[0:2])
  height = to_u16(data[2:4])
  unk    = to_u16(data[4:6])
  p      = 6

  palette = []

  for i in range(256):
    palette.append(qRgba(data[p], data[p + 1], data[p + 2], data[p + 3]))
    p += 4

  # For some reason, a couple images have blank palettes and are actually RGBA images.
  if not palette == [0L] * 256:

    pixels = data[p : p + (width * height)]

    img = QImage(pixels, width, height, QImage.Format_Indexed8)
    img.setColorTable(palette)

  else:

    pixels = data[p:]
    height = len(pixels) / width / 4

    img = QImage(pixels, width, height, QImage.Format_ARGB32)

  return img