Ejemplo n.º 1
0
    def render_from_z_mask(z_buf_mask, context):
        z_buf_mask = convert_deep_to_alpha(z_buf_mask)
        # рисовать
        qp = QPainter()
        picture = QPicture()

        qp.begin(picture)
        for x in range(len(z_buf_mask)):
            for y in range(len(z_buf_mask[0])):

                # a = color_mask[x][y]
                a = QColor(Qt.black)
                a.setAlpha(z_buf_mask[x][y])

                qp.setPen(a)
                qp.drawPoint(x, y)
        qp.end()  # painting done
        picture.save("drawing.pic")  # save picture

        picture = QPicture()
        picture.load("drawing.pic")  # load picture
        qp = QPainter()
        qp.begin(context)  # paint in myImage
        qp.drawPicture(0, 0, picture)  # draw the picture at (0,0)
        qp.end()
Ejemplo n.º 2
0
    def render_from_color_mask(color_mask, context):
        qp = QPainter()
        picture = QPicture()

        qp.begin(picture)
        for x in range(len(color_mask)):
            for y in range(len(color_mask[0])):

                a = color_mask[x][y]
                qp.setPen(a)
                qp.drawPoint(x, y)
        qp.end()  # painting done
        picture.save("drawing.pic")  # save picture

        picture = QPicture()
        picture.load("drawing.pic")  # load picture
        qp = QPainter()
        qp.begin(context)  # paint in myImage
        qp.drawPicture(0, 0, picture)  # draw the picture at (0,0)
        qp.end()