| 3789 | } |
| 3790 | |
| 3791 | bool |
| 3792 | ViewerGL::pickColorInternal(double x, |
| 3793 | double y, |
| 3794 | bool /*pickInput*/) |
| 3795 | { |
| 3796 | |
| 3797 | #pragma message WARN("Todo: use pickInput") |
| 3798 | float r, g, b, a; |
| 3799 | QPointF imgPos; |
| 3800 | { |
| 3801 | QMutexLocker l(&_imp->zoomCtxMutex); |
| 3802 | imgPos = _imp->zoomCtx.toZoomCoordinates(x, y); |
| 3803 | } |
| 3804 | |
| 3805 | _imp->lastPickerPos = imgPos; |
| 3806 | bool linear = appPTR->getCurrentSettings()->getColorPickerLinear(); |
| 3807 | bool ret = false; |
| 3808 | for (int i = 0; i < 2; ++i) { |
| 3809 | // imgPos must be in canonical coordinates |
| 3810 | unsigned int mmLevel; |
| 3811 | bool picked = getColorAt(imgPos.x(), imgPos.y(), linear, i, &r, &g, &b, &a, &mmLevel); |
| 3812 | if (picked) { |
| 3813 | if (i == 0) { |
| 3814 | _imp->viewerTab->getGui()->setColorPickersColor(r, g, b, a); |
| 3815 | } |
| 3816 | _imp->infoViewer[i]->setColorApproximated(mmLevel > 0); |
| 3817 | _imp->infoViewer[i]->setColorValid(true); |
| 3818 | if ( !_imp->infoViewer[i]->colorVisible() ) { |
| 3819 | _imp->infoViewer[i]->showColorInfo(); |
| 3820 | } |
| 3821 | _imp->infoViewer[i]->setColor(r, g, b, a); |
| 3822 | ret = true; |
| 3823 | { |
| 3824 | OfxRGBAColourD interactColor = {r,g,b,a}; |
| 3825 | setParametricParamsPickerColor(interactColor, true, true); |
| 3826 | } |
| 3827 | } else { |
| 3828 | _imp->infoViewer[i]->setColorValid(false); |
| 3829 | setParametricParamsPickerColor(OfxRGBAColourD(), false, false); |
| 3830 | } |
| 3831 | } |
| 3832 | |
| 3833 | return ret; |
| 3834 | } |
| 3835 | |
| 3836 | // used for the ctrl-click color picker (not the information bar at the bottom of the viewer) |
| 3837 | bool |
no test coverage detected