The Qimage of QT

Source: Internet
Author: User
Tags bmp image int size

qimage::qimage ()

Constructs an empty Qimage object, at which point the returned object, if called IsNull, returns a value of True qimage::qimage (const qsize & size, Format format)

Premultiplied, which is the number of bits per pixel to store.

Qimage::format_rgb32

4

The image is stored using a 32-bit RGB format (0xffRRGGBB).

Qimage::format_argb32

5

The image is stored using a 32-bit ARGB format (0xAARRGGBB).

qimage::qimage (int width, int height, format format)

Constructs an image that is width width, height height, formatted format, and returns a null image object if memory allocation fails

qimage::qimage (uchar * data, int width, int height, format format, qimagecleanupfunction cleanupfunction = 0, void *cleanupinfo = 0)

Constructs an image object based on existing data

qimage:: Qimage(uchar * data, int width, int height, int bytesperline, Format Format, qimagecleanupfunction cleanupfunction = 0, void * cleanupinfo = 0)

Constructs an object based on existing data

Where the byteperline algorithm is

(Image width * Image bits/8 bit bit +3 (in order not to lose data))/4 * 4 so that the number of bytes per row is the size of an integer multiple of 4

Bitmap:

The data block portion of a BMP file is not directly stored after a pixel array. In order to ensure that the number of bytes per row is divisible by 4, it is often necessary to add up to 3 bytes of redundant information after each row of data.

X*y size 24-bit BMP image, each pixel accounted for 3 bytes, if x*3 can not be divisible by 4, then each line may be x*3+1, x*3+2 or x*3+3, depending on which value can be divisible by 4.

qimage:: Qimage(const QString & fileName, const char * format = 0)

Constructs an image object from a file

int Qimage::bitplanecount () const

Returns the number of bitmap planes. That is, how many bits make up a pixel, 32,24 8, 1,

uchar * qimage::bits ()

Returns the first address pointing to the image memory int qimage::bytecount () const

Returns the size of the image that is stored int qimage::bytesperline () const

Returns the number of bytes per row of an image

Equivalent to ByteCount ()/height ()

Qrgb qimage::color (int i) const

Returns the RGB value of the I position in the color table int qimage::colorcount () const

Returns the number of colors in a color table

qvector<Qrgb> qimage::colortable () const

Returns the color table qimage qimage::converttoformat (format format, qt::i Mageconversionflags flags = qt::autocolor) const

Convert image format

qimage qimage::copy (const qrect & rectangle = qrect ()) const

Qimage object that returns the size of a sub-region of an image

Qimage qimage::copy(int x, int y, int width, int height) const

Ditto

qimage qimage::createalphamask (qt::imageconversionflags flags = Qt:: Autocolor) Const

Create a transparent mask for each pixel

Qimage qimage::createmaskfromcolor(qrgb color, qt::maskmode mode = Qt:: Maskincolor) Const

 

int qimage::depth() const

returns how many bits of a pixel are needed to save.

 

Format qimage::format() const

 

returns the format of an image

 

Qimage qimage::fromdata(const uchar * data, int size, const char * format = 0)

constructs an image object from a piece of memory in the specified format qimage qimage::fromdata (const qbytearray & data, const char * format = 0)

 

void Qimage::invertpixels(invertmode mode = Invertrgb)

 

invert pixels bool Qimage::load (const QString & fileName, const char * format = 0)

loads images from a file in the specified format bool Qimage::load (qiodevice * device, const char * format)

 

from one device, load the image

bool Qimage::loadfromdata (const uchar * data, int len, const char * format = 0) /c2>

 

loads an image from a specified piece of memory Qrgb qimage::p ixel (const qpoint & position) const

returns the pixel of a point

bool Qimage::save (const QString & fileName, const char * format = 0, int quality =-1) const

Save to file

 


bool Qimage::save (qiodevice * device, const char * format = 0, int quality =-1) const

 

saved to a device.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.