Qt 在《齐玛格》中,bytesPerLine是什么意思?

Qt 在《齐玛格》中,bytesPerLine是什么意思?,qt,qt4,Qt,Qt4,在中国,bytesPerLine是什么意思 QImage::QImage ( uchar * data, int width, int height, int bytesPerLine, Format format ) 在文档中,它被称为bytesPerLine,用于指定每行(跨步)的字节数。 我不清楚它的用法。宽度和字节数相同吗?谁能解释一下吗 bytesperline表示给定行中图像像素所需的字节数 为说明这一点,请考虑下面的代码片段… int imageWidth = 800; int

在中国,bytesPerLine是什么意思

QImage::QImage ( uchar * data, int width, int height, int bytesPerLine, Format format )
在文档中,它被称为bytesPerLine,用于指定每行(跨步)的字节数。

我不清楚它的用法。宽度和字节数相同吗?谁能解释一下吗

bytesperline表示给定行中图像像素所需的字节数

为说明这一点,请考虑下面的代码片段…

int imageWidth = 800;
int imageHeight = 600;
int bytesPerPixel = 4; // 4 for RGBA, 3 for RGB
int format = QImage::Format_ARGB32; // this is the pixel format - check Qimage::Format enum type for more options
QImage image(yourData, imageWidth, imageHeight, imageWidth * bytesPerPixel, format);

字节/像素=1表示8位灰度?