• PySide 模块
  • PySide.QtGui
  • 内容表

    上一话题

    QPixmapCache.Key

    下一话题

    QImageIOHandler

    QPictureIO

    概要

    函数

    静态函数

    详细描述

    PySide.QtGui.QPictureIO class contains parameters for loading and saving pictures.

    PySide.QtGui.QPictureIO contains a PySide.QtCore.QIODevice object that is used for picture data I/O. The programmer can install new picture file formats in addition to those that Qt provides.

    You don't normally need to use this class; QPicture.load() , QPicture.save() .

    class PySide.QtGui. QPictureIO
    class PySide.QtGui. QPictureIO ( ioDevice , format )
    class PySide.QtGui. QPictureIO ( fileName , format )
    参数:

    构造 PySide.QtGui.QPictureIO object with all parameters set to zero.

    构造 PySide.QtGui.QPictureIO object with the I/O device ioDevice format tag.

    构造 PySide.QtGui.QPictureIO object with the file name fileName format tag.

    PySide.QtGui.QPictureIO. description ( )
    返回类型: unicode

    Returns the picture description string.

    PySide.QtGui.QPictureIO. fileName ( )
    返回类型: unicode

    Returns the file name currently set.

    PySide.QtGui.QPictureIO. format ( )
    返回类型: str

    Returns the picture format string or 0 if no format has been explicitly set.

    PySide.QtGui.QPictureIO. gamma ( )
    返回类型: PySide.QtCore.float

    Returns the gamma value at which the picture will be viewed.

    PySide.QtGui.QPictureIO. init ( )
    static PySide.QtGui.QPictureIO. inputFormats ( )
    返回类型:

    Returns a sorted list of picture formats that are supported for picture input.

    PySide.QtGui.QPictureIO. ioDevice ( )
    返回类型: PySide.QtCore.QIODevice

    Returns the IO device currently set.

    static PySide.QtGui.QPictureIO. outputFormats ( )
    返回类型:

    Returns a sorted list of picture formats that are supported for picture output.

    PySide.QtGui.QPictureIO. 参数 ( )
    返回类型: str

    Returns the picture's parameters string.

    PySide.QtGui.QPictureIO. picture ( )
    返回类型: PySide.QtGui.QPicture

    Returns the picture currently set.

    static PySide.QtGui.QPictureIO. pictureFormat ( fileName )
    参数: fileName – unicode
    返回类型: PySide.QtCore.QByteArray

    Returns a string that specifies the picture format of the file fileName , or null if the file cannot be read or if the format is not recognized.

    static PySide.QtGui.QPictureIO. pictureFormat ( arg__1 )
    参数: arg__1 PySide.QtCore.QIODevice
    返回类型: PySide.QtCore.QByteArray

    这是重载函数。

    Returns a string that specifies the picture format of the picture read from IO device d , or 0 if the device cannot be read or if the format is not recognized.

    Make sure that d is at the right position in the device (for example, at the beginning of the file).

    另请参阅

    QIODevice.at()

    PySide.QtGui.QPictureIO. quality ( )
    返回类型: PySide.QtCore.int

    Returns the quality of the written picture, related to the compression ratio.

    PySide.QtGui.QPictureIO. read ( )
    返回类型: PySide.QtCore.bool

    Reads an picture into memory and returns true if the picture was successfully read; otherwise returns false.

    Before reading an picture you must set an IO device or a file name. If both an IO device and a file name have been set, the IO device will be used.

    Setting the picture file format string is optional.

    Note that this function does not set the PySide.QtGui.QPictureIO.format() used to read the picture. If you need that information, use the PySide.QtGui.QPictureIO.pictureFormat() static functions.

    范例:

    iio = QPictureIO()
    pixmap = QPixmap()
    iio.setFileName("vegeburger.pic")
    if iio.read():         # OK
        picture = iio.picture()
        painter = QPainter(pixmap)
        painter.drawPicture(0, 0, picture)
    											
    PySide.QtGui.QPictureIO. setDescription ( arg__1 )
    参数: arg__1 – unicode

    Sets the picture description string for picture handlers that support picture descriptions to description .

    Currently, no picture format supported by Qt uses the description string.

    PySide.QtGui.QPictureIO. setFileName ( arg__1 )
    参数: arg__1 – unicode

    Sets the name of the file to read or write an picture from to fileName .

    PySide.QtGui.QPictureIO. setFormat ( arg__1 )
    参数: arg__1 – str

    Sets the picture format to format for the picture to be read or written.

    It is necessary to specify a format before writing an picture, but it is not necessary to specify a format before reading an picture.

    If no format has been set, Qt guesses the picture format before reading it. If a format is set the picture will only be read if it has that format.

    PySide.QtGui.QPictureIO. setGamma ( arg__1 )
    参数: arg__1 PySide.QtCore.float

    Sets the gamma value at which the picture will be viewed to gamma . If the picture format stores a gamma value for which the picture is intended to be used, then this setting will be used to modify the picture. Setting to 0.0 will disable gamma correction (i.e. any specification in the file will be ignored).

    The default value is 0.0.

    PySide.QtGui.QPictureIO. setIODevice ( arg__1 )
    参数: arg__1 PySide.QtCore.QIODevice

    Sets the IO device to be used for reading or writing an picture.

    Setting the IO device allows pictures to be read/written to any block-oriented PySide.QtCore.QIODevice .

    ioDevice is not null, this IO device will override file name settings.

    PySide.QtGui.QPictureIO. setParameters ( arg__1 )
    参数: arg__1 – str

    Sets the picture's parameter string to 参数 . This is for picture handlers that require special parameters.

    Although the current picture formats supported by Qt ignore the parameters string, it may be used in future extensions or by contributions (for example, JPEG).

    PySide.QtGui.QPictureIO. setPicture ( arg__1 )
    参数: arg__1 PySide.QtGui.QPicture

    Sets the picture to picture .

    PySide.QtGui.QPictureIO. setQuality ( arg__1 )
    参数: arg__1 PySide.QtCore.int

    Sets the quality of the written picture to q , related to the compression ratio.

    q must be in the range -1..100. Specify 0 to obtain small compressed files, 100 for large uncompressed files. (-1 signifies the default compression.)

    PySide.QtGui.QPictureIO. setStatus ( arg__1 )
    参数: arg__1 PySide.QtCore.int

    Sets the picture IO status to status . A non-zero value indicates an error, whereas 0 means that the IO operation was successful.

    PySide.QtGui.QPictureIO. status ( )
    返回类型: PySide.QtCore.int

    Returns the picture's IO status. A non-zero value indicates an error, whereas 0 means that the IO operation was successful.

    PySide.QtGui.QPictureIO. write ( )
    返回类型: PySide.QtCore.bool

    Writes an picture to an IO device and returns true if the picture was successfully written; otherwise returns false.

    Before writing an picture you must set an IO device or a file name. If both an IO device and a file name have been set, the IO device will be used.

    The picture will be written using the specified picture format.

    范例:

    iio = QPictureIO()
    picture = QPicture()
    painter = QPainter(picture)
    painter.drawPixmap(0, 0, pixmap)
    iio.setPicture(picture)
    iio.setFileName("vegeburger.pic")
    iio.setFormat("PIC")
    if iio.write():
        return True # returned true if written successfully