⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qimage.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
📖 第 1 页 / 共 3 页
字号:
.SH "QStrList QImage::inputFormats ()\fC [static]\fR"Returns a list of image formats that are supported for image input..PPSee also outputFormats(), inputFormatList() and QImageIO..SH "void QImage::invertPixels ( bool invertAlpha = TRUE )"Inverts all pixel values in the image..PPIf the depth is 32: if \fIinvertAlpha\fR is TRUE, the alpha bits are also inverted, otherwise they are left unchanged..PPIf the depth is not 32, the argument \fIinvertAlpha\fR has no meaning..PPNote that inverting an 8-bit image means to replace all pixels using color index \fIi\fR with a pixel using color index 255 minus \fIi\fR. Similarly for a 1-bit image. The color table is not changed..PPSee also fill(), depth() and hasAlphaBuffer()..SH "bool QImage::isGrayscale () const"For 16-bit and 32-bit images, this function is equivalent to allGray()..PPFor 8-bpp images, this function returns TRUE if color(i) is QRgb(i,i,i) for all indices of the color table..PPSee also allGray() and depth()..SH "bool QImage::isNull () const"Returns TRUE if it is a null image, otherwise FALSE..PPA null image has all parameters set to zero and no allocated data..PPExamples:.)l qtimage/qtimage.cpp and showimg/showimg.cpp..SH "uchar ** QImage::jumpTable () const"Returns a pointer to the scanline pointer table..PPThis is the beginning of the data block for the image..PPSee also bits() and scanLine()..SH "bool QImage::load ( const QString & fileName, const char * format = 0 )"Loads an image from the file \fIfileName\fR. Returns TRUE if the image was successfully loaded; otherwise returns FALSE..PPIf \fIformat\fR is specified, the loader attempts to read the image using the specified format. If \fIformat\fR is not specified (which is the default), the loader reads a few bytes from the header to guess the file format..PPThe QImageIO documentation lists the supported image formats and explains how to add extra formats..PPSee also loadFromData(), save(), imageFormat(), QPixmap::load() and QImageIO..SH "bool QImage::loadFromData ( const uchar * buf, uint len, const char * format = 0 )"Loads an image from the first \fIlen\fR bytes of binary data in \fIbuf\fR. Returns TRUE if the image was successfully loaded; otherwise returns FALSE..PPIf \fIformat\fR is specified, the loader attempts to read the image using the specified format. If \fIformat\fR is not specified (which is the default), the loader reads a few bytes from the header to guess the file format..PPThe QImageIO documentation lists the supported image formats and explains how to add extra formats..PPSee also load(), save(), imageFormat(), QPixmap::loadFromData() and QImageIO..SH "bool QImage::loadFromData ( QByteArray buf, const char * format = 0 )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPLoads an image from the QByteArray \fIbuf\fR..SH "QImage QImage::mirror () const"Returns a QImage which is a vertically mirrored copy of this image. The original QImage is not changed..SH "QImage QImage::mirror ( bool horizontal, bool vertical ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns the image mirrored in the horizontal and/or the vertical direction depending on whether \fIhorizontal\fR and \fIvertical\fR are set to TRUE or FALSE. The original image is not changed..PPSee also smoothScale()..SH "int QImage::numBytes () const"Returns the number of bytes occupied by the image data..PPSee also bytesPerLine() and bits()..SH "int QImage::numColors () const"Returns the size of the color table for the image..PPNotice that numColors() returns 0 for 16-bpp and 32-bpp images because these images do not use color tables, but instead encode pixel values as RGB triplets..PPSee also setNumColors() and colorTable()..PPExample: themes/wood.cpp..SH "QPoint QImage::offset () const"Returns the number of pixels by which the image is intended to be offset by when positioning relative to other images..SH "bool QImage::operator!= ( const QImage & i ) const"Returns TRUE if this image and image \fIi\fR have different contents; otherwise returns FALSE. The comparison can be slow, unless there is some obvious difference, such as different widths, in which case the function will return quickly..PPSee also operator=()..SH "QImage & QImage::operator= ( const QImage & image )"Assigns a shallow copy of \fIimage\fR to this image and returns a reference to this image..PPSee also copy()..SH "QImage & QImage::operator= ( const QPixmap & pixmap )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the image bits to the \fIpixmap\fR contents and returns a reference to the image..PPIf the image shares data with other images, it will first dereference the shared data..PPMakes a call to QPixmap::convertToImage()..SH "bool QImage::operator== ( const QImage & i ) const"Returns TRUE if this image and image \fIi\fR have the same contents; otherwise returns FALSE. The comparison can be slow, unless there is some obvious difference, such as different widths, in which case the function will return quickly..PPSee also operator=()..SH "QStringList QImage::outputFormatList ()\fC [static]\fR"Returns a list of image formats that are supported for image output..PPSee also inputFormatList(), outputFormats() and QImageIO..SH "QStrList QImage::outputFormats ()\fC [static]\fR"Returns a list of image formats that are supported for image output..PPSee also inputFormats(), outputFormatList() and QImageIO..PPExample: showimg/showimg.cpp..SH "QRgb QImage::pixel ( int x, int y ) const"Returns the color of the pixel at the coordinates (\fIx\fR, \fIy\fR)..PPIf (\fIx\fR, \fIy\fR) is not on the image, the results are undefined..PPSee also setPixel(), qRed(), qGreen(), qBlue() and valid()..PPExample: qmag/qmag.cpp..SH "int QImage::pixelIndex ( int x, int y ) const"Returns the pixel index at the given coordinates..PPIf (\fIx\fR, \fIy\fR) is not valid, or if the image is not a paletted image (depth() > 8), the results are undefined..PPSee also valid() and depth()..SH "QRect QImage::rect () const"Returns the enclosing rectangle (0,0,width(),height()) of the image..PPSee also width(), height() and size()..SH "void QImage::reset ()"Resets all image parameters and deallocates the image data..PPExample: qtimage/qtimage.cpp..SH "bool QImage::save ( const QString & fileName, const char * format, int quality = -1 ) const"Saves the image to the file \fIfileName\fR, using the image file format \fIformat\fR and a quality factor of \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 (the default) to use the default settings..PPReturns TRUE if the image was successfully saved; otherwise returns FALSE..PPSee also load(), loadFromData(), imageFormat(), QPixmap::save() and QImageIO..SH "QImage QImage::scale ( int w, int h, ScaleMode mode = ScaleFree ) const"Returns a scaled copy of the image. The returned image has a size of width \fIw\fR by height \fIh\fR pixels if \fImode\fR is ScaleFree. The modes ScaleMin and ScaleMax may be used to preserve the ratio of the image: if \fImode\fR is ScaleMin, the returned image is guaranteed to fit into the rectangle specified by \fIw\fR and \fIh\fR (it is as large as possible within the constraints); if \fImode\fR is ScaleMax, the returned image fits at least into the specified rectangle (it is a small as possible within the constraints)..PPIf either the width \fIw\fR or the height \fIh\fR is 0 or negative, this function returns a null image..PPThis function uses a rather simple algorithm; if you need a better quality, use smoothScale() instead..PPSee also scaleWidth(), scaleHeight(), smoothScale() and xForm()..SH "QImage QImage::scale ( const QSize & s, ScaleMode mode = ScaleFree ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThe requested size of the image is \fIs\fR..SH "QImage QImage::scaleHeight ( int h ) const"Returns a scaled copy of the image. The returned image has a height of \fIh\fR pixels. This function automatically calculates the width of the image so that the ratio of the image is preserved..PPIf \fIh\fR is 0 or negative a null image is returned..PPSee also scale(), scaleWidth(), smoothScale() and xForm()..SH "QImage QImage::scaleWidth ( int w ) const"Returns a scaled copy of the image. The returned image has a width of \fIw\fR pixels. This function automatically calculates the height of the image so that the ratio of the image is preserved..PPIf \fIw\fR is 0 or negative a null image is returned..PPSee also scale(), scaleHeight(), smoothScale() and xForm()..SH "uchar * QImage::scanLine ( int i ) const"Returns a pointer to the pixel data at the scanline with index \fIi\fR. The first scanline is at index 0..PPThe scanline data is aligned on a 32-bit boundary..PP\fBWarning:\fR If you are accessing 32-bpp image data, cast the returned pointer to \fCQRgb*\fR (QRgb has a 32-bit size) and use it to read/write the pixel value. You cannot use the \fCuchar*\fR pointer directly, because the pixel format depends on the byte order on the underlying platform. Hint: use qRed() and friends (qcolor.h) to access the pixels..PP\fBWarning:\fR If you are accessing 16-bpp image data, you have to handle endianness yourself for now..PPSee also bytesPerLine(), bits() and jumpTable()..PPExample: desktop/desktop.cpp..SH "void QImage::setAlphaBuffer ( bool enable )"Enables alpha buffer mode if \fIenable\fR is TRUE, otherwise disables it. The default setting is disabled..PPAn 8-bpp image has 8-bit pixels. A pixel is an index into the color table, which contains 32-bit color values. In a 32-bpp image, the 32-bit pixels are the color values..PPThis 32-bit value is encoded as follows: The lower 24 bits are used for the red, green, and blue components. The upper 8 bits contain the alpha component..PPThe alpha component specifies the transparency of a pixel. 0 means completely transparent and 255 means opaque. The alpha component is ignored if you do not enable alpha buffer mode..PPThe alpha buffer is used to set a mask when a QImage is translated to a QPixmap..PPSee also hasAlphaBuffer() and createAlphaMask()..SH "void QImage::setColor ( int i, QRgb c )"Sets a color in the color table at index \fIi\fR to \fIc\fR..PPA color value is an RGB triplet. Use the qRgb function (defined in qcolor.h) to make RGB triplets..PPSee also color(), setNumColors() and numColors()..PPExamples:.)l desktop/desktop.cpp and themes/wood.cpp..SH "void QImage::setDotsPerMeterX ( int x )"Sets the value returned by dotsPerMeterX() to \fIx\fR..SH "void QImage::setDotsPerMeterY ( int y )"Sets the value returned by dotsPerMeterY() to \fIy\fR..SH "void QImage::setNumColors ( int numColors )"Resizes the color table to \fInumColors\fR colors..PPIf the color table is expanded, then all new colors will be set to black (RGB 0,0,0)..PPSee also numColors(), color(), setColor() and colorTable()..SH "void QImage::setOffset ( const QPoint & p )"Sets the value returned by offset() to \fIp\fR..SH "void QImage::setPixel ( int x, int y, uint index_or_rgb )"Sets the pixel index or color at the coordinates (\fIx\fR, \fIy\fR) to \fIindex_or_rgb\fR..PPIf (\fIx\fR, \fIy\fR) is not valid, the result is undefined..PPIf the image is a paletted image (depth() <= 8) and \fIindex_or_rgb\fR >= numColors(), the result is undefined..PPSee also pixelIndex(), pixel(), qRgb(), qRgba() and valid()..SH "void QImage::setText ( const char * key, const char * lang, const QString & s )"Records string \fIs\fR for the keyword \fIkey\fR. The \fIkey\fR should be a portable keyword recognizable by other software - some suggested values can be found in the PNG specification. \fIs\fR can be any text. \fIlang\fR should specify the language code (see RFC 1766) or 0..SH "QSize QImage::size () const"Returns the size of the image, i.e. its width and height..PPSee also width(), height() and rect()..SH "QImage QImage::smoothScale ( int w, int h, ScaleMode mode = ScaleFree ) const"Returns a smoothly scaled copy of the image. The returned image has a size of width \fIw\fR by height \fIh\fR pixels if \fImode\fR is ScaleFree. The modes ScaleMin and ScaleMax may be used to preserve the ratio of the image: if \fImode\fR is ScaleMin, the returned image is guaranteed to fit into the rectangle specified by \fIw\fR and \fIh\fR (it is as large as possible within the constraints); if \fImode\fR is ScaleMax, the returned image fits at least into the specified rectangle (it is a small as possible within the constraints)..PPFor 32-bpp images and 1-bpp/8-bpp color images the result will be 32-bpp, whereas all-gray images (including black-and-white 1-bpp) will produce 8-bit grayscale images with the palette spanning 256 grays from black to white..PPThis function uses code based on pnmscale.c by Jef Poskanzer..PPpnmscale.c - read a portable anymap and scale it.PPCopyright (C) 1989, 1991 by Jef Poskanzer..PPPermission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty..PPSee also scale() and mirror()..SH "QImage QImage::smoothScale ( const QSize & s, ScaleMode mode = ScaleFree ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThe requested size of the image is \fIs\fR..SH "QImage QImage::swapRGB () const"Returns a QImage in which the values of the red and blue components of all pixels have been swapped, effectively converting an RGB image to a BGR image. The original QImage is not changed..SH "Endian QImage::systemBitOrder ()\fC [static]\fR"Determines the bit order of the display hardware. Returns QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first)..PPSee also systemByteOrder()..SH "Endian QImage::systemByteOrder ()\fC [static]\fR"Determines the host computer byte order. Returns QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first)..PPSee also systemBitOrder()..SH "QString QImage::text ( const char * key, const char * lang = 0 ) const"Returns the string recorded for the keyword \fIkey\fR in language \fIlang\fR, or in a default language if \fIlang\fR is 0..SH "QString QImage::text ( const QImageTextKeyLang & kl ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns the string recorded for the keyword and language \fIkl\fR..SH "QStringList QImage::textKeys () const"Returns the keywords for which some texts are recorded..PPSee also textList(), text(), setText() and textLanguages()..SH "QStringList QImage::textLanguages () const"Returns the language identifiers for which some texts are recorded..PPSee also textList(), text(), setText() and textKeys()..SH "QValueList<QImageTextKeyLang> QImage::textList () const"Returns a list of QImageTextKeyLang objects that enumerate all the texts key/language pairs set by setText() for this image..SH "bool QImage::valid ( int x, int y ) const"Returns TRUE if ( \fIx\fR, \fIy\fR ) is a valid coordinate in the image, otherwise it returns FALSE..PPSee also width(), height() and pixelIndex()..PPExample: qmag/qmag.cpp..SH "int QImage::width () const"Returns the width of the image..PPSee also height(), size() and rect()..PPExample: opengl/texture/gltexobj.cpp..SH "QImage QImage::xForm ( const QWMatrix & matrix ) const"Returns a copy of the image that is transformed using the transformation matrix, \fImatrix\fR..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 scale(), QPixmap::xForm(), QPixmap::trueMatrix() and QWMatrix..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator<< ( QDataStream & s, const QImage & image )"Writes the image \fIimage\fR to the stream \fIs\fR as a PNG image..PPSee also QImage::save() and Format of the QDataStream operators..SH "QDataStream & operator>> ( QDataStream & s, QImage & image )"Reads an image from the stream \fIs\fR and stores it in \fIimage\fR..PPSee also QImage::load() and Format of the QDataStream operators..SH "SEE ALSO".BR http://doc.trolltech.com/qimage.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 (qimage.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -