📄 qimage.3qt
字号:
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 guaranteed supported image formats, or use the QImage::inputFormats() QImage::outputFormats() to get lists that include installed formats..PPSee also load() and save()..SH "QStringList QImage::inputFormatList () \fC[static]\fR"Returns a list of image formats which are supported for image input..SH "QStrList QImage::inputFormats () \fC[static]\fR"Returns a list of image formats which are supported for image input..PPSee also inputFormatList()..SH "void QImage::invertPixels ( bool invertAlpha = TRUE )"Inverts all pixel values in the image..PPFor 32 bit (24 RGB + alpha buffer) images, set \fIinvertAlpha\fR to FALSE if you want the alpha bits to be unchanged, otherwise they are inverted too..SH "bool QImage::isGrayscale () const"Returns TRUE if the image is allGray(), \fIand\fR if the image is 32-bpp or a 256-color 8-bpp image for which color(i) is QRgb(i,i,i)..SH "bool QImage::isNull () const"Returns TRUE if it is a null image..PPA null image has all parameters set to zero and no allocated data..PPExamples:.(lqtimage/qtimage.cpp.)l.SH "uchar ** QImage::jumpTable () const"Returns a pointer to the scanline pointer table..PPThis is the beginning of the data block for the image..SH "bool QImage::load ( const QString & fileName, const char * format=0 )"Loads an image from the file \fIfileName.\fR Returns TRUE if successful, or FALSE if the image could not be loaded..PPIf \fIformat\fR is specified, the loader attempts to read the image using the specified format. If \fIformat\fR is not specified (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 binary data in \fIbuf\fR (\fIlen\fR bytes). Returns TRUE if successful, or FALSE if the image could not be loaded..PPIf \fIformat\fR is specified, the loader attempts to read the image using the specified format. If \fIformat\fR is not specified (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 differs from the above function only in what argument(s) it accepts..PPLoads from a QByteArray..SH "QImage QImage::mirror () const"Returns a QImage which is a vertically mirrored copy of this image. The original QImage is left unchanged..SH "QImage QImage::mirror ( bool horizontal, bool vertical ) const"Returns the image mirrored in the horizontal and/or vertical direction..PPSee also smoothScale()..SH "int QImage::numBytes () const"Returns the number of bytes occupied by the image data..PPSee also bytesPerLine()..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, since these images do not use color tables, but instead encode pixel values as RGB triplets..SH "QPoint QImage::offset () const"Returns the number of pixels by which the image is intended to by offset by when positioning relative to other images..SH "bool QImage::operator!= ( const QImage & i ) const"Returns TRUE if this image and \fIi\fR have different contents, and FALSE if they they have the same. This can be slow. Of course, this function returns quickly if e.g. the two images' widths are different..PPSee also operator=()..SH "QImage & QImage::operator= ( const QPixmap & pixmap )"Sets 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 "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 "bool QImage::operator== ( const QImage & i ) const"Returns TRUE if this image and \fIi\fR have the same contents, and FALSE if they differ. This can be slow. Of course, this function returns quickly if e.g. the two images' widths are different..PPSee also operator=()..SH "QStringList QImage::outputFormatList () \fC[static]\fR"Returns a list of image formats which are supported for image output..SH "QStrList QImage::outputFormats () \fC[static]\fR"Returns a list of image formats which are supported for image output..PPSee also QImage::outputFormatList()..SH "QRgb QImage::pixel ( int x, int y ) const"Returns the actual color of the pixel at the given coordinates..PPIf (x,y) is not on the image, the results are undefined..PPSee also setPixel(), qRed(), qGreen() and qBlue()..PPExamples:.(lqmag/qmag.cpp.)l.SH "int QImage::pixelIndex ( int x, int y ) const"Returns the pixel index at the given coordinates..PPIf (x,y) is not valid, or if the image is not a paletted image (depth() > 8), the results are undefined..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..PPExamples:.(lqtimage/qtimage.cpp.)l.SH "bool QImage::save ( const QString & fileName, const char * format ) const"Saves the image to the file \fIfileName,\fR using the image file format \fIformat\fR and default quality settings. Returns TRUE if successful, or FALSE if the image could not be saved..PPSee also load(), loadFromData(), imageFormat(), QPixmap::save() and QImageIO..SH "bool QImage::save ( const QString & fileName, const char * format, int quality ) const"Saves the image to the file \fIfileName,\fR using the image file format \fIformat\fR and a quality factor \fIquality. quality\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 image could not be saved..PPSee also load(), loadFromData(), imageFormat(), QPixmap::save() and QImageIO..SH "uchar * QImage::scanLine ( int i ) const"Returns a pointer to the pixel data at the \fIi'th\fR scanline..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 bits()..PPExamples:.(ldesktop/desktop.cpp.)l.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()..PPExamples:.(ldesktop/desktop.cpp.)l.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 color() and setColor()..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 given coordinates..PPIf (x,y) is not valid, or if the image is a paletted image (depth() <= 8) and \fIindex_or_rgb\fR >= numColors(), the results are undefined..PPSee also qRgb() and qRgba()..SH "void QImage::setText ( const char * key, const char * lang, const QString & s )"Records \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..PPNote that no QImageIO handlers currently read or write this data. In an upcoming Qt version, PNG I/O will do so..SH "QSize QImage::size () const"Returns the size of the image..PPSee also width(), height() and rect()..SH "QImage QImage::smoothScale ( int width, int height ) const"Returns a copy of the image smoothly scaled to \fIwidth\fR by \fIheight\fR pixels. For 32-bpp images, and 1-bpp/8-bpp color images, the result will be 32-bpp, while 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 mirror()..SH "QImage QImage::swapRGB () const"Returns a QImage where the values of the red and blue components of all pixels have been swapped, effectively converting a RGB image to a BGR image. The original QImage is left unchanged..SH "QImage::Endian QImage::systemBitOrder() \fC[static]\fR"Determines the bit order of the display hardware. Returns QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first)..SH "QImage::Endian QImage::systemByteOrder() \fC[static]\fR"Determines the host computer byte order. Returns QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first)..SH "QString QImage::text ( const QImageTextKeyLang & kl ) const"Returns the string recorded for the keyword and language \fIkl,\fR or in a default language if \fIlang\fR is 0..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 "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 which enumerate all the texts key/languaage pairs set by setText() for this image..SH "bool QImage::valid ( int x, int y ) const"Tests if the ( \fIx, y\fR ) is a valid coordinate in the image..PPExamples:.(lqmag/qmag.cpp.)l.SH "int QImage::width () const"Returns the width of the image..PPSee also height(), size() and rect()..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator<< (QDataStream & s, const QImage & image)"Writes an image to the stream 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..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 make our job much simpler. Thank you..PIn case of content or formattting problems with this manual page, pleasereport them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qimage.3qt) and the Qtversion (2.3.2).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -