📄 qpixmap.3qt
字号:
'\" t.TH QPixmap 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQPixmap \- Off-screen, pixel-based paint device.SH SYNOPSIS\fC#include <qpixmap.h>\fR.PPInherits QPaintDevice and Qt..PPInherited by QBitmap and QCanvasPixmap..PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBColorMode\fR { Auto, Color, Mono }".br.ti -1c.BI "enum \fBOptimization\fR { DefaultOptim, NoOptim, MemoryOptim = NoOptim, NormalOptim, BestOptim }".br.ti -1c.BI "\fBQPixmap\fR ()".br.ti -1c.BI "\fBQPixmap\fR ( const QImage & image )".br.ti -1c.BI "\fBQPixmap\fR ( int w, int h, int depth = -1, Optimization optimization = DefaultOptim )".br.ti -1c.BI "\fBQPixmap\fR ( const QSize & size, int depth = -1, Optimization optimization = DefaultOptim )".br.ti -1c.BI "\fBQPixmap\fR ( const QString & fileName, const char * format = 0, ColorMode mode = Auto )".br.ti -1c.BI "\fBQPixmap\fR ( const QString & fileName, const char * format, int conversion_flags )".br.ti -1c.BI "\fBQPixmap\fR ( const char * xpm[] )".br.ti -1c.BI "\fBQPixmap\fR ( const QByteArray & img_data )".br.ti -1c.BI "\fBQPixmap\fR ( const QPixmap & pixmap )".br.ti -1c.BI "\fB~QPixmap\fR ()".br.ti -1c.BI "QPixmap & \fBoperator=\fR ( const QPixmap & pixmap )".br.ti -1c.BI "QPixmap & \fBoperator=\fR ( const QImage & image )".br.ti -1c.BI "bool \fBisNull\fR () const".br.ti -1c.BI "int \fBwidth\fR () const".br.ti -1c.BI "int \fBheight\fR () const".br.ti -1c.BI "QSize \fBsize\fR () const".br.ti -1c.BI "QRect \fBrect\fR () const".br.ti -1c.BI "int \fBdepth\fR () const".br.ti -1c.BI "void \fBfill\fR ( const QColor & fillColor = Qt::white )".br.ti -1c.BI "void \fBfill\fR ( const QWidget * widget, int xofs, int yofs )".br.ti -1c.BI "void \fBfill\fR ( const QWidget * widget, const QPoint & ofs )".br.ti -1c.BI "void \fBresize\fR ( int w, int h )".br.ti -1c.BI "void \fBresize\fR ( const QSize & size )".br.ti -1c.BI "const QBitmap * \fBmask\fR () const".br.ti -1c.BI "void \fBsetMask\fR ( const QBitmap & newmask )".br.ti -1c.BI "bool \fBselfMask\fR () const".br.ti -1c.BI "bool \fBhasAlpha\fR () const".br.ti -1c.BI "QBitmap \fBcreateHeuristicMask\fR ( bool clipTight = TRUE ) const".br.ti -1c.BI "QPixmap \fBxForm\fR ( const QWMatrix & matrix ) const".br.ti -1c.BI "QImage \fBconvertToImage\fR () const".br.ti -1c.BI "bool \fBconvertFromImage\fR ( const QImage & image, ColorMode mode = Auto )".br.ti -1c.BI "bool \fBconvertFromImage\fR ( const QImage & img, int conversion_flags )".br.ti -1c.BI "bool \fBload\fR ( const QString & fileName, const char * format = 0, ColorMode mode = Auto )".br.ti -1c.BI "bool \fBload\fR ( const QString & fileName, const char * format, int conversion_flags )".br.ti -1c.BI "bool \fBloadFromData\fR ( const uchar * buf, uint len, const char * format = 0, ColorMode mode = Auto )".br.ti -1c.BI "bool \fBloadFromData\fR ( const uchar * buf, uint len, const char * format, int conversion_flags )".br.ti -1c.BI "bool \fBloadFromData\fR ( const QByteArray & buf, const char * format = 0, int conversion_flags = 0 )".br.ti -1c.BI "bool \fBsave\fR ( const QString & fileName, const char * format, int quality = -1 ) const".br.ti -1c.BI "int \fBserialNumber\fR () const".br.ti -1c.BI "Optimization \fBoptimization\fR () const".br.ti -1c.BI "void \fBsetOptimization\fR ( Optimization optimization )".br.ti -1c.BI "virtual void \fBdetach\fR ()".br.ti -1c.BI "bool \fBisQBitmap\fR () const".br.ti -1c.BI "\fBQ_DUMMY_COMPARISON_OPERATOR\fR ( QPixmap )".br.ti -1c.BI "virtual int \fBmetric\fR ( int m ) const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "int \fBdefaultDepth\fR ()".br.ti -1c.BI "QPixmap \fBfromMimeSource\fR ( const QString & abs_name )".br.ti -1c.BI "QPixmap \fBgrabWindow\fR ( WId window, int x = 0, int y = 0, int w = -1, int h = -1 )".br.ti -1c.BI "QPixmap \fBgrabWidget\fR ( QWidget * widget, int x = 0, int y = 0, int w = -1, int h = -1 )".br.ti -1c.BI "QWMatrix \fBtrueMatrix\fR ( const QWMatrix & matrix, int w, int h )".br.ti -1c.BI "const char * \fBimageFormat\fR ( const QString & fileName )".br.ti -1c.BI "Optimization \fBdefaultOptimization\fR ()".br.ti -1c.BI "void \fBsetDefaultOptimization\fR ( Optimization optimization )".br.in -1c.SH RELATED FUNCTION DOCUMENTATION.in +1c.ti -1c.BI "QDataStream & \fBoperator<<\fR ( QDataStream & s, const QPixmap & pixmap )".br.ti -1c.BI "QDataStream & \fBoperator>>\fR ( QDataStream & s, QPixmap & pixmap )".br.in -1c.SH DESCRIPTIONThe QPixmap class is an off-screen, pixel-based paint device..PPQPixmap is one of the two classes Qt provides for dealing with images; the other is QImage. QPixmap is designed and optimized for drawing; QImage is designed and optimized for I/O and for direct pixel access/manipulation. There are (slow) functions to convert between QImage and QPixmap: convertToImage() and convertFromImage()..PPOne common use of the QPixmap class is to enable smooth updating of widgets. Whenever something complex needs to be drawn, you can use a pixmap to obtain flicker-free drawing, like this:.PP<ol type=1>.IP 1Create a pixmap with the same size as the widget..IP 2Fill the pixmap with the widget background color..IP 3Paint the pixmap..IP 4bitBlt() the pixmap contents onto the widget..PPPixel data in a pixmap is internal and is managed by the underlying window system. Pixels can be accessed only through QPainter functions, through bitBlt(), and by converting the QPixmap to a QImage..PPYou can easily display a QPixmap on the screen using QLabel::setPixmap(). For example, all the QButton subclasses support pixmap use..PPThe QPixmap class uses copy-on-write, so it is practical to pass QPixmap objects by value..PPYou can retrieve the width(), height(), depth() and size() of a pixmap. The enclosing rectangle is given by rect(). Pixmaps can be filled with fill() and resized with resize(). You can create and set a mask with createHeuristicMask() and setMask(). Use selfMask() to see if the pixmap is identical to its mask..PPIn addition to loading a pixmap from file using load() you can also loadFromData(). You can control optimization with setOptimization() and obtain a transformed version of the pixmap using xForm().PPNote regarding Windows 95 and 98: on Windows 9x the system crashes if you create more than about 1000 pixmaps, independent of the size of the pixmaps or installed RAM. Windows NT and 2000 do not have this limitation..PPQt tries to work around the resource limitation. If you set the pixmap optimization to QPixmap::MemoryOptim and the width of your pixmap is less than or equal to 128 pixels, Qt stores the pixmap in a way that is very memory-efficient when there are many pixmaps..PPIf your application uses dozens or hundreds of pixmaps (for example on tool bar buttons and in popup menus), and you plan to run it on Windows 95 or Windows 98, we recommend using code like this:.PP.nf.br QPixmap::setDefaultOptimization( QPixmap::MemoryOptim );.br while ( ... ) {.br // load tool bar pixmaps etc..br QPixmap *pixmap = new QPixmap(fileName);.br }.br QPixmap::setDefaultOptimization( QPixmap::NormalOptim );.br
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -