📄 qpixmap.3qt
字号:
Note that grabWindows() grabs pixels from the screen, not from the window. If there is another window partially or entirely over the one you grab, you get pixels from the overlying window, too..PPNote also that the mouse cursor is generally not grabbed..PPThe reason we use a window identifier and not a QWidget is to enable grabbing of windows that are not part of the application, window system frames, and so on..PP\fBWarning:\fR Grabbing an area outside the screen is not safe in general. This depends on the underlying window system..PPSee also grabWidget()..PPExample: qmag/qmag.cpp..SH "int QPixmap::height () const"Returns the height of the pixmap..PPSee also width(), size() and rect()..PPExamples:.)l desktop/desktop.cpp, movies/main.cpp, qtimage/qtimage.cpp, scribble/scribble.cpp, scrollview/scrollview.cpp, t10/cannon.cpp and xform/xform.cpp..SH "const char * QPixmap::imageFormat ( const QString & fileName )\fC [static]\fR"Returns a string that specifies the image format of the file \fIfileName\fR, or null if the file cannot be read or if the format cannot be recognized..PPThe QImageIO documentation lists the supported image formats..PPSee also load() and save()..SH "bool QPixmap::isNull () const"Returns TRUE if this is a null pixmap; otherwise returns FALSE..PPA null pixmap has zero width, zero height and no contents. You cannot draw in a null pixmap or bitBlt() anything to it..PPResizing an existing pixmap to (0, 0) makes a pixmap into a null pixmap..PPSee also resize()..PPExamples:.)l qdir/qdir.cpp, qmag/qmag.cpp and scrollview/scrollview.cpp..SH "bool QPixmap::isQBitmap () const"Returns TRUE if this is a QBitmap; otherwise returns FALSE..SH "bool QPixmap::load ( const QString & fileName, const char * format, int conversion_flags )"Loads a pixmap from the file \fIfileName\fR at runtime. Returns TRUE if successful, or FALSE if the pixmap could not be loaded..PPIf \fIformat\fR is specified, the loader attempts to read the pixmap using the specified format. If \fIformat\fR is not specified (default), the loader reads a few bytes from the header to guess the file's format..PPSee the convertFromImage() documentation for a description of the \fIconversion_flags\fR argument..PPThe QImageIO documentation lists the supported image formats and explains how to add extra formats..PPSee also loadFromData(), save(), imageFormat(), QImage::load() and QImageIO..PPExamples:.)l picture/picture.cpp, scrollview/scrollview.cpp and xform/xform.cpp..SH "bool QPixmap::load ( const QString & fileName, const char * format = 0, ColorMode mode = Auto )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPLoads a pixmap from the file \fIfileName\fR at runtime..PPIf \fIformat\fR is specified, the loader attempts to read the pixmap using the specified format. If \fIformat\fR is not specified (default), the loader reads a few bytes from the header to guess the file's format..PPThe \fImode\fR is used to specify the color mode of the pixmap..PPSee also QPixmap::ColorMode..SH "bool QPixmap::loadFromData ( const uchar * buf, uint len, const char * format, int conversion_flags )"Loads a pixmap from the binary data in \fIbuf\fR (\fIlen\fR bytes). Returns TRUE if successful, or FALSE if the pixmap could not be loaded..PPIf \fIformat\fR is specified, the loader attempts to read the pixmap using the specified format. If \fIformat\fR is not specified (default), the loader reads a few bytes from the header to guess the file's format..PPSee the convertFromImage() documentation for a description of the \fIconversion_flags\fR argument..PPThe QImageIO documentation lists the supported image formats and explains how to add extra formats..PPSee also load(), save(), imageFormat(), QImage::loadFromData() and QImageIO..SH "bool QPixmap::loadFromData ( const uchar * buf, uint len, const char * format = 0, ColorMode mode = Auto )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPLoads a pixmap from the binary data in \fIbuf\fR (\fIlen\fR bytes) using color mode \fImode\fR. Returns TRUE if successful, or FALSE if the pixmap could not be loaded..PPIf \fIformat\fR is specified, the loader attempts to read the pixmap using the specified format. If \fIformat\fR is not specified (default), the loader reads a few bytes from the header to guess the file's format..PPSee also QPixmap::ColorMode..SH "bool QPixmap::loadFromData ( const QByteArray & buf, const char * format = 0, int conversion_flags = 0 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..SH "const QBitmap * QPixmap::mask () const"Returns the mask bitmap, or null if no mask has been set..PPSee also setMask() and QBitmap..SH "int QPixmap::metric ( int m ) const\fC [virtual protected]\fR"Internal implementation of the virtual QPaintDevice::metric() function..PPUse the QPaintDeviceMetrics class instead..PP\fIm\fR is the metric to get..PPReimplemented from QPaintDevice..SH "QPixmap & QPixmap::operator= ( const QPixmap & pixmap )"Assigns the pixmap \fIpixmap\fR to this pixmap and returns a reference to this pixmap..SH "QPixmap & QPixmap::operator= ( const QImage & image )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPConverts the image \fIimage\fR to a pixmap that is assigned to this pixmap. Returns a reference to the pixmap..PPSee also convertFromImage()..SH "Optimization QPixmap::optimization () const"Returns the optimization setting for this pixmap..PPThe default optimization setting is QPixmap::NormalOptim. You may change this settings in two ways:.TPCall setDefaultOptimization() to set the default optimization for all new pixmaps..TPCall setOptimization() to set a the optimization for individual pixmaps..PPSee also setOptimization(), setDefaultOptimization() and defaultOptimization()..SH "QRect QPixmap::rect () const"Returns the enclosing rectangle (0,0,width(),height()) of the pixmap..PPSee also width(), height() and size()..PPExample: xform/xform.cpp..SH "void QPixmap::resize ( int w, int h )"Resizes the pixmap to \fIw\fR width and \fIh\fR height. If either \fIw\fR or \fIh\fR is 0, the pixmap becomes a null pixmap..PPIf both \fIw\fR and \fIh\fR are greater than 0, a valid pixmap is created. New pixels will be uninitialized (random) if the pixmap is expanded..PPExamples:.)l desktop/desktop.cpp and grapher/grapher.cpp..SH "void QPixmap::resize ( const QSize & size )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPResizes the pixmap to size \fIsize\fR..SH "bool QPixmap::save ( const QString & fileName, const char * format, int quality = -1 ) const"Saves the pixmap to the file \fIfileName\fR using the image file format \fIformat\fR and a quality factor \fIquality\fR. \fIquality\fR must be in the range [0,100] or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 to use the default settings. Returns TRUE if successful, or FALSE if the pixmap could not be saved..PPSee also load(), loadFromData(), imageFormat(), QImage::save() and QImageIO..PPExample: qmag/qmag.cpp..SH "bool QPixmap::selfMask () const"Returns TRUE if the pixmap's mask is identical to the pixmap itself; otherwise returns FALSE..PPSee also mask()..SH "int QPixmap::serialNumber () const"Returns a number that uniquely identifies the contents of this QPixmap object. This means that multiple QPixmaps objects can have the same serial number as long as they refer to the same contents..PPAn example of where this is useful is for caching QPixmaps..PPSee also QPixmapCache..SH "void QPixmap::setDefaultOptimization ( Optimization optimization )\fC [static]\fR"Sets the default pixmap optimization..PPAll \fInew\fR pixmaps that are created will use this default optimization. You may also set optimization for individual pixmaps using the setOptimization() function..PPThe initial default \fIoptimization\fR setting is \fCQPixmap::Normal\fR..PPSee also defaultOptimization(), setOptimization() and optimization()..SH "void QPixmap::setMask ( const QBitmap & newmask )"Sets a mask bitmap..PPThe \fInewmask\fR bitmap defines the clip mask for this pixmap. Every pixel in \fInewmask\fR corresponds to a pixel in this pixmap. Pixel value 1 means opaque and pixel value 0 means transparent. The mask must have the same size as this pixmap..PPSetting a null mask resets the mask..PPSee also mask(), createHeuristicMask() and QBitmap..SH "void QPixmap::setOptimization ( Optimization optimization )"Sets pixmap drawing optimization for this pixmap..PPThe \fIoptimization\fR setting affects pixmap operations, in particular drawing of transparent pixmaps (bitBlt() a pixmap with a mask set) and pixmap transformations (the xForm() function)..PPPixmap optimization involves keeping intermediate results in a cache buffer and use the data in the cache to speed up bitBlt() and xForm(). The cost is more memory consumption, up to twice as much as an unoptimized pixmap..PPUse the setDefaultOptimization() to change the default optimization for all new pixmaps..PPSee also optimization(), setDefaultOptimization() and defaultOptimization()..PPExample: desktop/desktop.cpp..SH "QSize QPixmap::size () const"Returns the size of the pixmap..PPSee also width(), height() and rect()..PPExamples:.)l movies/main.cpp and qtimage/qtimage.cpp..SH "QWMatrix QPixmap::trueMatrix ( const QWMatrix & matrix, int w, int h )\fC [static]\fR"Returns the actual matrix used for transforming a pixmap with \fIw\fR width and \fIh\fR height and matrix \fImatrix\fR..PPWhen transforming a pixmap with xForm(), the transformation matrix is internally adjusted to compensate for unwanted translation, i.e. xForm() returns the smallest pixmap containing all transformed points of the original pixmap..PPThis function returns the modified matrix, which maps points correctly from the original pixmap into the new pixmap..PPSee also xForm() and QWMatrix..SH "int QPixmap::width () const"Returns the width of the pixmap..PPSee also height(), size() and rect()..PPExamples:.)l desktop/desktop.cpp, movies/main.cpp, qtimage/qtimage.cpp, scribble/scribble.cpp, scrollview/scrollview.cpp and xform/xform.cpp..SH "QPixmap QPixmap::xForm ( const QWMatrix & matrix ) const"Returns a copy of the pixmap that is transformed using \fImatrix\fR. The original pixmap is not changed..PPThe transformation \fImatrix\fR is internally adjusted to compensate for unwanted translation, i.e. xForm() returns the smallest image that contains all the transformed points of the original image..PPSee also trueMatrix(), QWMatrix, QPainter::setWorldMatrix() and QImage::xForm()..PPExamples:.)l desktop/desktop.cpp, fileiconview/qfileiconview.cpp, movies/main.cpp, qmag/qmag.cpp, qtimage/qtimage.cpp and xform/xform.cpp..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator<< ( QDataStream & s, const QPixmap & pixmap )"Writes the pixmap \fIpixmap\fR to the stream \fIs\fR as a PNG image..PPSee also QPixmap::save() and Format of the QDataStream operators..SH "QDataStream & operator>> ( QDataStream & s, QPixmap & pixmap )"Reads a pixmap from the stream \fIs\fR into the pixmap \fIpixmap\fR..PPSee also QPixmap::load() and Format of the QDataStream operators..SH "SEE ALSO".BR http://doc.trolltech.com/qpixmap.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qpixmap.3qt) and the Qtversion (3.0.0).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -