久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    • <bdo id='fLm8f'></bdo><ul id='fLm8f'></ul>
  • <i id='fLm8f'><tr id='fLm8f'><dt id='fLm8f'><q id='fLm8f'><span id='fLm8f'><b id='fLm8f'><form id='fLm8f'><ins id='fLm8f'></ins><ul id='fLm8f'></ul><sub id='fLm8f'></sub></form><legend id='fLm8f'></legend><bdo id='fLm8f'><pre id='fLm8f'><center id='fLm8f'></center></pre></bdo></b><th id='fLm8f'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='fLm8f'><tfoot id='fLm8f'></tfoot><dl id='fLm8f'><fieldset id='fLm8f'></fieldset></dl></div>

    <small id='fLm8f'></small><noframes id='fLm8f'>

  • <legend id='fLm8f'><style id='fLm8f'><dir id='fLm8f'><q id='fLm8f'></q></dir></style></legend>

      <tfoot id='fLm8f'></tfoot>

        如何渲染 QGraphicsScene 的一部分并將其保存為圖像

        How to render a part of QGraphicsScene and save It as image file PyQt5(如何渲染 QGraphicsScene 的一部分并將其保存為圖像文件 PyQt5)

        <small id='j32kV'></small><noframes id='j32kV'>

          <tbody id='j32kV'></tbody>

        <i id='j32kV'><tr id='j32kV'><dt id='j32kV'><q id='j32kV'><span id='j32kV'><b id='j32kV'><form id='j32kV'><ins id='j32kV'></ins><ul id='j32kV'></ul><sub id='j32kV'></sub></form><legend id='j32kV'></legend><bdo id='j32kV'><pre id='j32kV'><center id='j32kV'></center></pre></bdo></b><th id='j32kV'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='j32kV'><tfoot id='j32kV'></tfoot><dl id='j32kV'><fieldset id='j32kV'></fieldset></dl></div>
        • <bdo id='j32kV'></bdo><ul id='j32kV'></ul>
          <legend id='j32kV'><style id='j32kV'><dir id='j32kV'><q id='j32kV'></q></dir></style></legend>
        • <tfoot id='j32kV'></tfoot>

                • 本文介紹了如何渲染 QGraphicsScene 的一部分并將其保存為圖像文件 PyQt5的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  假設我有來自加載圖像的 QGraphicsPixmapItem,它被添加到 QGraphicsScene.假設我將在場景中添加幾個 QGraphicsPolygonItem.如何將場景的一部分渲染為全尺寸圖像,同時使用不在空白區域中的多邊形保存該區域作為圖像文件.

                  Suppose I have QGraphicsPixmapItem from loaded image which is added to QGraphicsScene. And suppose I'll add several QGraphicsPolygonItem's on scene. How I can render a part of the scene as full-size image both with polygons that are not in blank area and save this area as image file.

                  class ImageView(QtWidgets.QGraphicsView):
                  
                      def __init__(self, parent):
                          super(ImageView, self).__init__(parent)
                          self.setFocus()
                          self._zoom = 0
                          self._empty = True
                          self.scene = QtWidgets.QGraphicsScene(self)
                          self._image = QGraphicsPixmapItem()
                          self.scene.addItem(self._image)
                          self.setScene(self.scene)
                  
                          # some other actions
                          foo()
                  
                      def fitInView(self):
                          # custom fit in view and scaling
                          bar()
                  
                  
                      # some other methods
                  
                  class MainWindow(QtWidgets.QWidget):
                      def __init__(self):
                          self.viewer = ImageView(self)
                          foo()
                  
                      def _save_image(self):
                          # method that I need to implement
                          pass
                  

                  推薦答案

                  未經測試,但使用 QGraphicsScene::render 你應該可以做類似...

                  Untested, but using QGraphicsScene::render you should be able to do something like...

                  def _save_image(self):
                  
                      # Get region of scene to capture from somewhere.
                      area = get_QRect_to_capture_from_somewhere()
                  
                      # Create a QImage to render to and fix up a QPainter for it.
                      image = QImage(area.size(), QImage.Format_ARGB32_Premultiplied)
                      painter = QPainter(image)
                  
                      # Render the region of interest to the QImage.
                      self.scene.render(painter, image.rect(), area)
                      painter.end()
                  
                      # Save the image to a file.
                      image.save("capture.png")
                  

                  這篇關于如何渲染 QGraphicsScene 的一部分并將其保存為圖像文件 PyQt5的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)
                    <tfoot id='b5ryj'></tfoot>
                      <bdo id='b5ryj'></bdo><ul id='b5ryj'></ul>
                        <tbody id='b5ryj'></tbody>
                    • <i id='b5ryj'><tr id='b5ryj'><dt id='b5ryj'><q id='b5ryj'><span id='b5ryj'><b id='b5ryj'><form id='b5ryj'><ins id='b5ryj'></ins><ul id='b5ryj'></ul><sub id='b5ryj'></sub></form><legend id='b5ryj'></legend><bdo id='b5ryj'><pre id='b5ryj'><center id='b5ryj'></center></pre></bdo></b><th id='b5ryj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='b5ryj'><tfoot id='b5ryj'></tfoot><dl id='b5ryj'><fieldset id='b5ryj'></fieldset></dl></div>

                            <legend id='b5ryj'><style id='b5ryj'><dir id='b5ryj'><q id='b5ryj'></q></dir></style></legend>

                            <small id='b5ryj'></small><noframes id='b5ryj'>

                          1. 主站蜘蛛池模板: 国产成人高清在线观看 | 国产成人精品久久二区二区91 | 国产综合在线视频 | 久在线精品视频 | 精品久久久久久亚洲精品 | 日日骚av| 欧美a在线 | 日韩中文字幕一区 | 女人牲交视频一级毛片 | 精品欧美一区二区三区久久久小说 | 国产黑丝在线 | 日韩欧美二区 | 成人不卡| 欧美一区视频 | 亚洲人a | 2018天天干天天操 | 最新伦理片| 久久久久99 | 伊人激情综合网 | 欧美xxxx性xxxxx高清 | 亚洲精品自在在线观看 | 一区二区三区在线免费观看 | 欧美区在线观看 | 国产一区二区三区在线看 | 久久综合九色综合欧美狠狠 | 久久国产成人午夜av影院武则天 | 精品久久久久久久久久久院品网 | 日韩欧美国产不卡 | 久久久看 | www.99热 | 亚洲一区免费视频 | 在线视频日韩 | 欧美8一10sex性hd | 久久精品无码一区二区三区 | 久久久xx | 在线播放中文字幕 | 免费观看的av毛片的网站 | 国产高清精品在线 | 久久99精品国产99久久6男男 | 人人擦人人 | 午夜日韩精品 |