void Plot2DAxes::_gradColorButtonCB(Fl_Widget * W) { unsigned char R = _gradColor.R; unsigned char G = _gradColor.G; unsigned char B = _gradColor.B; if (fl_color_chooser("Axes Color", R, G, B, 1) != 0) { graduations(RGBc(R, G, B)); } }
void Plot2DAxes::_numColorButtonCB(Fl_Widget * W) { unsigned char R = _numColor.R; unsigned char G = _numColor.G; unsigned char B = _numColor.B; if (fl_color_chooser("Numbers Color", R, G, B, 1) != 0) { numbers(RGBc(R, G, B)); } }
/** * The getColor function associated with the image. * * @param pos The position * * @return The color of the pixel at that position. **/ inline RGBc getColor(iVec2 pos) { if (_im == nullptr) return RGBc::c_Transparent; const int64 lx = _im->width(); const int64 ly = _im->height(); int64 x = pos.X(); int64 y = pos.Y(); if (_typepos == TYPECENTER) { x += lx/2; y += ly/2; } if ((x <0)||(y < 0)||(x >= lx)||(y >= ly)) return RGBc::c_Transparent; y = ly - 1 - y; const int64 lxy = lx*ly; int64 off = x + lx*y; const unsigned char * p = _im->data(); const char r = *(p + off); const char g = *(p + off + lxy); const char b = *(p + off + 2*lxy); const char a = ((_im->spectrum() < 4) ? (const char)255 : (*(p + off + 3*lxy))); return RGBc(r, g, b, a); }
void Plotter2DObj::setNameWidgetColor() { if (!isFltkThread()) // run the method in FLTK if not in it { IndirectMemberProc<Plotter2DObj> proxy(*this, &Plotter2DObj::setNameWidgetColor); // registers the call runInFltkThread(proxy); return; } if ((pnot)_ownercb == nullptr) return; // return if not inserted RGBc coul = nameWidgetColor(); if (coul.isTransparent()) { return; } _nameBox->color(toFlColor(coul)); if ((int)coul.comp.R + (int)coul.comp.G + (int)coul.comp.B < 300) { _nameBox->labelcolor(toFlColor(RGBc(230, 230, 230))); } else { _nameBox->labelcolor(toFlColor(RGBc::c_Black)); } _nameBox->redraw(); refresh(); yieldFocus(); }