Код: Выделить всё
uchar *img_data = new uchar[nPixels*nLines*3];
uchar *R = new uchar[nPixels*nLines];
uchar *G = new uchar[nPixels*nLines];
uchar *B = new uchar[nPixels*nLines];
hDstDS->GetRasterBand(1)->RasterIO(GF_Read, 0,0, nPixels, nLines, R, nPixels, nLines, GDT_Byte, 0,0);
hDstDS->GetRasterBand(2)->RasterIO(GF_Read, 0,0, nPixels, nLines, G, nPixels, nLines, GDT_Byte, 0,0);
hDstDS->GetRasterBand(3)->RasterIO(GF_Read, 0,0, nPixels, nLines, B, nPixels, nLines, GDT_Byte, 0,0);
for (quint32 i = 0, j = 0; i < nPixels*nLines; ++i, j+=3)
{
img_data[j] = R;
img_data[j+1] = G;
img_data[j+2] = B;
}
img = new QImage(img_data, nPixels, nLines, QImage::Format_RGB888);
после чего получаю смещенное изображение: [attachment=0]2.png[/attachment]
почему так?