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

📄 qimage.3qt

📁 这个是Linux的qt源代码
💻 3QT
📖 第 1 页 / 共 4 页
字号:
This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a deep copy of a sub-area of the image..PPThe returned image is always \fIw\fR by \fIh\fR pixels in size, and is copied from position \fIx\fR, \fIy\fR in this image. In areas beyond this image pixels are filled with pixel 0..PPIf the image needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the \fIconversion_flags\fR to specify how you'd prefer this to happen..PPSee also bitBlt() and Qt::ImageConversionFlags..SH "QImage QImage::copy ( const QRect & r ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a deep copy of a sub-area of the image..PPThe returned image always has the size of the rectangle \fIr\fR. In areas beyond this image pixels are filled with pixel 0..SH "bool QImage::create ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )"Sets the image \fIwidth\fR, \fIheight\fR, \fIdepth\fR, its number of colors (in \fInumColors\fR), and bit order. Returns TRUE if successful, or FALSE if the parameters are incorrect or if memory cannot be allocated..PPThe \fIwidth\fR and \fIheight\fR is limited to 32767. \fIdepth\fR must be 1, 8, or 32. If \fIdepth\fR is 1, \fIbitOrder\fR must be set to either QImage::LittleEndian or QImage::BigEndian. For other depths \fIbitOrder\fR must be QImage::IgnoreEndian..PPThis function allocates a color table and a buffer for the image data. The image data is not initialized..PPThe image buffer is allocated as a single block that consists of a table of scanline pointers (jumpTable()) and the image data (bits())..PPSee also fill(), width(), height(), depth(), numColors(), bitOrder(), jumpTable(), scanLine(), bits(), bytesPerLine(), and numBytes()..SH "bool QImage::create ( const QSize &, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..SH "QImage QImage::createAlphaMask ( int conversion_flags = 0 ) const"Builds and returns a 1-bpp mask from the alpha buffer in this image. Returns a null image if alpha buffer mode is disabled..PPSee QPixmap::convertFromImage() for a description of the \fIconversion_flags\fR argument..PPThe returned image has little-endian bit order, which you can convert to big-endianness using convertBitOrder()..PPSee also createHeuristicMask(), hasAlphaBuffer(), and setAlphaBuffer()..SH "QImage QImage::createHeuristicMask ( bool clipTight = TRUE ) const"Creates and returns a 1-bpp heuristic mask for this image. It works by selecting a color from one of the corners, then chipping away pixels of that color starting at all the edges..PPThe four corners vote for which color is to be masked away. In case of a draw (this generally means that this function is not applicable to the image), the result is arbitrary..PPThe returned image has little-endian bit order, which you can convert to big-endianness using convertBitOrder()..PPIf \fIclipTight\fR is TRUE the mask is just large enough to cover the pixels; otherwise, the mask is larger than the data pixels..PPThis function disregards the alpha buffer..PPSee also createAlphaMask()..SH "int QImage::depth () const"Returns the depth of the image..PPThe image depth is the number of bits used to encode a single pixel, also called bits per pixel (bpp) or bit planes of an image..PPThe supported depths are 1, 8, 16 and 32..PPSee also convertDepth()..SH "void QImage::detach ()"Detaches from shared image data and makes sure that this image is the only one referring to the data..PPIf multiple images share common data, this image makes a copy of the data and detaches itself from the sharing mechanism. Nothing is done if there is just a single reference..PPSee also copy()..PPExample: themes/wood.cpp..SH "int QImage::dotsPerMeterX () const"Returns the number of pixels that fit horizontally in a physical meter. This and dotsPerMeterY() define the intended scale and aspect ratio of the image..PPSee also setDotsPerMeterX()..SH "int QImage::dotsPerMeterY () const"Returns the number of pixels that fit vertically in a physical meter. This and dotsPerMeterX() define the intended scale and aspect ratio of the image..PPSee also setDotsPerMeterY()..SH "void QImage::fill ( uint pixel )"Fills the entire image with the pixel value \fIpixel\fR..PPIf the depth of this image is 1, only the lowest bit is used. If you say fill(0), fill(2), etc., the image is filled with 0s. If you say fill(1), fill(3), etc., the image is filled with 1s. If the depth is 8, the lowest 8 bits are used..PPIf the depth is 32 and the image has no alpha buffer, the \fIpixel\fR value is written to each pixel in the image. If the image has an alpha buffer, only the 24 RGB bits are set and the upper 8 bits (alpha value) are left unchanged..PPNote: QImage::pixel() returns the color of the pixel at the given coordinates; QColor::pixel() returns the pixel value of the underlying window system (essentially an index value), so normally you will want to use QImage::pixel() to use a color from an existing image or QColor::rgb() to use a specific color..PPSee also invertPixels(), depth(), hasAlphaBuffer(), and create()..SH "QImage QImage::fromMimeSource ( const QString & abs_name )\fC [static]\fR"Convenience function. Gets the data associated with the absolute name \fIabs_name\fR from the default mime source factory and decodes it to an image..PPSee also QMimeSourceFactory, QImage::fromMimeSource(), and QImageDrag::decode()..SH "bool QImage::hasAlphaBuffer () const"Returns TRUE if alpha buffer mode is enabled; otherwise returns FALSE..PPSee also setAlphaBuffer()..SH "int QImage::height () const"Returns the height of the image..PPSee also width(), size(), and rect()..PPExamples:.)l canvas/canvas.cpp and opengl/texture/gltexobj.cpp..SH "const char * QImage::imageFormat ( const QString & fileName )\fC [static]\fR"Returns a string that specifies the image format of the file \fIfileName\fR, or 0 if the file cannot be read or if the format is not recognized..PPThe QImageIO documentation lists the guaranteed supported image formats, or use QImage::inputFormats() and QImage::outputFormats() to get lists that include the installed formats..PPSee also load() and save()..SH "QStringList QImage::inputFormatList ()\fC [static]\fR"Returns a list of image formats that are supported for image input..PPNote that if you want to iterate over the list, you should iterate over a copy, e.g..PP.nf.br    QStringList list = myImage.inputFormatList();.br    QStringList::Iterator it = list.begin();.br    while( it != list.end() ) {.br        myProcessing( *it );.br        ++it;.br    }.br.fi.PPSee also outputFormatList(), inputFormats(), and QImageIO..PPExample: showimg/showimg.cpp..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; otherwise returns FALSE..PPSee also allGray() and depth()..SH "bool QImage::isNull () const"Returns TRUE if it is a null image; otherwise returns FALSE..PPA null image has all parameters set to zero and no allocated data..PPExample: 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 a mirror of 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..PPNote that if you want to iterate over the list, you should iterate over a copy, e.g..PP.nf.br    QStringList list = myImage.outputFormatList();.br    QStringList::Iterator it = list.begin();.br    while( it != list.end() ) {.br        myProcessing( *it );.br        ++it;.br    }.br.fi.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()..PPExamples:.)l canvas/canvas.cpp and 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..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.

⌨️ 快捷键说明

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