QImage官方文档翻译

QImage类学习

Qt provides four classes for handling image data: QImage, QPixmap, QBitmap and QPicture.

Qt提供了4个类来处理图像数据:QImage,QPixmap,QBitmap和

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.

QImage被设计和利用于I/O,用于直接进行像素获取和操作,而

QPixmap被设计和用于在屏幕上显示图片。

QBitmap is only a convenience class that inherits QPixmap, ensuring a depth of 1.

QBitmap只是一个继承了QPixmap的工具类,保证深度为1。

什么是图像的深度?

图像的深度 depth_图像深度_yleavesw的博客-CSDN博客

存储每个像素所用的位数。

图像深度是单个像素点的色彩详细度,如16位,32位等。

一幅彩色图像RGB 3个颜色的像素位数分别为4,4,2,

则最大颜色数目为2的(4+4+2)次方,即1024,像素深度为10位,

每个像素可以是1024种颜色中的一种。

Finally, the QPicture class is a paint device that records and replays QPainter commands.

最后,QPicture类是一个记录和重现QPainter命令的绘图设备。

Because QImage is a QPaintDevice subclass, QPainter can be used to draw directly onto images.

因为QImage是QPaintDevice的一个子类,QPainter能被直接用来进行绘画在图片(QImage对象)上。

When using QPainter on a QImage, the painting can be performed in another thread than the current GUI thread.

当使用QPainter在一个QImage上时,绘画会被执行在另一个线程而不是当前的GUI线程。

The QImage class supports several image formats described by the Format enum.

QImage类支持一些通过Format枚举描述的图像格式。

These include monochrome, 8-bit, 32-bit and alpha-blended images which are available in all versions of Qt 4.x.

这些包括黑白照片,8位,32位和透明混合处理图像,可以在所以Qt4版本中使用。

QImage provides a collection of functions that can be used to obtain a variety of information about the image.

QImage提供了一堆能用来获取一系列图像信息的函数。

There are also several functions that enables transformation of the image.

这里也有一些使图像的变化的函数。

QImage objects can be passed around by value since the QImage class uses implicit data sharing.

Qimage对象能通过值传递,因为QImage类使用隐式数据共享。

QImage objects can also be streamed and compared.

QImage对象也可以流式传输和比较。

Note: If you would like to load QImage objects in a static build of Qt, refer to the Plugin HowTo.

注意:如果你想用Qt的静态构建载入一个QImage对象,参考Plugin HowTo.

Warning: Painting on a QImage with the format QImage::Format_Indexed8 is not supported.

警告:用QImage::Format Indexed8 在QImage上绘画是不被支持的。

Reading and Writing Image Files

读和写图像文件

QImage provides several ways of loading an image file: The file can be loaded when constructing the QImage object, or by using the load() or loadFromData() functions later on.

QImage提供了一些加载一个图像文件的方法:

当构造QImage对象,或使用load()函数,或在之后使用loadFromData()时,文件被载入。

QImage also provides the static fromData() function, constructing a QImage from the given data.

QImage也提供了静态函数fromData()来构造一个QImage对象从被给予的数据中。

When loading an image, the file name can either refer to an actual file on disk or to one of the application's embedded resources.

当加载图像时,文件名要么指的是磁盘上的实际文件,要么指的是应用程序的被嵌入的资源之一。

See The Qt Resource System overview for details on how to embed images and other resource files in the application's executable.

看Qt资源系统综述来了解详情,关于如何嵌入图像和其他资源文件在应用程序的可执行文件中。

Simply call the save() function to save a QImage object.

简单调用save()函数来保存一个QImage对象。

The complete list of supported file formats are available through the QImageReader::supportedImageFormats() and QImageWriter::supportedImageFormats() functions.

完整的支持的文件格式列表可以通过

QImageReader::supportedImageFormats()

和QImageWriter::supportedImageFormats()函数来获取。

New file formats can be added as plugins. By default, Qt supports the following formats:

新文件格式可以被添加为插件。默认地,Qt支持下面的格式:

Format

Description

Qt's support

BMP

Windows Bitmap(位图)

Read/write

GIF

Graphic Interchange Format (optional)

(可选择的)

Read

JPG

Joint Photographic Experts Group

Read/write

JPEG

Joint Photographic Experts Group

Read/write

PNG

Portable Network Graphics

Read/write

PBM

Portable Bitmap

Read

PGM

Portable Graymap

Read

PPM

Portable Pixmap

Read/write

XBM

X11 Bitmap

Read/write

XPM

X11 Pixmap

Read/write

Image Information

图像信息

QImage provides a collection of functions that can be used to obtain a variety of information about the image:

QImage提供了一堆能用来获取大量关于图像信息的函数:

 未翻译完,太多了。

你可能感兴趣的:(qt)