Skip to content

Commit

Permalink
Added Color on QT side
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliom committed Jul 24, 2024
1 parent 612baac commit 0a3b620
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions BasicRenderer/source/ImageExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ namespace BasicRenderer
//BGR
uint32_t index = (height - j - 1) * width + i;
Color c = cBuf[index];
bmpData.emplace_back((uint8_t)(c.r * 255.999f));
bmpData.emplace_back((uint8_t)(c.g * 255.999f));
bmpData.emplace_back((uint8_t)(c.b * 255.999f));
bmpData.emplace_back((uint8_t)(c.g * 255.999f));
bmpData.emplace_back((uint8_t)(c.r * 255.999f));
}

uint32_t padding = bmpData.size() % 4;
Expand Down
6 changes: 3 additions & 3 deletions QtGUI/QRenderingWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ void QRenderingWidget::CopyFrameBufferToQImage(QImage& img, const FrameBuffer& f
for (uint i = 0; i < size; ++i)
{
uint ua = 255u << 24;
ua |= static_cast<uint>(c[i].x * 255.999f) << 16;
ua |= static_cast<uint>(c[i].y * 255.999f) << 8;
ua |= static_cast<uint>(c[i].z * 255.999f);
ua |= static_cast<uint>(c[i].r * 255.999f) << 16;
ua |= static_cast<uint>(c[i].g * 255.999f) << 8;
ua |= static_cast<uint>(c[i].b * 255.999f);

rgb[i] = ua;
}
Expand Down

0 comments on commit 0a3b620

Please sign in to comment.