我们从Python开源项目中,提取了以下19个代码示例,用于说明如何使用PyQt5.QtGui.qRgb()。
def render_img(self, buf, addr, mouse_offs): colors = [] start = addr end = start + len(buf) ea = start col1 = qRgb(0xDC, 0xDC, 0xDC) col2 = qRgb(0x00, 0x00, 0x00) cols = [col1, col2] pos = 0 head = get_item_head(start) sz = get_item_size(start) if head < start: sz -= (start - head) while ea < end: for i in xrange(sz): colors.append(copy(cols[pos])) pos = (pos + 1) % len(cols) if ea + sz > end: sz = ea + sz - end ea += sz sz = get_item_size(ea) return colors
def rgbFromWaveLength(self, wave): r = 0.0 g = 0.0 b = 0.0 if wave >= 380.0 and wave <= 440.0: r = -1.0 * (wave - 440.0) / (440.0 - 380.0) b = 1.0 elif wave >= 440.0 and wave <= 490.0: g = (wave - 440.0) / (490.0 - 440.0) b = 1.0 elif wave >= 490.0 and wave <= 510.0: g = 1.0 b = -1.0 * (wave - 510.0) / (510.0 - 490.0) elif wave >= 510.0 and wave <= 580.0: r = (wave - 510.0) / (580.0 - 510.0) g = 1.0 elif wave >= 580.0 and wave <= 645.0: r = 1.0 g = -1.0 * (wave - 645.0) / (645.0 - 580.0) elif wave >= 645.0 and wave <= 780.0: r = 1.0 s = 1.0 if wave > 700.0: s = 0.3 + 0.7 * (780.0 - wave) / (780.0 - 700.0) elif wave < 420.0: s = 0.3 + 0.7 * (wave - 380.0) / (420.0 - 380.0) r = pow(r * s, 0.8) g = pow(g * s, 0.8) b = pow(b * s, 0.8) return qRgb(r*255, g*255, b*255)
def clearImage(self): self.image.fill(qRgb(255, 255, 255)) self.modified = True self.update()
def resizeImage(self, image, newSize): if image.size() == newSize: return newImage = QImage(newSize, QImage.Format_RGB32) newImage.fill(qRgb(255, 255, 255)) painter = QPainter(newImage) painter.drawImage(QPoint(0, 0), image) self.image = newImage
def render_img(self, buf, addr, mouse_offs): colors = [] self._update_key(buf) for c in buf: c = (ord(c) ^ self.key) & 0xFF colors.append(qRgb(c, 0, c)) return colors
def render_img(self, buf, addr, mouse_offs): colors = [] xrefs = [] for i in xrange(len(buf)): xrefs.append(self.xrefcount(addr + i)) if xrefs: minimum, maximum = min(xrefs), max(xrefs) for count in xrefs: r, g, b = self.hm(minimum, maximum, count) colors.append(qRgb(r, g, b)) return colors
def render_img(self, buf, addr, mouse_offs): colors = [] for c in buf: c = (ord(c) ^ self.key) & 0xFF colors.append(qRgb(0, c, c)) return colors
def render_img(self, buf, addr, mouse_offs): #Bit 7 6 5 4 3 2 1 0 #Data R R R G G G B B colors = [] for c in buf: c = ord(c) red = c & 0xE0 green = (c << 3) & 0xE0 blue = (c << 6) & 0xC0 colors.append(qRgb(red, green, blue)) return colors
def render_img(self, buf, addr, mouse_offs): #Bit 7 6 5 4 3 2 1 0 #Data R R R G G G B B colors = [] for c in buf: c = ord(c) red = c & 0xE0 green = (c << 3) & 0xE0 blue = (c << 6) & 0xC0 gray = red * 0.3 + green * 0.59 + blue * 0.11 colors.append(qRgb(gray, gray, gray)) return colors
def render_img(self, buf, addr, mouse_offs): colors = [] head = ida_idaapi.BADADDR tail = ida_idaapi.BADADDR if mouse_offs is not None: if self.switch == 0: # data head = get_item_head(addr + mouse_offs) tail = get_item_end(addr + mouse_offs) else: # code f = get_func(addr + mouse_offs) if f: head = f.startEA tail = f.endEA for pos in xrange(len(buf)): c = ord(buf[pos]) & 0xFF highlight = False if mouse_offs is not None: if addr + pos >= head and addr + pos < tail: highlight = True if highlight: colors.append(qRgb(c, 0xFF, self.hl_color)) else: colors.append(qRgb(c, 0, 0)) return colors
def render_img(self, buf, addr, mouse_offs): colors = [] for c in buf: c = ord(c) & 0xFF r, g, b = self.hm(c) colors.append(qRgb(r, g, b)) return colors
def render_img(self, buf, addr, mouse_offs): colors = [] for offs in xrange(len(buf)): r = g = b = 0 c = ord(buf[offs]) & 0xFF ea = addr + offs f = get_func(ea) if f: g = b = c elif self._is_string(ea): g = c else: r = g = b = c colors.append(qRgb(r, g, b)) return colors
def blend_colors(color1, color2, ratio): return QtGui.qRgb( color1.red() * (1 - ratio) + color2.red() * ratio, color1.green() * (1 - ratio) + color2.green() * ratio, color1.blue() * (1 - ratio) + color2.blue() * ratio)