История изменений
Исправление nikitos, (текущая версия) :
English, motherfucker, do you speak it?
// QImage::Format_RGB32:
// QImage::Format_ARGB32:
// QImage::Format_ARGB32_Premultiplied:
// do smth within area [left;right) x [top; bottom)
quint8 const* line = img.constScanLine(r_top) + r_left *4;
int stride = img.bytesPerLine();
quint32 red = 0, green = 0, blue = 0;
for ( int y = top; y < bottom; ++y, line += stride ) {
quint8 const* pix = line;
for ( int x = left; x < right; ++x, pix += 4 ) {
blue = pix[0];
green = pix[1];
red = pix[2];
}
}
Исправление nikitos, :
English, motherfucker, do you speak it?
// QImage::Format_RGB32:
// QImage::Format_ARGB32:
// QImage::Format_ARGB32_Premultiplied:
quint8 const* line = img.constScanLine(r_top) + r_left *4;
int stride = img.bytesPerLine();
quint32 red = 0, green = 0, blue = 0;
for ( int y = r_top; y < r_bottom; ++y, line += stride ) {
quint8 const* pix = line;
for ( int x = r_left; x < r_right; ++x, pix += 4 ) {
blue = pix[0];
green = pix[1];
red = pix[2];
}
}
Исходная версия nikitos, :
English, motherfucker, do you speak it?
// QImage::Format_RGB32:
// QImage::Format_ARGB32:
// QImage::Format_ARGB32_Premultiplied:
quint8 const* line = img.constScanLine(r_top) + r_left *4;
quint32 red = 0, green = 0, blue = 0;
for ( int y = r_top; y < r_bottom; ++y, mline += m_mstride, fline += m_fstride ) {
quint8 const* pix = fline;
for ( int x = r_left; x < r_right; ++x, pix += 4 ) {
blue = pix[0];
green = pix[1];
red = pix[2];
}
}