View RGB values in greater than 8-bit depth

Okay, I browsed through the code, and it’s definitely downsampling to 8-bits before it converts to float. :frowning:

void Navigator::getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB)
{
    switch (currentRGBUnit) {
    case (Options::NavigatorUnit::R0_1):
        sR = Glib::ustring::format(std::fixed, std::setprecision(4), r / 255.f);
        sG = Glib::ustring::format(std::fixed, std::setprecision(4), g / 255.f);
        sB = Glib::ustring::format(std::fixed, std::setprecision(4), b / 255.f);
        break;
    case (Options::NavigatorUnit::R0_255):
        sR = Glib::ustring::format(std::fixed, std::setprecision(0), r);
        sG = Glib::ustring::format(std::fixed, std::setprecision(0), g);
        sB = Glib::ustring::format(std::fixed, std::setprecision(0), b);
        break;
    case (Options::NavigatorUnit::PERCENT):
    default:
        sR = Glib::ustring::format(std::fixed, std::setprecision(1), r * 100.f / 255.f) + Glib::ustring("%");
        sG = Glib::ustring::format(std::fixed, std::setprecision(1), g * 100.f / 255.f) + Glib::ustring("%");
        sB = Glib::ustring::format(std::fixed, std::setprecision(1), b * 100.f / 255.f) + Glib::ustring("%");
    }
}

I also found this:

guint8* pix = cropHandler.cropPixbuftrue->get_pixels() + vy * cropHandler.cropPixbuf->get_rowstride() + vx * 3;
...
pmlistener->pointerMoved (true, cropHandler.colorParams.output, cropHandler.colorParams.working, mx, my, pix[0], pix[1], pix[2]);

in cropwindow.cc, which suggests that all the UI pixels are in 8-bits. It seems to be using GTK for that, which would be why all the UI stuff is in 8 bits. Adding simple prints of the raw pixel values is going to harder than I had hoped. Ah well.

1 Like