- Wed Jun 24, 2015 11:48 am
#387223
I'm trying read RenderPreviewBuffer from existing mxi file, but I get incorrect image
First image is a real render preview,
second image what i get
Used files
Can anyone help? What I doing wrong?
First image is a real render preview,
second image what i get
Used files
Can anyone help? What I doing wrong?
Code: Select all
CmaxwellMxi mxi;
mxi.read("D:/test.mxi");
dword xRes, yRes;
dword xPrevRes = xRes, yPrevRes = yRes;
mxi.getPreviewResolution(xRes, yRes, xPrevRes, yPrevRes);
mxi.updateDisplay();
mxi.updatePreview();
Crgb8 *pRgb8 = mxi.getRenderPreviewBuffer();;
QImage image(xPrevRes, yPrevRes, QImage::Format_RGB888);
for(int y = 0; y < yPrevRes; y++)
{
for(int x = 0; x < xPrevRes; x++)
{
Crgb pRgb;
pRgb8->toRGB(pRgb);
QColor color;
color.setRgbF(pRgb.r, pRgb.g, pRgb.b);
image.setPixel(x,y, color.rgb());
pRgb8++;
}
}
m_graphicsScene->addPixmap(QPixmap::fromImage(image));
image.save("D:/test.png", "PNG");