python类qRgb()的实例源码

itemlen.py 文件源码 项目:IDACyber 作者: patois 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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
mandelbrot.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
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)
scribble.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def clearImage(self):
        self.image.fill(qRgb(255, 255, 255))
        self.modified = True
        self.update()
scribble.py 文件源码 项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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
mandelbrot.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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)
scribble.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def clearImage(self):
        self.image.fill(qRgb(255, 255, 255))
        self.modified = True
        self.update()
scribble.py 文件源码 项目:examples 作者: pyqt 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
autoxor.py 文件源码 项目:IDACyber 作者: patois 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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
xrefsto.py 文件源码 项目:IDACyber 作者: patois 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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
xor.py 文件源码 项目:IDACyber 作者: patois 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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
NES.py 文件源码 项目:IDACyber 作者: patois 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
GameBoy.py 文件源码 项目:IDACyber 作者: patois 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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
crawl.py 文件源码 项目:IDACyber 作者: patois 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
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
heatmap.py 文件源码 项目:IDACyber 作者: patois 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
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
mountain.py 文件源码 项目:IDACyber 作者: patois 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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
util.py 文件源码 项目:bubblesub 作者: rr- 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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)
mandelbrot.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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)
scribble.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def clearImage(self):
        self.image.fill(qRgb(255, 255, 255))
        self.modified = True
        self.update()
scribble.py 文件源码 项目:pyqt5-example 作者: guinslym 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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


问题


面经


文章

微信
公众号

扫码关注公众号