MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / pickColorInternal

Method pickColorInternal

Gui/ViewerGL.cpp:3791–3834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3789}
3790
3791bool
3792ViewerGL::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)
3837bool

Callers 1

pickColorMethod · 0.80

Calls 12

getColorPickerLinearMethod · 0.80
getCurrentSettingsMethod · 0.80
setColorPickersColorMethod · 0.80
setColorApproximatedMethod · 0.80
setColorValidMethod · 0.80
colorVisibleMethod · 0.80
showColorInfoMethod · 0.80
toZoomCoordinatesMethod · 0.45
xMethod · 0.45
yMethod · 0.45
getGuiMethod · 0.45
setColorMethod · 0.45

Tested by

no test coverage detected