Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Tous les espaces de nom  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Qt 3 Support Members for QImage

The following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code.

Public Types

  • enum Endian { IgnoreEndian, BigEndian, LittleEndian }

Public Functions

  • QImage ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
  • QImage ( const QSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
  • QImage ( uchar * data, int width, int height, int depth, const QRgb * colortable, int numColors, Endian bitOrder )
  • QImage ( uchar * data, int width, int height, int depth, int bytesPerLine, const QRgb * colortable, int numColors, Endian bitOrder )
  • QImage ( const QByteArray & data )
  • Endian bitOrder () const
  • QImage convertBitOrder ( Endian bitOrder ) const
  • QImage convertDepth ( int depth, Qt::ImageConversionFlags flags = Qt::AutoColor ) const
  • QImage convertDepthWithPalette ( int depth, QRgb * palette, int palette_count, Qt::ImageConversionFlags flags = Qt::AutoColor ) const
  • QImage copy ( int x, int y, int w, int h, Qt::ImageConversionFlags flags ) const
  • QImage copy ( const QRect & rect, Qt::ImageConversionFlags flags ) const
  • bool create ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
  • bool create ( const QSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
  • bool hasAlphaBuffer () const
  • void invertPixels ( bool invertAlpha )
  • uchar ** jumpTable ()
  • const uchar * const * jumpTable () const
  • QImage mirror ( bool horizontal = false, bool vertical = true ) const
  • void reset ()
  • QImage scaleHeight ( int h ) const
  • QImage scaleWidth ( int w ) const
  • void setAlphaBuffer ( bool enable )
  • QImage smoothScale ( int width, int height, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const
  • QImage smoothScale ( const QSize & size, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const
  • QImage swapRGB () const
  • QImage xForm ( const QMatrix & matrix ) const

Static Public Members

Related Non-Members

  • void bitBlt ( QImage * dst, int dx, int dy, const QImage * src, int sx = 0, int sy = 0, int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor )

Member Type Documentation

enum QImage::Endian

This enum type is used to describe the endianness of the CPU and graphics hardware. It is provided here for compatibility with earlier versions of Qt.

Use the Format enum instead. The Format enum specify the endianess for monchrome formats, but for other formats the endianess is not relevant.

ConstantValueDescription
QImage::IgnoreEndian2Endianness does not matter. Useful for some operations that are independent of endianness.
QImage::BigEndian0Most significant bit first or network byte order, as on SPARC, PowerPC, and Motorola CPUs.
QImage::LittleEndian1Least significant bit first or little endian byte order, as on Intel x86.


Member Function Documentation

QImage::QImage ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )

Constructs an image with the given width, height, depth, numColors colors and bitOrder.

Use the constructor that accepts a width, a height and a format (i.e. specifying the depth and bit order), in combination with the setNumColors() function, instead.

For example, if you have code like

 QImage image(width, height, depth, numColors);

you can rewrite it as

 QImage image(width, height, format);

 // For 8 bit images the default number of colors is 256. If
 // another number of colors is required it can be specified
 // using the setNumColors() function.
 image.setNumColors(numColors);

QImage::QImage ( const QSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )

Constructs an image with the given size, depth, numColors and bitOrder.

Use the constructor that accepts a size and a format (i.e. specifying the depth and bit order), in combination with the setNumColors() function, instead.

For example, if you have code like

 QSize mySize(width, height);
 QImage image(mySize, depth, numColors);

you can rewrite it as

 QSize mySize(width, height);
 QImage image(mySize, format);

 // For 8 bit images the default number of colors is 256. If
 // another number of colors is required it can be specified
 // using the setNumColors() function.
 image.setNumColors(numColors);

QImage::QImage ( uchar * data, int width, int height, int depth, const QRgb * colortable, int numColors, Endian bitOrder )

Constructs an image with the given width, height, depth, colortable, numColors and bitOrder, that uses an existing memory buffer, data.

Use the constructor that accepts a uchar pointer, a width, a height and a format (i.e. specifying the depth and bit order), in combination with the setColorTable() function, instead.

For example, if you have code like

 uchar *myData;
 QRgb *myColorTable;

 QImage image(myData, width, height, depth,
                        myColorTable, numColors, IgnoreEndian);

you can rewrite it as

 uchar *myData;
 QVector<QRgb> myColorTable;

 QImage image(myData, width, height, format);
 image.setColorTable(myColorTable);

QImage::QImage ( uchar * data, int width, int height, int depth, int bytesPerLine, const QRgb * colortable, int numColors, Endian bitOrder )

Constructs an image with the given width, height, depth, bytesPerLine, colortable, numColors and bitOrder, that uses an existing memory buffer, data. The image does not delete the buffer at destruction.

Warning: This constructor is only available in Qtopia Core.

The data has to be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned, so it's no longer possible to specify a custom bytesPerLine value.

QImage::QImage ( const QByteArray & data )

Use the static fromData() function instead.

For example, if you have code like

 QByteArray data;
 ...
 QImage image(data);

you can rewrite it as

 QByteArray data;
 ...
 QImage image = QImage::fromData(data);

Endian QImage::bitOrder () const

Returns the bit order for the image. If it is a 1-bpp image, this function returns either QImage::BigEndian or QImage::LittleEndian. Otherwise, this function returns QImage::IgnoreEndian.

Use the format() function instead for the monochrome formats. For non-monochrome formats the bit order is irrelevant.

QImage QImage::convertBitOrder ( Endian bitOrder ) const

Converts the bit order of the image to the given bitOrder and returns the converted image. The original image is not changed. Returns this image if the given bitOrder is equal to the image current bit order, or a null image if this image cannot be converted.

Use convertToFormat() instead.

QImage QImage::convertDepth ( int depth, Qt::ImageConversionFlags flags = Qt::AutoColor ) const

Converts the depth (bpp) of the image to the given depth and returns the converted image. The original image is not changed. Returns this image if depth is equal to the image depth, or a null image if this image cannot be converted. The depth argument must be 1, 8 or 32. If the image needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to specify how you'd prefer this to happen.

Use the convertToFormat() function instead.

QImage QImage::convertDepthWithPalette ( int depth, QRgb * palette, int palette_count, Qt::ImageConversionFlags flags = Qt::AutoColor ) const

Returns an image with the given depth, using the palette_count colors pointed to by palette. If depth is 1 or 8, the returned image will have its color table ordered in the same way as palette.

If the image needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to specify how you'd prefer this to happen.

Note: currently no closest-color search is made. If colors are found that are not in the palette, the palette may not be used at all. This result should not be considered valid because it may change in future implementations.

Currently inefficient for non-32-bit images.

Use the convertToFormat() function in combination with the setColorTable() function instead.

QImage QImage::copy ( int x, int y, int w, int h, Qt::ImageConversionFlags flags ) const

This is an overloaded member function, provided for convenience.

Use copy() instead.

QImage QImage::copy ( const QRect & rect, Qt::ImageConversionFlags flags ) const

This is an overloaded member function, provided for convenience.

Use copy() instead.

bool QImage::create ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )

Sets the image width, height, depth, its number of colors (in numColors), and bit order. Returns true if successful, or false if the parameters are incorrect or if memory cannot be allocated.

The width and height is limited to 32767. depth must be 1, 8, or 32. If depth is 1, bitOrder must be set to either QImage::LittleEndian or QImage::BigEndian. For other depths bitOrder must be QImage::IgnoreEndian.

This function allocates a color table and a buffer for the image data. The image data is not initialized. The image buffer is allocated as a single block that consists of a table of scanLine() pointers (jumpTable()) and the image data (bits()).

Use a QImage constructor instead.

bool QImage::create ( const QSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )

This is an overloaded member function, provided for convenience.

The width and height are specified in the size argument.

Use a QImage constructor instead.

bool QImage::hasAlphaBuffer () const

Returns true if alpha buffer mode is enabled; otherwise returns false.

Use the hasAlphaChannel() function instead.

void QImage::invertPixels ( bool invertAlpha )

This is an overloaded member function, provided for convenience.

Use the invertPixels() function that takes a QImage::InvertMode parameter instead.

uchar ** QImage::jumpTable ()

Returns a pointer to the scanline pointer table. This is the beginning of the data block for the image.

Use the bits() or scanLine() function instead.

const uchar * const * QImage::jumpTable () const

This is an overloaded member function, provided for convenience.

QImage QImage::mirror ( bool horizontal = false, bool vertical = true ) const

Use mirrored() instead.

void QImage::reset ()

Resets all image parameters and deallocates the image data.

Assign a null image instead.

For example, if you have code like

 QImage image;
 image.reset();

you can rewrite it as

 QImage image;
 image = QImage();

QImage QImage::scaleHeight ( int h ) const

Use scaledToHeight() instead.

QImage QImage::scaleWidth ( int w ) const

Use scaledToWidth() instead.

void QImage::setAlphaBuffer ( bool enable )

Enables alpha buffer mode if enable is true, otherwise disables it. The alpha buffer is used to set a mask when a QImage is translated to a QPixmap.

If a monochrome or indexed 8-bit image has alpha channels in their color tables they will automatically detect that they have an alpha channel, so this function is not required. To force alpha channels on 32-bit images, use the convertToFormat() function.

See also hasAlphaBuffer().

QImage QImage::smoothScale ( int width, int height, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const

Use scaled() instead.

For example, if you have code like

 QImage image;
 image.smoothScale(width, height, mode);

you can rewrite it as

 QImage image;
 image.scaled(width, height, mode, Qt::SmoothTransformation);

QImage QImage::smoothScale ( const QSize & size, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio ) const

This is an overloaded member function, provided for convenience.

Use scaled() instead.

For example, if you have code like

 QImage image;
 image.smoothScale(size, mode);

you can rewrite it as

 QImage image;
 image.scaled(size, mode, Qt::SmoothTransformation);

QImage QImage::swapRGB () const

Use rgbSwapped() instead.

Endian QImage::systemBitOrder ()   [static]

Determines the bit order of the display hardware. Returns QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first).

This function is no longer relevant for QImage. Use QSysInfo instead.

Endian QImage::systemByteOrder ()   [static]

Determines the host computer byte order. Returns QImage::LittleEndian (LSB first) or QImage::BigEndian (MSB first).

This function is no longer relevant for QImage. Use QSysInfo instead.

QImage QImage::xForm ( const QMatrix & matrix ) const

Use transformed() instead.

For example, if you have code like

 QImage image;
 ...
 image.xForm(matrix);

you can rewrite it as

 QImage image;
 ...
 image.transformed(matrix);

Related Non-Members

void bitBlt ( QImage * dst, int dx, int dy, const QImage * src, int sx = 0, int sy = 0, int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor )

Copies a block of pixels from src to dst. The pixels copied from source (src) are converted according to flags if it is incompatible with the destination (dst).

sx, sy is the top-left pixel in src, dx, dy is the top-left position in dst and sw, sh is the size of the copied block. The copying is clipped if areas outside src or dst are specified. If sw is -1, it is adjusted to src->width(). Similarly, if sh is -1, it is adjusted to src->height().

Currently inefficient for non 32-bit images.

Use copy() or QPainter::drawImage() instead.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Extension de Qt WebKit

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.3
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web