• 8078阅读
  • 3回复

【提问】QPicture QImage 等有关图像,图片的类怎么用? [复制链接]

上一主题 下一主题
离线hehe
 
只看楼主 正序阅读 楼主  发表于: 2005-11-15
我想让一个.jpg的图像显示在一个框里, 1)显示图像 2)编写一个可以显示图像的框 要用到哪些类?
还有QPicture QImage QPainter QPixmap具体是干什么用的? 只知道QPainter是画图的.
高手指导一下吧.谢谢
离线snow_man_0

只看该作者 3楼 发表于: 2007-09-19
能不能再解释下QPicture和QImage?
离线hehe
只看该作者 2楼 发表于: 2005-11-15
非常感谢mudfish !!!!!!
离线mudfish
只看该作者 1楼 发表于: 2005-11-15
qt文档中对qimage和qpixmap的比较解释
The QImage class provides a hardware-independent pixmap representation with direct access to the pixel data.
It is one of the two classes Qt provides for dealing with images, the other being QPixmap. QImage is designed and optimized for I/O and for direct pixel access/manipulation. QPixmap is designed and optimized for drawing. There are (slow) functions to convert between QImage and QPixmap: QPixmap::convertToImage() and QPixmap::convertFromImage().

One common use of the QPixmap class is to enable smooth updating of widgets. Whenever something complex needs to be drawn, you can use a pixmap to obtain flicker-free drawing, like this:
Create a pixmap with the same size as the widget.
Fill the pixmap with the widget background color.
Paint the pixmap.
bitBlt() the pixmap contents onto the widget.
对照文档的解释,再看看两个类分别提供的函数,我的理解是:
1. 二者功能有重叠部分,如都可以获得height, width等参数;
2. 如果想对图片的内容进行加工处理,使用qpixmap+qpainter;
3. 如果是把图片当作一个整体来操作,如放大缩小,使用qimage.
快速回复
限100 字节
 
上一个 下一个