Skip to content

Commit

Permalink
improve image panel
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouhang95 committed Oct 24, 2023
1 parent 377771a commit f1a2789
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ui/zenoedit/panel/zenoimagepanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ void ZenoImagePanel::setPrim(std::string primid) {
if (image_view) {
if (pMode->currentText() != "Alpha") {
QImage img(width, height, QImage::Format_RGB32);
auto index = std::map<QString, zeno::vec3i>{
{"RGB", {0, 1, 2}},
{"Red", {0, 0, 0}},
{"Green", {1, 1, 1}},
{"Blue", {2, 2, 2}},
}.at(pMode->currentText());
for (auto i = 0; i < obj->verts.size(); i++) {
int h = i / width;
int w = i % width;
auto c = obj->verts[i];
if (enableGamma) {
c = zeno::pow(c, 1.0f / 2.2f);
}
auto index = std::map<QString, zeno::vec3i>{
{"RGB", {0, 1, 2}},
{"Red", {0, 0, 0}},
{"Green", {1, 1, 1}},
{"Blue", {2, 2, 2}},
}.at(pMode->currentText());
int r = glm::clamp(int(c[index[0]] * 255.99), 0, 255);
int g = glm::clamp(int(c[index[1]] * 255.99), 0, 255);
int b = glm::clamp(int(c[index[2]] * 255.99), 0, 255);
Expand Down

0 comments on commit f1a2789

Please sign in to comment.