QImageWriter Class Reference
|
Константа | Значение | Описание |
---|---|---|
QImageWriter::DeviceError | 1 | QImageWriter encountered a device error when writing the image data. Consult your device for more details on what went wrong. |
QImageWriter::UnsupportedFormatError | 2 | Qt does not support the requested image format. |
QImageWriter::UnknownError | 0 | An unknown error occurred. If you get this value after calling write(), it is most likely caused by a bug in QImageWriter. |
Constructs an empty QImageWriter object. Before writing, you must call setFormat() to set an image format, then setDevice() or setFileName().
Constructs a QImageWriter object using the device device and image format format.
Constructs a QImageWriter objects that will write to a file with the name fileName, using the image format format. If format is not provided, QImageWriter will detect the image format by inspecting the extension of fileName.
Destructs the QImageWriter object.
Returns true if QImageWriter can write the image; i.e., the image format is supported and the assigned device is open for reading.
See also write(), setDevice(), and setFormat().
Returns the compression of the image.
See also setCompression().
Returns the device currently assigned to QImageWriter, or 0 if no device has been assigned.
Смотрите также setDevice().
Возвращает тип последней произошедшей ошибки.
See also ImageWriterError and errorString().
Returns a human readable description of the last error that occurred.
Смотрите также error().
If the currently assigned device is a QFile, or if setFileName() has been called, this function returns the name of the file QImageWriter writes to. Otherwise (i.e., if no device has been assigned or the device is not a QFile), an empty QString is returned.
See also setFileName() and setDevice().
Returns the format QImageWriter uses for writing images.
See also setFormat().
Returns the gamma level of the image.
See also setGamma().
Returns the quality level of the image.
See also setQuality().
This is an image format specific function that set the compression of an image. For image formats that do not support setting the compression, this value is ignored.
The value range of compression depends on the image format. For example, the "tiff" format supports two values, 0(no compression) and 1(LZW-compression).
See also compression().
Sets QImageWriter's device to device. If a device has already been set, the old device is removed from QImageWriter and is otherwise left unchanged.
If the device is not already open, QImageWriter will attempt to open the device in QIODevice::WriteOnly mode by calling open(). Note that this does not work for certain devices, such as QProcess, QTcpSocket and QUdpSocket, where more logic is required to open the device.
See also device() and setFileName().
Sets the file name of QImageWriter to fileName. Internally, QImageWriter will create a QFile and open it in QIODevice::WriteOnly mode, and use this file when writing images.
See also fileName() and setDevice().
Sets the format QImageWriter will use when writing images, to format. format is a case insensitive text string. Пример:
QImageWriter writer;
writer.setFormat("png"); // same as writer.setFormat("PNG");
You can call supportedImageFormats() for the full list of formats QImageWriter supports.
See also format().
This is an image format specific function that sets the gamma level of the image to gamma. For image formats that do not support setting the gamma level, this value is ignored.
The value range of gamma depends on the image format. For example, the "png" format supports a gamma range from 0.0 to 1.0.
See also gamma() and quality().
This is an image format specific function that sets the quality level of the image to quality. For image formats that do not support setting the quality, this value is ignored.
The value range of quality depends on the image format. For example, the "jpeg" format supports a quality range from 0 (low quality, high compression) to 100 (high quality, low compression).
See also quality().
Sets the image text associated with the key key to text. This is useful for storing copyright information or other information about the image. Пример:
QImage image("some/image.jpeg"); QImageWriter writer("images/outimage.png", "png"); writer.setText("Author", "John Smith"); writer.write(image);
If you want to store a single block of data (e.g., a comment), you can pass an empty key, or use a generic key like "Description".
The key and text will be embedded into the image data after calling write().
Support for this option is implemented through QImageIOHandler::Description.
Эта функция была введена в Qt 4.1.
See also QImage::setText() and QImageReader::text().
Returns the list of image formats supported by QImageWriter.
By default, Qt can write the following formats:
Формат | Описание |
---|---|
BMP | Windows Bitmap |
JPG | Joint Photographic Experts Group |
JPEG | Joint Photographic Experts Group |
PNG | Portable Network Graphics |
PPM | Portable Pixmap |
TIFF | Tagged Image File Format |
XBM | X11 Bitmap |
XPM | X11 Pixmap |
Reading and writing SVG files is supported through Qt's SVG Module.
See also setFormat(), QImageReader::supportedImageFormats(), and QImageIOPlugin.
Returns true if the writer supports option; otherwise returns false.
Different image formats support different options. Call this function to determine whether a certain option is supported by the current format. For example, the PNG format allows you to embed text into the image's metadata (see text()).
QImageWriter writer(fileName); if (writer.supportsOption(QImageIOHandler::Description)) writer.setText("Author", "John Smith");
Options can be tested after the writer has been associated with a format.
Эта функция была введена в Qt 4.2.
See also QImageReader::supportsOption() and setFormat().
Writes the image image to the assigned device or file name. Возвращает true, если всё прошло успешно; в противном случае возвращает false. If the operation fails, you can call error() to find the type of error that occurred, or errorString() to get a human readable description of the error.
See also canWrite(), error(), and errorString().
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) | Торговые марки | Qt 4.5.3 |
Попытка перевода Qt документации. Если есть желание присоединиться, или если есть замечания или пожелания, то заходите на форум: Перевод Qt документации на русский язык... Люди внесшие вклад в перевод: Команда переводчиков |