English 中文(简体)
QImage与QPixmap之间的区别是什么?
原标题:What is the difference between QImage and QPixmap?

我不理解QImage和QPix地图之间的区别,它们似乎提供了同样的功能。 我何时应该使用QImage,我何时应该使用QPix地图?

最佳回答

http://qt-project.org/doc/qt-4.8/qimage.html#details"rel=“noreferer”>QImage QPixmap:

The QPixmap class is an off-screen image representation that can be used as a paint device.

< > 类别提供硬件依赖图像的表述,可直接获取六氯苯数据,并可用作油漆装置。

Edit: Also, from @Dave s answer:

你们可以操纵德国马克图马,但QImage没有这种限制。

And from @Arnold:

通常(并不总是)适用的简短摘要:

  • If you plan to manipulate an image, modify it, change pixels on it, etc., use a QImage.
  • If you plan to draw the same image more than once on the screen, convert it to a QPixmap.
问题回答

在Qt实验室有一门冰箱的文章,对Qt制图系统作了许多解释。 第条特别有关于<代码>的章节。 QImage vs. QPixmap

Here s a short summary that usually (not always) applies:

  • If you plan to manipulate an image, modify it, change pixels on it, etc., use a QImage.
  • If you plan to draw the same image more than once on the screen, convert it to a QPixmap.

一个重要的区别是,你不能就除了主要全球倡议外的任何东西创建或操纵一个<代码>QPixmap。 但是,你可以创建并操纵背景镜头的<条码>QImage,然后在将其转回德国宇宙航行联合会后加以转换。

  • QPixmap is an "image object" whose pixel representation are of no consequence in your code, Thus QPixmap is designed and optimized for rendering images on display screen, it is stored on the XServer when using X11, thus drawing QPixmap on XWindow is much faster than drawing QImages, as the data is already on the server, and ready to use.

    www.un.org/spanish/ecosoc 使用QPixmap: 如果你只是想弄清现有的形象(根据背景等),那么就使用QPix地图。

  • <client代码的“记忆中皮条记”,为I/O设计并优化了QImage,并用于直接使用和操纵。

    When to use QImage: If you want to draw, with Qpaint, or manipulate an image pixels.

  • <>QBitmap只是一个方便的QPix次表,确保深度达到1,其单速(1比深度)的图形。 如同QPixmap 一样,QBitmap被优化使用,以便使用隐含的数据共享。

  • QPicture is a paint device that records and replays QPainter commands -- your drawing --

工业环境的重要性:

“QPix”地图储存在拍摄的录像卡上。 不是QImage。

因此,如果拥有一个服务器来管理申请,而且有一个客户站进行显示,从网络使用来说,这是非常重要的。

有了一张Pix地图,重新绘制的只是寄出在网络上重划(少数星)的命令。

通过QImage,它包括发送整个图像(大约几个甲基溴)。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签