benoitxt.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:ftcommunity-apps 作者: ftCommunity 项目源码 文件源码
def mand2pixmap(self,width:int,height:int, mand, maxiter:int, pixmap, progress, e):
        pen=[]
        pen.append(qRgb(0,0,0))
        maxcol=len(colormap)
        for i in range(maxcol):
            (r,g,b)=colormap[(i+self.coffset)%maxcol]
            pen.append(qRgb(r,g,b))


        z = np.full((width, height),maxcol, dtype=int)

        mand2 = np.remainder(mand, z)
        mand2[mand==0]=-1
        mand2 = np.add(mand2, np.ones((width, height), int))

        st=100/height
        im=QImage(height, width, QImage.Format_RGB888)
        for j in range(0,height-1,5):
            for i in range(width):
                im.setPixel(height-j-1,width-i-1,pen[mand2[i,j]])
                im.setPixel(height-j-2,width-i-1,pen[mand2[i,j+1]])
                im.setPixel(height-j-3,width-i-1,pen[mand2[i,j+2]])
                im.setPixel(height-j-4,width-i-1,pen[mand2[i,j+3]])
                im.setPixel(height-j-5,width-i-1,pen[mand2[i,j+4]])
            progress.setValue(st*j)
            e.processEvents()
        p = QPainter()
        p.begin(pixmap)
        p.drawImage(QPoint(0,0),im)
        self.bild.update()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号