QImage, QPixmap 的官方解释摘录
2014-06-05 11:50
591 查看
Qt provides four classes for handling image data: QImage, QPixmap, QBitmap and QPicture. QImage is
designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen. QBitmap is
only a convenience class that inherits QPixmap, ensuring a depth of 1. The isQBitmap() function returns true if a QPixmap
object is really a bitmap, otherwise returns false. Finally, the QPicture class is a paint device
that records and replays QPainter commands.
A QPixmap can easily be displayed on the screen using QLabel or one of QAbstractButton's
subclasses (such as QPushButton and QToolButton). QLabelhas
a pixmap property, whereas QAbstractButton has an icon property.
In addition to the ordinary constructors, a QPixmap can be constructed using the static grabWidget() and grabWindow()
functions which creates a QPixmap and paints the given widget, or window, into it.
QPixmap objects can be passed around by value since the QPixmap class uses implicit data sharing. For more information, see the Implicit
Data Sharingdocumentation. QPixmap objects can also be streamed.
Depending on the system, QPixmap is stored using a RGB32 or a premultiplied alpha format. If the image has an alpha channel, and if the system allows, the preferred format is premultiplied alpha. Note also that QPixmap, unlike QImage,
may be hardware dependent. On X11, Mac and Symbian, a QPixmap is stored on the server side while a QImage is stored on the client
side (on Windows, these two classes have an equivalent internal representation, i.e. both QImage and QPixmap are stored on the client side
and don't use any GDI resources).
Note that the pixel data in a pixmap is internal and is managed by the underlying window system. Because QPixmap is a QPaintDevice subclass, QPaintercan
be used to draw directly onto pixmaps. Pixels can only be accessed through QPainter functions or by converting the QPixmap to a QImage.
However, the fill() function is available for initializing the entire pixmap with a given color.
There are functions to convert between QImage and QPixmap. Typically, the QImage class
is used to load an image file, optionally manipulating the image data, before the QImage object is converted
into a QPixmap to be shown on screen. Alternatively, if no manipulation is desired, the image file can be loaded directly into a QPixmap. On Windows, the QPixmap class also supports conversion between HBITMAP and
QPixmap. On Symbian, the QPixmap class also supports conversion between CFbsBitmap and QPixmap.
QPixmap provides a collection of functions that can be used to obtain a variety of information about the pixmap. In addition, there are several functions that enables transformation of the pixmap.
designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen. QBitmap is
only a convenience class that inherits QPixmap, ensuring a depth of 1. The isQBitmap() function returns true if a QPixmap
object is really a bitmap, otherwise returns false. Finally, the QPicture class is a paint device
that records and replays QPainter commands.
A QPixmap can easily be displayed on the screen using QLabel or one of QAbstractButton's
subclasses (such as QPushButton and QToolButton). QLabelhas
a pixmap property, whereas QAbstractButton has an icon property.
In addition to the ordinary constructors, a QPixmap can be constructed using the static grabWidget() and grabWindow()
functions which creates a QPixmap and paints the given widget, or window, into it.
QPixmap objects can be passed around by value since the QPixmap class uses implicit data sharing. For more information, see the Implicit
Data Sharingdocumentation. QPixmap objects can also be streamed.
Depending on the system, QPixmap is stored using a RGB32 or a premultiplied alpha format. If the image has an alpha channel, and if the system allows, the preferred format is premultiplied alpha. Note also that QPixmap, unlike QImage,
may be hardware dependent. On X11, Mac and Symbian, a QPixmap is stored on the server side while a QImage is stored on the client
side (on Windows, these two classes have an equivalent internal representation, i.e. both QImage and QPixmap are stored on the client side
and don't use any GDI resources).
Note that the pixel data in a pixmap is internal and is managed by the underlying window system. Because QPixmap is a QPaintDevice subclass, QPaintercan
be used to draw directly onto pixmaps. Pixels can only be accessed through QPainter functions or by converting the QPixmap to a QImage.
However, the fill() function is available for initializing the entire pixmap with a given color.
There are functions to convert between QImage and QPixmap. Typically, the QImage class
is used to load an image file, optionally manipulating the image data, before the QImage object is converted
into a QPixmap to be shown on screen. Alternatively, if no manipulation is desired, the image file can be loaded directly into a QPixmap. On Windows, the QPixmap class also supports conversion between HBITMAP and
QPixmap. On Symbian, the QPixmap class also supports conversion between CFbsBitmap and QPixmap.
QPixmap provides a collection of functions that can be used to obtain a variety of information about the pixmap. In addition, there are several functions that enables transformation of the pixmap.
相关文章推荐
- 官方解释sqlplus /nolog conn /as sysdba无密码可登陆
- QPixmap与QImage的区别
- Cocos Creator中使用动作列表(官方文档摘录)
- Android USER 版本与ENG 版本的差异--MTK官方解释
- Influxdb-官方文档摘录
- Influxdb-官方文档摘录
- QImage与QPixmap加载图片效果 【两者的区别】
- gcd其全称(Grand Central Dispatch) 那到底什么叫gcd,官方的解释如下
- ViewPager 的 PagerAdapter的官方的说明 摘录
- QImage和QPixmap小区别
- QImage与QPixmap完全解析
- QImage,QPixmap,QBitmap,QPicture
- Cocos Creator中使用计时器(官方文档摘录)
- monkey的官方翻译以及解释
- SDE在64位Server2008下Post启动服务失败官方解释
- jQuery官方文档对Ajax中get和post方法的解释
- tcsetattr() 官方解释
- Influxdb-官方文档摘录
- Influxdb-官方文档摘录
- 10.Query an Array-官方文档摘录