<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # QPixmap Class Reference ## [[QtGui](index.htm) module] 本的QPixmap類是可用于作為涂料設備離屏圖像表示。[More...](#details) 繼承[QPaintDevice](qpaintdevice.html)。 通過繼承[QBitmap](qbitmap.html)。 ### Types * `enum ShareMode { ImplicitlyShared, ExplicitlyShared }` ### Methods * `__init__ (self)` * `__init__ (self, int?w, int?h)` * `__init__ (self, QSize)` * `__init__ (self, QString?fileName, str?format?=?None, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)` * `__init__ (self, list-of-str?xpm)` * `__init__ (self, QPixmap)` * `__init__ (self, QVariant?variant)` * `QPixmap alphaChannel (self)` * `int cacheKey (self)` * `bool convertFromImage (self, QImage?img, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)` * `QPixmap copy (self, QRect?rect?=?QRect())` * `QPixmap copy (self, int?ax, int?ay, int?awidth, int?aheight)` * `QBitmap createHeuristicMask (self, bool?clipTight?=?True)` * `QBitmap createMaskFromColor (self, QColor?maskColor, Qt.MaskMode?mode)` * `QBitmap createMaskFromColor (self, QColor?maskColor)` * `int depth (self)` * `detach (self)` * `int devType (self)` * `fill (self, QColor?color?=?Qt.white)` * `fill (self, QWidget?widget, QPoint?ofs)` * `fill (self, QWidget?widget, int?xofs, int?yofs)` * `int handle (self)` * `bool hasAlpha (self)` * `bool hasAlphaChannel (self)` * `int height (self)` * `bool isNull (self)` * `bool isQBitmap (self)` * `bool load (self, QString?fileName, str?format?=?None, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)` * `bool loadFromData (self, str?buf, str?format?=?None, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)` * `bool loadFromData (self, QByteArray?buf, str?format?=?None, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)` * `QBitmap mask (self)` * `int metric (self, QPaintDevice.PaintDeviceMetric)` * `QPaintEngine paintEngine (self)` * `QRect rect (self)` * `bool save (self, QString?fileName, str?format?=?None, int?quality?=?-1)` * `bool save (self, QIODevice?device, str?format?=?None, int?quality?=?-1)` * `QPixmap scaled (self, int?width, int?height, Qt.AspectRatioMode?aspectRatioMode?=?Qt.IgnoreAspectRatio, Qt.TransformationMode?transformMode?=?Qt.FastTransformation)` * `QPixmap scaled (self, QSize?size, Qt.AspectRatioMode?aspectRatioMode?=?Qt.IgnoreAspectRatio, Qt.TransformationMode?transformMode?=?Qt.FastTransformation)` * `QPixmap scaledToHeight (self, int?height, Qt.TransformationMode?mode?=?Qt.FastTransformation)` * `QPixmap scaledToWidth (self, int?width, Qt.TransformationMode?mode?=?Qt.FastTransformation)` * `QRegion?exposed scroll (self, int?dx, int?dy, QRect?rect)` * `QRegion?exposed scroll (self, int?dx, int?dy, int?x, int?y, int?width, int?height)` * `int serialNumber (self)` * `setAlphaChannel (self, QPixmap)` * `setMask (self, QBitmap)` * `QSize size (self)` * `swap (self, QPixmap?other)` * `QImage toImage (self)` * `QPixmap transformed (self, QMatrix?matrix, Qt.TransformationMode?mode?=?Qt.FastTransformation)` * `QPixmap transformed (self, QTransform?transform, Qt.TransformationMode?mode?=?Qt.FastTransformation)` * `int width (self)` * `QX11Info x11Info (self)` * `int x11PictureHandle (self)` ### Static Methods * `int defaultDepth ()` * `QPixmap fromImage (QImage?image, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)` * `QPixmap fromImageReader (QImageReader?imageReader, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)` * `QPixmap fromX11Pixmap (int?pixmap, ShareMode?mode?=?QPixmap.ImplicitlyShared)` * `QPixmap grabWidget (QWidget?widget, QRect?rect)` * `QPixmap grabWidget (QWidget?widget, int?x?=?0, int?y?=?0, int?width?=?-1, int?height?=?-1)` * `QPixmap grabWindow (int?window, int?x?=?0, int?y?=?0, int?width?=?-1, int?height?=?-1)` * `QMatrix trueMatrix (QMatrix?m, int?w, int?h)` * `QTransform trueMatrix (QTransform?m, int?w, int?h)` * * * ## Detailed Description 本的QPixmap類是可用于作為涂料設備離屏圖像表示。 Qt提供了四個類用于處理圖像數據:[QImage](qimage.html), QPixmap的,[QBitmap](qbitmap.html)和[QPicture](qpicture.html)。[QImage](qimage.html)被設計和優化用于I / O ,并直接像素訪問和操作,而QPixmap的設計和用于在屏幕上顯示的圖像進行了優化。[QBitmap](qbitmap.html)只有一個繼承自QPixmap ,確保深度為1一個方便的類。該[isQBitmap](qpixmap.html#isQBitmap)(如果一個物體的QPixmap是一個真正的位圖)函數返回True,否則返回False 。最后,該[QPicture](qpicture.html)類是一個繪圖設備,記錄和重放[QPainter](qpainter.html)的命令。 使用A的QPixmap可以很容易地顯示在屏幕上[QLabel](qlabel.html)或1[QAbstractButton](qabstractbutton.html)的亞類(如[QPushButton](qpushbutton.html)和[QToolButton](qtoolbutton.html)) 。[QLabel](qlabel.html)有一個像素映射屬性,而[QAbstractButton](qabstractbutton.html)有一個icon屬性。 除了普通的構造函數,一個的QPixmap可以使用靜態的構造[grabWidget](qpixmap.html#grabWidget)()和[grabWindow](qpixmap.html#grabWindow)( ),它創建了一個的QPixmap和油漆給定的部件,或窗口,進入它的功能。 的QPixmap對象可以圍繞通過值傳遞,因為的QPixmap類使用隱式數據共享。欲了解更多信息,請參閱[Implicit Data Sharing](index.htm#implicit-data-sharing)文檔。 QPixmap的對象也可以流。 需要注意的是在一個像素圖的像素數據是內部和由基本窗口系統進行管理。因為QPixmap的是[QPaintDevice](qpaintdevice.html)子類,[QPainter](qpainter.html)可用于直接繪制到像素圖。像素只能通過被訪問[QPainter](qpainter.html)功能或通過轉換的QPixmap到[QImage](qimage.html)。然而,本[fill](qpixmap.html#fill)()函數是用于初始化整個像素映像與一個給定的顏色。 有功能之間的轉換[QImage](qimage.html)和QPixmap的。典型地,該[QImage](qimage.html)類是用來加載一個圖像文件,可選操作的圖像數據,前[QImage](qimage.html)對象被轉換成的QPixmap在屏幕上顯示出來。另外,如果沒有操作是理想,圖像文件可以直接加載到的QPixmap 。在Windows上, QPixmap的類還支持之間的轉換`HBITMAP`和QPixmap的。在Symbian中, QPixmap的類還支持的CFbsBitmap和的QPixmap之間的轉換。 的QPixmap提供了可以被用來獲得各種關于像素映像信息的功能的集合。此外,有幾個函數,它使像素映像的轉換。 ### Reading and Writing Image Files 的QPixmap提供了閱讀一個圖像文件幾種方法:該文件可以構建的QPixmap對象時被加載,或者通過使用[load](qpixmap.html#load)()或[loadFromData](qpixmap.html#loadFromData)( )函數以后。當加載一個圖像,文件名可以指在磁盤上的實際文件或應用的嵌入式資源之一。看[The Qt Resource System](index.htm)概述有關如何嵌入在應用程序的可執行映像和其他資源文件的詳細信息。 只需調用[save](qpixmap.html#save)( )函數保存的QPixmap對象。 都可以通過支持的文件格式的完整列表[QImageReader.supportedImageFormats](qimagereader.html#supportedImageFormats)()和[QImageWriter.supportedImageFormats](qimagewriter.html#supportedImageFormats)()函數。新的文件格式可以添加插件。默認情況下, Qt支持以下格式: | Format | Description | Qt's support | | --- | --- | --- | | BMP | Windows Bitmap | Read/write | | GIF | Graphic Interchange Format (optional) | Read | | JPG | Joint Photographic Experts Group | Read/write | | JPEG | Joint Photographic Experts Group | Read/write | | PNG | Portable Network Graphics | Read/write | | PBM | Portable Bitmap | Read | | PGM | Portable Graymap | Read | | PPM | Portable Pixmap | Read/write | | XBM | X11 Bitmap | Read/write | | XPM | X11 Pixmap | Read/write | ### Pixmap Information 的QPixmap提供了可以被用來獲得各種關于像素映像信息的功能的集合: | | Available Functions | | --- | --- | | Geometry | The [size](qpixmap.html#size)(), [width](qpixmap.html#width)() and [height](qpixmap.html#height)() functions provide information about the pixmap's size. The [rect](qpixmap.html#rect)() function returns the image's enclosing rectangle. | | Alpha component | The [hasAlphaChannel](qpixmap.html#hasAlphaChannel)() returns true if the pixmap has a format that respects the alpha channel, otherwise returns false. The [hasAlpha](qpixmap.html#hasAlpha)(), [setMask](qpixmap.html#setMask)() and [mask](qpixmap.html#mask)() functions are legacy and should not be used. They are potentially very slow.該[createHeuristicMask](qpixmap.html#createHeuristicMask)( )函數創建并返回一個1 - BPP啟發式面膜(即[QBitmap](qbitmap.html))這個像素映射。它的工作原理是從一個角選擇一種顏色,然后小打小鬧該顏色的像素,開始在所有的邊緣。該[createMaskFromColor](qpixmap.html#createMaskFromColor)( )函數創建并返回一個掩碼(即一[QBitmap](qbitmap.html)),用于根據一個給定的彩色的像素圖。 | | Low-level information | The [depth](qpixmap.html#depth)() function returns the depth of the pixmap. The [defaultDepth](qpixmap.html#defaultDepth)() function returns the default depth, i.e. the depth used by the application on the given screen.該[cacheKey](qpixmap.html#cacheKey)( )函數返回一個數字,唯一標識的QPixmap對象的內容。該[x11Info](qpixmap.html#x11Info)( )函數返回使用到的像素圖目前屬于屏幕的X顯示的配置信息。該[x11PictureHandle](qpixmap.html#x11PictureHandle)( )函數返回的像素圖的XRender的支持X11的圖片處理。需要注意的是后兩個功能僅適用于X11 。 | ### Pixmap Conversion 一個QPixmap的對象可以被轉換成一個[QImage](qimage.html)使用[toImage](qpixmap.html#toImage)()函數。同樣,一個[QImage](qimage.html)可以使用被轉換成的QPixmap的[fromImage](qpixmap.html#fromImage)( ) 。如果這是過于昂貴的操作,您可以使用[QBitmap.fromImage](qbitmap.html#fromImage)( )來代替。 此外,在Windows上, QPixmap的類支持的轉換和從HBITMAP :在[toWinHBITMAP](qpixmap.html#toWinHBITMAP)()函數創建了一個HBITMAP相當于QPixmap的,根據給定的[HBitmapFormat](qpixmap.html#HBitmapFormat-enum),并返回HBITMAP句柄。該[fromWinHBITMAP](qpixmap.html#fromWinHBITMAP)( )函數返回的QPixmap ,它等效于在給定的位圖具有指定格式。該的QPixmap類還支持轉換和從HICON :在[toWinHICON](qpixmap.html#toWinHICON)( )函數創建一個HICON相當于的QPixmap ,并返回HICON句柄。該[fromWinHICON](qpixmap.html#fromWinHICON)( )函數返回的QPixmap ,等效于給定的圖標。 另外,在Symbian中, QPixmap的類支持的轉換和從CFbsBitmap的方法:在[toSymbianCFbsBitmap](qpixmap.html#toSymbianCFbsBitmap)( )函數創建的CFbsBitmap相當于QPixmap的,根據給定的模式并返回的CFbsBitmap對象。該[fromSymbianCFbsBitmap](qpixmap.html#fromSymbianCFbsBitmap)( )函數返回的QPixmap ,等效于給定的位圖,給定模式。 ### Pixmap Transformations 的QPixmap支持許多函數,用于創建一個新的像素圖,它是原始的轉換后的版本: 該[scaled](qpixmap.html#scaled)( )[scaledToWidth](qpixmap.html#scaledToWidth)()和[scaledToHeight](qpixmap.html#scaledToHeight)( )函數返回的像素圖的縮放復印,而[copy](qpixmap.html#copy)( )函數創建一個QPixmap的是原來的一個普通的副本。 該[transformed](qpixmap.html#transformed)( )函數返回的轉化與給定的變換矩陣與變換模式的像素圖的副本:在內部,該變換矩陣進行調整,以補償不需要翻譯,即[transformed](qpixmap.html#transformed)( )返回一個包含原始像素圖的全部改造點的最小像素圖。靜[trueMatrix](qpixmap.html#trueMatrix)( )函數返回用于轉化像素圖的實際矩陣。 **Note:**當使用原生的X11圖形系統,在像素映射變為無效時,[QApplication](qapplication.html)實例被銷毀。 * * * ## Type Documentation ``` QPixmap.ShareMode ``` 這個枚舉類型定義了共享模式創建時可用一[QPixmap](qpixmap.html)從原始的X11像素圖句柄的對象。 | Constant | Value | Description | | --- | --- | --- | | `QPixmap.ImplicitlyShared` | `0` | 此模式將導致[QPixmap](qpixmap.html)反對建立內部數據的副本,然后才修改,從而保持原有的X11的像素圖完好無損。 | | `QPixmap.ExplicitlyShared` | `1` | 在這種模式下,像素映像數據將_not_前它被修改,這實際上會改變原來的X11像素映像被復制。 | **Warning:**這個枚舉僅用于X11的特定功能;使用它是不可移植的。 這個枚舉被引入或修改的Qt 4.5 。 **See also** [QPixmap.fromX11Pixmap](qpixmap.html#fromX11Pixmap)( ) 。 * * * ## Method Documentation ``` QPixmap.__init__ (self) ``` 構造一個空像素圖。 **See also** [isNull](qpixmap.html#isNull)( ) 。 ``` QPixmap.__init__ (self, int?w, int?h) ``` ``` QPixmap.__init__ (self, QSize) ``` 構造一個像素圖與給定_width_和_height_。如果任_width_ or _height_是零,空像素圖的構造。 **Warning:**這將創建一個[QPixmap](qpixmap.html)與未初始化的數據。通話[fill](qpixmap.html#fill)( )與繪制到它之前,以填補一個合適的顏色的像素圖[QPainter](qpainter.html)。 **See also** [isNull](qpixmap.html#isNull)( ) 。 ``` QPixmap.__init__ (self, QString?fileName, str?format?=?None, Qt.ImageConversionFlags?flags?=?Qt.AutoColor) ``` 構造一個像素圖從文件中給定的_fileName_。如果文件不存在或未知格式,像素圖變成了空像素圖。 裝載程序將嘗試使用指定的讀取像素圖_format_。如果_format_未指定(這是默認值) ,加載器探測文件的標題來猜測文件格式。 文件名可以是指在磁盤上的實際文件或應用的嵌入式資源之一。請參閱[Resource System](index.htm)概述有關如何嵌入在應用程序的可執行映像和其他資源文件的詳細信息。 如果圖像需要進行修改,以適應在較低分辨率的結果(例如,從32位轉換為8位),使用_flags_來控制轉換。 該_fileName_,_format_和_flags_參數上傳遞[load](qpixmap.html#load)( ) 。這意味著,在數據_fileName_是不是編譯成二進制文件。如果_fileName_包含相對路徑(例如,文件名只)的相關文件,必須找到相對于運行時的工作目錄。 **See also** [Reading and Writing Image Files](qpixmap.html#reading-and-writing-image-files)。 ``` QPixmap.__init__ (self, list-of-str?xpm) ``` 構造一個像素圖從給定的_xpm_數據,該數據必須是有效的XPM圖像。 錯誤被忽略。 請注意,它可能通過使用一個不同尋常的聲明擠壓XPM變量一點點: ``` static const char * const start_xpm[]={ "16 15 8 1", "a c #cec6bd", .... ``` 額外的`const`使得整個定義為只讀,這會更有效(例如,當該代碼在一個共享庫)和ROMable當應用程序被存儲在ROM中。 ``` QPixmap.__init__ (self, QPixmap) ``` 構造一個像素映射,它是給定的一個副本_pixmap_。 **See also** [copy](qpixmap.html#copy)( ) 。 ``` QPixmap.__init__ (self, QVariant?variant) ``` ``` QPixmap QPixmap.alphaChannel (self) ``` [ ``` int QPixmap.cacheKey (self) ``` ](qpixmap.html) [返回一個數字,用于標識此](qpixmap.html)[QPixmap](qpixmap.html)。不同[QPixmap](qpixmap.html)對象只能有相同的高速緩存密鑰,如果它們指的是相同的內容。 該cacheKey ( )會改變,當像素映射被改變。 ``` bool QPixmap.convertFromImage (self, QImage?img, Qt.ImageConversionFlags?flags?=?Qt.AutoColor) ``` 代替該像素的數據與給定_image_使用指定的_flags_來控制轉換。該_flags_參數是的一個按位或[Qt.ImageConversionFlags](qt.html#ImageConversionFlag-enum)。路過0_flags_設置所有的默認選項。返回True如果結果是,這個像素映射不為null 。 注:此功能是在Qt的4.6和更早的版本的Qt 3支持的一部分。它已被晉升為官方的API狀態4.7支持更新的pixmap的圖像,而無需創建一個新的[QPixmap](qpixmap.html)如[fromImage](qpixmap.html#fromImage)( )會。 此功能被引入Qt的4.7 。 **See also** [fromImage](qpixmap.html#fromImage)( ) 。 ``` QPixmap QPixmap.copy (self, QRect?rect?=?QRect()) ``` [](qpixmap.html) [返回像素圖的子集是由給定的指定的一個深層副本_rectangle_。有關深副本的詳細信息,請參閱](qpixmap.html)[Implicit Data Sharing](index.htm#implicit-data-sharing)文檔。 如果給定的_rectangle_為空時,整個圖像被復制。 **See also** [operator=](qpixmap.html#operator-eq)( )[QPixmap](qpixmap.html#QPixmap)()和[Pixmap Transformations](qpixmap.html#pixmap-transformations)。 ``` QPixmap QPixmap.copy (self, int?ax, int?ay, int?awidth, int?aheight) ``` [ 這是一個重載函數。 ](qpixmap.html) [返回像素圖的子集是由矩形指定一個深層副本](qpixmap.html)[QRect](qrect.html)(_x_,_y_,_width_,_height_) 。 ``` QBitmap QPixmap.createHeuristicMask (self, bool?clipTight?=?True) ``` [ 創建并返回一個啟發式的面具為這個像素映射。 該功能是通過從一個角中選擇一種顏色,然后小打小鬧該顏色的像素處開始,所有的邊。如果_clipTight_為True(默認值)的面具只是大到足以復蓋的像素,否則,面膜比數據像素。 面具可能不是完美的,但它應該是合理的,所以你可以做的事情,如下列: ](qbitmap.html) ``` QPixmap myPixmap; myPixmap->setMask(myPixmap->createHeuristicMask()); ``` 此功能是緩慢的,因為它涉及到從一個轉換到/[QImage](qimage.html)和非平凡計算。 **See also** [QImage.createHeuristicMask](qimage.html#createHeuristicMask)()和[createMaskFromColor](qpixmap.html#createMaskFromColor)( ) 。 ``` QBitmap QPixmap.createMaskFromColor (self, QColor?maskColor, Qt.MaskMode?mode) ``` [](qbitmap.html) [創建并返回的基礎上,給出了這個像素映射口罩_maskColor_。如果_mode_ is](qbitmap.html) [Qt.MaskInColor](qt.html#MaskMode-enum),匹配MaskColor的所有像素將是透明的。如果_mode_ is [Qt.MaskOutColor](qt.html#MaskMode-enum),匹配MaskColor的所有像素是不透明的。 此功能是緩慢的,因為它涉及到從一個轉換到/[QImage](qimage.html)。 **See also** [createHeuristicMask](qpixmap.html#createHeuristicMask)()和[QImage.createMaskFromColor](qimage.html#createMaskFromColor)( ) 。 ``` QBitmap QPixmap.createMaskFromColor (self, QColor?maskColor) ``` [ 這是一個重載函數。 ](qbitmap.html) [創建并返回的基礎上,給出了這個像素映射口罩_maskColor_。與調用createMaskFromColor ( MaskColor的,](qbitmap.html)[Qt.MaskInColor](qt.html#MaskMode-enum)) **See also** [createHeuristicMask](qpixmap.html#createHeuristicMask)()和[QImage.createMaskFromColor](qimage.html#createMaskFromColor)( ) 。 ``` int QPixmap.defaultDepth () ``` 返回應用程序所使用的默認的pixmap的深度。 在Windows和Mac ,默認的深度始終是32 。在X11和嵌入式,在屏幕的深度將通過這個函數返回。 **See also** [depth](qpixmap.html#depth)( )[QColormap.depth](index.htm#depth)()和[Pixmap Information](qpixmap.html#pixmap-information)。 ``` int QPixmap.depth (self) ``` 返回像素圖的深度。 像素圖的深度也被稱為每像素位數( BPP )或像素圖的位面。空像素圖具有深度為0 。 **See also** [defaultDepth](qpixmap.html#defaultDepth)()和[Pixmap Information](qpixmap.html#pixmap-information)。 ``` QPixmap.detach (self) ``` 分離從共享像素映射數據的像素圖。 一個像素圖是由Qt的自動分離,每當其內容是即將改變。這是在幾乎所有做[QPixmap](qpixmap.html)該修改像素圖的成員函數([fill](qpixmap.html#fill)( )[fromImage](qpixmap.html#fromImage)( )[load](qpixmap.html#load)() ,等等) ,并且在[QPainter.begin](qpainter.html#begin)( )上的一個像素映射。 有兩個例外,其中分離( )必須被顯式調用,在調用時是[handle](qpixmap.html#handle)()或[x11PictureHandle](qpixmap.html#x11PictureHandle)( )函數(僅適用于X11 ) 。否則,使用系統調用進行任何修改,將在共享的數據進行的。 該分離( )函數立即返回,如果有只是一個參考,或者如果像素映射還沒有被初始化。 ``` int QPixmap.devType (self) ``` ``` QPixmap.fill (self, QColor?color?=?Qt.white) ``` 填充像素圖與給定_color_。 這個函數的作用時,像素圖被畫上是不確定的。 **See also** [Pixmap Transformations](qpixmap.html#pixmap-transformations)。 ``` QPixmap.fill (self, QWidget?widget, QPoint?ofs) ``` 填充的像素圖_widget_根據給定的偏移量的背景顏色或像素圖。 該[QPoint](qpoint.html) _offset_定義窗口小部件的點坐標到像素圖的左上角的像素將被映射到。這是唯一的顯著如果插件有一個背景像素映像,否則該像素映像將被簡單地填充有小窗口的背景色。 ``` QPixmap.fill (self, QWidget?widget, int?xofs, int?yofs) ``` 這是一個重載函數。 填充的像素圖_widget_的背景顏色或像素圖。給定的點, (_x_,_y_) ,定義了一個在小部件偏移坐標到像素圖的左上角的像素將被映射到。 ``` QPixmap QPixmap.fromImage (QImage?image, Qt.ImageConversionFlags?flags?=?Qt.AutoColor) ``` [](qpixmap.html) [轉換給定的_image_使用指定的一個像素圖_flags_來控制轉換。該_flags_參數是的一個按位或](qpixmap.html)[Qt.ImageConversionFlags](qt.html#ImageConversionFlag-enum)。路過0_flags_設置所有的默認選項。 在單色的情況下和8位的圖像,該圖像首先被轉換為一個32位的像素圖,然后填充在顏色表的顏色。如果這是過于昂貴的操作,您可以使用[QBitmap.fromImage](qbitmap.html#fromImage)( )來代替。 **See also** [fromImageReader](qpixmap.html#fromImageReader)( )[toImage](qpixmap.html#toImage)()和[Pixmap Conversion](qpixmap.html#pixmap-conversion)。 ``` QPixmap QPixmap.fromImageReader (QImageReader?imageReader, Qt.ImageConversionFlags?flags?=?Qt.AutoColor) ``` [](qpixmap.html) [創建](qpixmap.html)[QPixmap](qpixmap.html)從直接從讀取的圖像_imageReader_。該_flags_參數是的一個按位或[Qt.ImageConversionFlags](qt.html#ImageConversionFlag-enum)。路過0_flags_設置所有的默認選項。 在某些系統中,直接讀取圖像[QPixmap](qpixmap.html)可以使用較少的內存比讀一本[QImage](qimage.html)將其轉換為[QPixmap](qpixmap.html)。 **See also** [fromImage](qpixmap.html#fromImage)( )[toImage](qpixmap.html#toImage)()和[Pixmap Conversion](qpixmap.html#pixmap-conversion)。 ``` QPixmap QPixmap.fromX11Pixmap (int?pixmap, ShareMode?mode?=?QPixmap.ImplicitlyShared) ``` [](qpixmap.html) [創建](qpixmap.html)[QPixmap](qpixmap.html)從原生X11的像素圖手柄_pixmap_,使用_mode_為共享模式。默認共享模式[QPixmap.ImplicitlyShared](qpixmap.html#ShareMode-enum),這意味著像素圖的副本,如果有人試圖通過如要修改它是由繪制到它。 [QPixmap](qpixmap.html)不_not_采取所有權_pixmap_處理,并必須由用戶刪除。 **Warning:**這個功能是X11特定;使用它是不可移植的。 此功能被引入Qt的4.5 。 **See also** [QPixmap.ShareMode](qpixmap.html#ShareMode-enum)。 ``` QPixmap QPixmap.grabWidget (QWidget?widget, QRect?rect) ``` [ 創建一個像素圖和油漆給定的_widget_,受限于給定的_rectangle_在它。如果_widget_有任何孩子,那么他們也畫在適當的位置。 如果沒有指定矩形(默認值)將整個窗體是畫。 ](qpixmap.html) [If _widget_為0 ,指定的矩形不重疊部件的矩形,或發生錯誤,該函數將返回一個null](qpixmap.html)[QPixmap](qpixmap.html)。如果矩形是給定的一個超集_widget_,外面的區域_widget_都復蓋著widget的背景。 這個功能實際上是問_widget_油漆本身(及其子畫畫本身)通過調用的paintEvent ( )與畫家重定向打開。但[QPixmap](qpixmap.html)還提供了[grabWindow](qpixmap.html#grabWindow)( )函數,它是一個快一點通過抓取像素直接關閉屏幕。此外,如果有重疊的窗口,[grabWindow](qpixmap.html#grabWindow)( ) ,不像grabWidget ( ) ,會看到他們。 **Warning:**不要從它搶一個widget[QWidget.paintEvent](qwidget.html#paintEvent)( ) 。然而,它是安全的搶從另一小窗口的小部件[paintEvent()](qwidget.html#paintEvent)。 **See also** [grabWindow](qpixmap.html#grabWindow)( ) 。 ``` QPixmap QPixmap.grabWidget (QWidget?widget, int?x?=?0, int?y?=?0, int?width?=?-1, int?height?=?-1) ``` [ 這是一個重載函數。 ](qpixmap.html) [創建一個像素圖和油漆給定的_widget_,受限于](qpixmap.html)[QRect](qrect.html)(_x_,_y_,_width_,_height_) ,在它。 **Warning:**不要從它搶一個widget[QWidget.paintEvent](qwidget.html#paintEvent)( ) 。然而,它是安全的搶從另一小窗口的小部件[paintEvent()](qwidget.html#paintEvent)。 ``` QPixmap QPixmap.grabWindow (int?window, int?x?=?0, int?y?=?0, int?width?=?-1, int?height?=?-1) ``` [](qpixmap.html) [創建并返回被抓住給定的內容構成的像素圖_window_限制](qpixmap.html)[QRect](qrect.html)(_x_,_y_,_width_,_height_) 。 該參數(_x_,_y_)指定的窗口偏移,而(_width_,_height_)指定要復制的區域。如果_width_為負,則函數將一切交給窗口的右邊框。如果_height_是否定的,則函數將一切向窗口的底部。 窗口系統標識符(`WId`)可使用檢索到的[QWidget.winId](qwidget.html#winId)()函數。使用一個窗口標識符,而不是一個的理由[QWidget](qwidget.html),是使窗口不屬于該應用程序的一部分,窗口系統框架,等等抓取。 該grabWindow ( )函數抓取像素的屏幕,而不是從窗口,也就是說,如果有另一個窗口部分或完全超過你搶,你從上復窗口得到的像素,太一。將鼠標光標一般不抓住。 注意:在X11 ,如果給定的_window_不具有相同的深度為根窗口,另一個窗口部分或全部掩蓋你搶一個,你會_not_從上復窗口得到的像素。在像素圖的遮擋區域的內容將是不確定的和未初始化的。 在Windows Vista及以上的抓住一個分層的窗口,這是通過設置創建[Qt.WA_TranslucentBackground](qt.html#WidgetAttribute-enum)屬性,將無法正常工作。而是抓住了桌面widget應該工作。 **Warning:**一般情況下,抓一個區域外屏幕是不是安全。這取決于底層的窗口系統。 **See also** [grabWidget](qpixmap.html#grabWidget)()和[Screenshot Example](index.htm)。 ``` int QPixmap.handle (self) ``` 返回像素圖的句柄,設備上下文。 需要注意的是,由于[QPixmap](qpixmap.html)利用[implicit data sharing](index.htm#implicit-data-sharing)時,[detach](qpixmap.html#detach)()函數必須被調用明確,以確保只有_this_如果像素圖的數據是共享的像素圖的數據被修改。 **Warning:**這個功能是X11特定;使用它是不可移植的。 **Warning:**由于4.8 ,像素映射沒有一個X11的手柄,除非與創造[fromX11Pixmap()](qpixmap.html#fromX11Pixmap)或者,如果本機圖形系統明確激活。 **See also** [detach](qpixmap.html#detach)()和[QApplication.setGraphicsSystem](qapplication.html#setGraphicsSystem)( ) 。 ``` bool QPixmap.hasAlpha (self) ``` 返回True如果該像素圖有一個alpha通道,_or_有一個面具,否則返回False 。 **See also** [hasAlphaChannel](qpixmap.html#hasAlphaChannel)()和[mask](qpixmap.html#mask)( ) 。 ``` bool QPixmap.hasAlphaChannel (self) ``` 返回True如果像素映射有一個尊重的alpha通道的格式,否則返回False 。 **See also** [hasAlpha](qpixmap.html#hasAlpha)( ) 。 ``` int QPixmap.height (self) ``` 返回像素圖的高度。 **See also** [size](qpixmap.html#size)()和[Pixmap Information](qpixmap.html#pixmap-information)。 ``` bool QPixmap.isNull (self) ``` 返回True如果這是一個空像素圖,否則返回False 。 空像素映射具有零寬度,高度為零,沒有內容。你可以不畫在一個空像素圖。 ``` bool QPixmap.isQBitmap (self) ``` 返回True如果這是一個[QBitmap](qbitmap.html)否則返回False 。 ``` bool QPixmap.load (self, QString?fileName, str?format?=?None, Qt.ImageConversionFlags?flags?=?Qt.AutoColor) ``` 加載一個像素圖從文件給定的_fileName_。返回True如果成功加載的像素圖,否則返回False 。 裝載程序將嘗試使用指定的讀取像素圖_format_。如果_format_未指定(這是默認值) ,加載器探測文件的標題來猜測文件格式。 文件名可以是指在磁盤上的實際文件或應用的嵌入式資源之一。請參閱[Resource System](index.htm)概述如何嵌入到應用程序的可執行像素圖等資源文件的詳細信息。 如果需要修改,以適應在一個較低分辨率的結果(例如,從32位轉換為8位)的數據,使用_flags_來控制轉換。 需要注意的是QPixmaps會自動添加到[QPixmapCache](qpixmapcache.html)當從文件加載;使用的密鑰是內部的,不能獲得的。 **See also** [loadFromData](qpixmap.html#loadFromData)()和[Reading and Writing Image Files](qpixmap.html#reading-and-writing-image-files)。 ``` bool QPixmap.loadFromData (self, str?buf, str?format?=?None, Qt.ImageConversionFlags?flags?=?Qt.AutoColor) ``` 加載從一個像素圖_len_給定的二進制字節第一_data_。返回True如果加載成功的像素圖,否則返回False 。 裝載程序將嘗試使用指定的讀取像素圖_format_。如果_format_未指定(這是默認值) ,加載器探測文件的標題來猜測文件格式。 如果需要修改,以適應在一個較低分辨率的結果(例如,從32位轉換為8位)的數據,使用_flags_來控制轉換。 **See also** [load](qpixmap.html#load)()和[Reading and Writing Image Files](qpixmap.html#reading-and-writing-image-files)。 ``` bool QPixmap.loadFromData (self, QByteArray?buf, str?format?=?None, Qt.ImageConversionFlags?flags?=?Qt.AutoColor) ``` ``` QBitmap QPixmap.mask (self) ``` [ 從像素圖的Alpha通道中提取位圖蒙版。 **Warning:**這是一個潛在的昂貴的操作。像素映像的掩碼是從PixelData取出動態萃取。 ](qbitmap.html) [**See also**](qbitmap.html) [setMask](qpixmap.html#setMask)()和[Pixmap Information](qpixmap.html#pixmap-information)。 ``` int QPixmap.metric (self, QPaintDevice.PaintDeviceMetric) ``` ``` QPaintEngine QPixmap.paintEngine (self) ``` [](qpaintengine.html) ``` QRect QPixmap.rect (self) ``` [ 返回像素圖的外接矩形。 ](qrect.html) [**See also**](qrect.html) [Pixmap Information](qpixmap.html#pixmap-information)。 ``` bool QPixmap.save (self, QString?fileName, str?format?=?None, int?quality?=?-1) ``` 節省了像素映像的文件用給定的_fileName_使用指定的圖像文件_format_和_quality_因素。成功返回True ,否則返回False 。 該_quality_因子必須在范圍[ 0,100 ]或-1 。指定0以獲得小的壓縮文件, 100為大型未壓縮的文件,和-1來使用默認設置。 If _format_是0 ,圖像格式將被選自_fileName_的后綴。 **See also** [Reading and Writing Image Files](qpixmap.html#reading-and-writing-image-files)。 ``` bool QPixmap.save (self, QIODevice?device, str?format?=?None, int?quality?=?-1) ``` 這是一個重載函數。 該函數將一個[QPixmap](qpixmap.html)為給定的_device_使用指定的圖像文件_format_和_quality_因素。這可以用來,例如,直接保存一個像素映像成[QByteArray](qbytearray.html): ``` [QPixmap](qpixmap.html) pixmap; [QByteArray](qbytearray.html) bytes; [QBuffer](qbuffer.html) buffer(&bytes); buffer.open([QIODevice](qiodevice.html).WriteOnly); pixmap.save(&buffer, "PNG"); // writes pixmap into bytes in PNG format ``` ``` QPixmap QPixmap.scaled (self, int?width, int?height, Qt.AspectRatioMode?aspectRatioMode?=?Qt.IgnoreAspectRatio, Qt.TransformationMode?transformMode?=?Qt.FastTransformation) ``` [ 縮放像素映射到給定_size_使用由指定的高寬比和變換模式_aspectRatioMode_和_transformMode_。 ![](https://img.kancloud.cn/e5/cd/e5cd6412df7e86ff33e3e15ff4d825a0_560x122.png) ](qpixmap.html) [](qpixmap.html) * [If _aspectRatioMode_ is](qpixmap.html) [Qt.IgnoreAspectRatio](qt.html#AspectRatioMode-enum), the pixmap is scaled to _size_. * If _aspectRatioMode_ is [Qt.KeepAspectRatio](qt.html#AspectRatioMode-enum), the pixmap is scaled to a rectangle as large as possible inside _size_, preserving the aspect ratio. * If _aspectRatioMode_ is [Qt.KeepAspectRatioByExpanding](qt.html#AspectRatioMode-enum), the pixmap is scaled to a rectangle as small as possible outside _size_, preserving the aspect ratio. 如果給定的_size_是空的,這個函數返回一個空的像素圖。 在某些情況下,它可以更有利繪制像素映射到帶刻度設置,而不是縮放的像素圖畫家。這種情況下,當基于OpenGL或當快速縮放因子變化的畫家為實例。 **See also** [isNull](qpixmap.html#isNull)()和[Pixmap Transformations](qpixmap.html#pixmap-transformations)。 ``` QPixmap QPixmap.scaled (self, QSize?size, Qt.AspectRatioMode?aspectRatioMode?=?Qt.IgnoreAspectRatio, Qt.TransformationMode?transformMode?=?Qt.FastTransformation) ``` [ 這是一個重載函數。 返回像素圖的縮放,以矩形與給定的一個副本_width_和_height_根據給定的_aspectRatioMode_和_transformMode_。 如果任何一個_width_或_height_為零或負數,則該函數返回一個空的pixmap 。 ](qpixmap.html) ``` QPixmap QPixmap.scaledToHeight (self, int?height, Qt.TransformationMode?mode?=?Qt.FastTransformation) ``` [ 返回圖像的縮放復印。返回的圖像被縮放為給定的_height_使用指定的變換_mode_。是自動計算的像素映像的寬度,使像素圖的縱橫比被保存下來。 If _height_為0或負數,則返回一個空的像素圖。 ](qpixmap.html) [**See also**](qpixmap.html) [isNull](qpixmap.html#isNull)()和[Pixmap Transformations](qpixmap.html#pixmap-transformations)。 ``` QPixmap QPixmap.scaledToWidth (self, int?width, Qt.TransformationMode?mode?=?Qt.FastTransformation) ``` [ 返回圖像的縮放復印。返回的圖像被縮放為給定的_width_使用指定的變換_mode_。像素映像的高度是自動計算的,使得像素圖的縱橫比被保存下來。 If _width_為0或負數,則返回一個空的像素圖。 ](qpixmap.html) [**See also**](qpixmap.html) [isNull](qpixmap.html#isNull)()和[Pixmap Transformations](qpixmap.html#pixmap-transformations)。 ``` QRegion?exposed QPixmap.scroll (self, int?dx, int?dy, QRect?rect) ``` [](qregion.html) [這個方便的功能等同于調用QPixmap.scroll (_dx_,_dy_,](qregion.html)[QRect](qrect.html)(_x_,_y_,_width_,_height_) ,_exposed_) 。 此功能被引入Qt的4.6 。 **See also** [QWidget.scroll](qwidget.html#scroll)()和[QGraphicsItem.scroll](qgraphicsitem.html#scroll)( ) 。 ``` QRegion?exposed QPixmap.scroll (self, int?dx, int?dy, int?x, int?y, int?width, int?height) ``` [](qregion.html) [滾動區_rect_這個像素映射的(_dx_,_dy_) 。暴露區域保持不變。您可以選擇性地傳遞一個指針為空](qregion.html)[QRegion](qregion.html)得到,它是區域_exposed_通過滾動操作。 ``` [QPixmap](qpixmap.html) pixmap("background.png"); [QRegion](qregion.html) exposed; pixmap.scroll(10, 10, pixmap.rect(), &exposed); ``` 你不能滾動,而沒有對像素映射活躍的畫家。 此功能被引入Qt的4.6 。 **See also** [QWidget.scroll](qwidget.html#scroll)()和[QGraphicsItem.scroll](qgraphicsitem.html#scroll)( ) 。 ``` int QPixmap.serialNumber (self) ``` ``` QPixmap.setAlphaChannel (self, QPixmap) ``` ``` QPixmap.setMask (self, QBitmap) ``` 設置掩碼位圖。 此功能的合并_mask_與像素圖的Alpha通道。 1在面具的像素值表示像素圖的像素保持不變; 0值表示的像素是透明的。掩模必須具有相同的尺寸,因為這像素圖。 設置一個空面具復位面具,留下前面透明像素的黑色。這個函數的作用時,像素圖被畫上是不確定的。 **Warning:**這是一個潛在的昂貴的操作。 **See also** [mask](qpixmap.html#mask)( )[Pixmap Transformations](qpixmap.html#pixmap-transformations)和[QBitmap](qbitmap.html)。 ``` QSize QPixmap.size (self) ``` [ 返回該像素映像的大小。 ](qsize.html) [**See also**](qsize.html) [width](qpixmap.html#width)( )[height](qpixmap.html#height)()和[Pixmap Information](qpixmap.html#pixmap-information)。 ``` QPixmap.swap (self, QPixmap?other) ``` 掉期的pixmap_other_與此像素圖。這個操作是非常快的,而且永遠不會。 此功能被引入Qt的4.8 。 ``` QImage QPixmap.toImage (self) ``` [](qimage.html) [像素圖轉換為](qimage.html)[QImage](qimage.html)。返回如果轉換失敗,一個空的圖像。 如果像素映射有1位深度,返回的圖像也將是1位深。有更多的比特圖像將在格式返回密切代表了底層系統。通常這將是[QImage.Format_ARGB32_Premultiplied](qimage.html#Format-enum)對于用alpha像素圖和[QImage.Format_RGB32](qimage.html#Format-enum) or [QImage.Format_RGB16](qimage.html#Format-enum)為像素圖沒有Alpha 。 請注意,就目前而言,在單色圖像alpha蒙板被忽略。 **See also** [fromImage](qpixmap.html#fromImage)()和[Image Formats](qimage.html#image-formats)。 ``` QPixmap QPixmap.transformed (self, QMatrix?matrix, Qt.TransformationMode?mode?=?Qt.FastTransformation) ``` [ 返回被轉換的像素圖的使用給定的轉型副本_transform_改造_mode_。原始像素圖不改變。 ](qpixmap.html) [改造_transform_是內部調整,以補償不需要翻譯,即所產生的像素圖是包含原始像素圖的所有轉換后的點的最小像素圖。使用](qpixmap.html)[trueMatrix](qpixmap.html#trueMatrix)( )函數來檢索用于轉化像素圖的實際矩陣。 此功能是緩慢的,因為它涉及到轉型為[QImage](qimage.html),非平凡的計算和轉換回[QPixmap](qpixmap.html)。 **See also** [trueMatrix](qpixmap.html#trueMatrix)()和[Pixmap Transformations](qpixmap.html#pixmap-transformations)。 ``` QPixmap QPixmap.transformed (self, QTransform?transform, Qt.TransformationMode?mode?=?Qt.FastTransformation) ``` [ 這是一個重載函數。 ](qpixmap.html) [此功能方便的加載_matrix_成](qpixmap.html)[QTransform](qtransform.html)并調用重載函數。 ``` QMatrix QPixmap.trueMatrix (QMatrix?m, int?w, int?h) ``` [ 返回用于轉化一個像素映像與給定的實際的矩陣_width_,_height_和_matrix_。 ](qmatrix.html) [當使用一個轉換的像素圖](qmatrix.html)[transformed](qpixmap.html#transformed)()函數,該變換矩陣是在內部調整以補償不需要的翻譯,即[transformed](qpixmap.html#transformed)( )返回一個包含原始像素圖的全部改造點的最小像素圖。這個函數返回修改后的矩陣,正確映射點從原來的像素映射到新的像素圖。 **See also** [transformed](qpixmap.html#transformed)()和[Pixmap Transformations](qpixmap.html#pixmap-transformations)。 ``` QTransform QPixmap.trueMatrix (QTransform?m, int?w, int?h) ``` [ 這是一個重載函數。 ](qtransform.html) [這種方便的功能加載矩陣_m_成](qtransform.html)[QTransform](qtransform.html)并調用與重載的函數[QTransform](qtransform.html)和寬度_w_和高度_h_。 ``` int QPixmap.width (self) ``` 返回像素圖的寬度。 **See also** [size](qpixmap.html#size)()和[Pixmap Information](qpixmap.html#pixmap-information)。 ``` QX11Info QPixmap.x11Info (self) ``` [ **X11 only:**返回有關所使用到的像素圖目前屬于屏幕的X顯示的配置信息。 **Warning:**此功能僅適用于X11 。 ](qx11info.html) [**See also**](qx11info.html) [Pixmap Information](qpixmap.html#pixmap-information)。 ``` int QPixmap.x11PictureHandle (self) ``` **X11 only:**返回像素圖的XRender的支持X11的圖片處理。 這個函數將返回0,如果XRender的支持是不會被編譯到Qt的,如果XRender的擴展不支持X11的顯示器上,或者如果無法創建的句柄。這個函數的使用是不可移植的。 **Warning:**此功能僅適用于X11 。 **See also** [Pixmap Information](qpixmap.html#pixmap-information)。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看