171 if (cx >= 0 && cx < fCols && cy >= 0 && cy <
fRows) {
198 if (cx >= 0 && cx < fCols && cy >= 0 && cy <
fRows) {
224 gVirtualX->LookupString(event, input,
sizeof(input), keysym);
235 if (cx <
fCols - 1) ++cx;
243 if (cy <
fRows - 1) ++cy;
259 if (cx !=
fCx || cy !=
fCy) {
333 for (i = 0; i <
fRows; ++i) {
335 for (j = 0; j <
fCols; ++j) {
369 if (
fCx >= 0 &&
fCy >= 0) {
531 for (i = 0; i < 64; ++i) {
532 Int_t cc[4] = { 0, 21845, 43691, 65535 };
534 color.
fRed = cc[i & 0x3];
536 color.
fBlue = cc[(i >> 4) & 0
x3];
552 for (i = 0; i < 27; ++i) {
553 Int_t cc[3] = { 0, 32768, 65535 };
555 color.
fRed = cc[i % 3];
556 color.
fGreen = cc[(i / 3) % 3];
557 color.
fBlue = cc[(i / 9) % 3];
573 for (i = 0; i < 8; ++i) {
575 color.
fRed = (i & 1) * 65535;
576 color.
fGreen = ((i >> 1) & 1) * 65535;
577 color.
fBlue = ((i >> 2) & 1) * 65535;
595 for (i = 0; i < 8; ++i) {
597 color.
fRed = (i & 1) * 65535;
598 color.
fGreen = ((i >> 1) & 1) * 65535;
599 color.
fBlue = ((i >> 2) & 1) * 65535;
629 const Int_t kWidth = 20;
632 struct {
Int_t r,
g,
b; } ed[kWidth], ef;
641 for (x = 0; x < iw; ++
x) {
642 ed[
x].r = ed[
x].g = ed[
x].b = 0;
647 for (y = 0; y < ih; ++
y) {
651 for (x = 0; x < iw; ++
x) {
655 s = (ih -
y) * 255 / ih;
664 }
else if (which ==
kIMG_L) {
669 Int_t ll = (ih -
y) * 255 / ih;
673 for (x = 0; x < iw; ++
x) {
685 ef.r = ef.g = ef.b = 0;
687 for (x = 0; x < iw; ++
x) {
691 v = line[
x].
fRed + ed[
x].r;
692 if (v < 0) v = 0;
else if (v > 255) v = 255;
696 if (v < 0) v = 0;
else if (v > 255) v = 255;
700 if (v < 0) v = 0;
else if (v > 255) v = 255;
705 for (x = 0; x < iw; ++
x) {
709 v = line[
x].
fRed + ef.r;
710 if (v < 0) v = 0;
else if (v > 255) v = 255;
714 if (v < 0) v = 0;
else if (v > 255) v = 255;
718 if (v < 0) v = 0;
else if (v > 255) v = 255;
723 sdist = 255
L * 255
L * 255
L;
730 dist = dr * dr + dg * dg + db * db;
740 e[0] = (7 * v) >> 4; \ 742 e[2] = (5 * v) >> 4; \ 749 if (x < iw-1) ed[x+1].r = e[1];
750 if (x == 0) ed[
x].r = e[2];
else ed[
x].r += e[2];
751 if (x > 0) ed[x-1].r += e[3];
757 if (x < iw-1) ed[x+1].g = e[1];
758 if (x == 0) ed[
x].g = e[2];
else ed[
x].g += e[2];
759 if (x > 0) ed[x-1].g += e[3];
765 if (x < iw-1) ed[x+1].b = e[1];
766 if (x == 0) ed[
x].b = e[2];
else ed[
x].b += e[2];
767 if (x > 0) ed[x-1].b += e[3];
789 for (
Int_t y = 0;
y < height; ++
y) {
795 s = (height -
y) * 255 / height;
827 for (
Int_t y = 0;
y < height; ++
y) {
832 l = (height -
y) * 255 / height;
888 l =
Int_t((lheight -
fCz) * 255 / lheight);
889 s =
Int_t((sheight -
fCy) * 255 / sheight);
1001 x =
fCx - 9; w = 19;
1002 y =
fCy - 9; h = 19;
1004 if (x < 0) { w +=
x; x = 0; }
1005 if (y < 0) { h +=
y; y = 0; }
1007 if (x + w > width) w = width -
x;
1008 if (y + h > height) h = height -
y;
1051 const Int_t kC_X = 175;
1052 const Int_t kC_Y = 180;
1157 wcan->
Connect(
"ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
"TGColorDialog",
this,
1158 "SetColorInfo(Int_t,Int_t,Int_t,TObject*)");
1180 for (i = 0; i < 48; ++i)
1231 if (
gUcolor[0] == 0xff000000) {
1232 for (i = 0; i < 24; i++)
1344 Emit(
"ColorSelected(Pixel_t)", color);
1352 Emit(
"AlphaColorSelected(ULong_t)", color);
1361 for (
Int_t i = 0; i < 24; ++i)
1392 alpha = color->GetAlpha();
const TGWindow * GetMain() const
TColorWheel * fColorWheel
const Mask_t kKeyReleaseMask
virtual const char * GetName() const
Returns name of object.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
double dist(Rotation3D const &r1, Rotation3D const &r2)
virtual void SetAlpha(Float_t a)
void SetSliderColor()
Set slider colors.
void SetColor(Pixel_t color)
Position the slider cursor on right color position.
virtual void ColorSelected(Pixel_t col=0)
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
virtual Bool_t HandleButton(Event_t *event)
Handle button events in color palette.
TGColorPalette * fCpalette
void SetLcursor(Int_t z)
Set lightness slider cursor position.
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
const TGWindow * GetRoot() const
Returns current root (i.e.
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
TRootEmbeddedCanvas * fEcanvas
void SetForeground(Pixel_t v)
Set foreground color.
void CreateDitheredImage(Pixmap_t image, Int_t which)
Create a dithered version of the color map and lightness images for display modes with reduced number...
const Mask_t kLeaveWindowMask
void UpdateHLSentries(Pixel_t *c)
Update HLS text entries with HLS values of color c.
virtual ~TGColorDialog()
TGColorDialog destructor.
const TGResourcePool * GetResourcePool() const
virtual void DrawBorder()
Draw frame border.
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Short_t Min(Short_t a, Short_t b)
virtual UInt_t GetDefaultHeight() const
virtual ~TGColorPalette()
Destructor.
void UpdateCurrentColor()
Assign the current cursor position as currently selected color.
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
void WaitForUnmap(TGWindow *w)
Wait for window to be unmapped.
TGColorDialog(const TGColorDialog &)
const TGGC * GetFrameGC() const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual void ColorSelected(Pixel_t col=0)
virtual void LostFocus()
Remove keyboard input.
const Mask_t kPointerMotionMask
TGColorPalette * fPalette
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
virtual void Draw(Option_t *option="")
Paint the color wheel.
virtual void SetText(TGString *newText)
Set new text in label.
void SetWMSizeHints(UInt_t wmin, UInt_t hmin, UInt_t wmax, UInt_t hmax, UInt_t winc, UInt_t hinc)
Give the window manager minimum and maximum size hints.
virtual void SetCurrentColor(Pixel_t col)
Change current color.
virtual void SetCanvas(TCanvas *can)
TGCompositeFrame(const TGCompositeFrame &)
const char * GetString() const
void DeleteCanvasPainter()
assert on IsBatch() == false?
void AddText(Int_t pos, const char *text)
static constexpr double L
int main(int argc, char **argv)
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
void AllocColors()
Try to allocate first a palette of 64 colors.
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
void UpdateRGBentries(Pixel_t *c)
Update RGB text entries with RGB values of color c.
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
void DrawFocusHilite(Int_t onoff)
Draw a highlight rectangle around cell obtaining focus.
R__ALWAYS_INLINE Bool_t IsZombie() const
static void RGB2HLS(Float_t r, Float_t g, Float_t b, Float_t &h, Float_t &l, Float_t &s)
Static method to compute HLS from RGB.
static Bool_t SupportAlpha()
Static function returning "true" if transparency is supported.
const Mask_t kButtonPressMask
const Mask_t kKeyPressMask
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot...
static void HLS2RGB(Float_t h, Float_t l, Float_t s, Float_t &r, Float_t &g, Float_t &b)
Static method to compute RGB from HLS.
static ULong_t gUcolor[24]
Bool_t IsEditable() const
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
void RemoveInput(UInt_t emask)
Remove events specified in emask from the events the frame should handle.
void InitImages()
Initialize color palette and slider images.
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
ULong_t GetPixel() const
Return pixel value corresponding to this color.
char * Form(const char *fmt,...)
void SetHScursor(Int_t x, Int_t y)
Set hue / saturation cursor position.
virtual UInt_t GetDefaultWidth() const
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb"...
virtual Pixel_t GetBackground() const
virtual Int_t GetColor(Int_t px, Int_t py) const
Return the color number pointed by the mouse.
virtual void CloseWindow()
Called when window is closed via window manager.
static const TGGC & GetBlackGC()
Get black graphics context.
void SetColor(Int_t ix, Pixel_t color)
Set color at index ix of color entries.
void FreeColors()
Free allocated colors.
TGColorPalette(const TGColorPalette &)
if object does not want context menu
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
const Mask_t kEnterWindowMask
virtual UInt_t GetDefaultHeight() const
Pixel_t GetCurrentColor() const
Return currently selected color value.
void DrawLcursor(Int_t onoff)
Draw lightness slider cursor.
void CreateImages()
Create colormap and color slider images.
void SetEnabled(Bool_t flag=kTRUE)
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
const Mask_t kStructureNotifyMask
void DrawHScursor(Int_t onoff)
Draw hue / saturation cursor.
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events in color palette.
const Mask_t kButtonReleaseMask
TCanvas * GetCanvas() const
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events in color pick widget.
virtual void GotFocus()
Add keyboard input.
void SetColors(Pixel_t colors[])
Set color entries in color samples.
static constexpr double s
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
The color creation and management class.
virtual void DoRedraw()
Redraw color palette.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Rectangle_t fColormapRect
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
Mother of all ROOT objects.
you should not use this method at all Int_t Int_t z
virtual void UnmapWindow()
virtual void AlphaColorSelected(ULong_t)
Emit signal about selected alpha and color.
void SetTextJustify(Int_t tmode)
Set text justification.
void DoPreview()
Slot method called when Preview button is clicked.
TGColorPick(const TGWindow *p=0, Int_t w=1, Int_t h=1, Int_t id=-1)
TGColorPick constructor.
void SetCurrentCellColor(Pixel_t color)
Set current cell color.
Short_t Max(Short_t a, Short_t b)
const Mask_t kFocusChangeMask
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
void SetCellSize(Int_t w=20, Int_t h=17)
Set color cell size.
virtual void DoRedraw()
Redraw the color pick widget.
Pixel_t GetCurrentColor() const
void SetColorInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Set the color info in RGB and HLS parts.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
virtual void Update()
Update canvas pad buffers.
virtual void Draw3dRectangle(UInt_t type, Int_t x, Int_t y, UInt_t w, UInt_t h)
Draw 3D rectangle on the frame border.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events in color pick widget.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual void DeleteWindow()
Delete window.
const Mask_t kAnyModifier
void SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events in color palette.
virtual ~TGColorPick()
TGColorPick destructor.
static const TGGC & GetShadowGC()
Get shadow color graphics context.
static const TGGC & GetBckgndGC()
Get background color graphics context.
Draw the ROOT Color Wheel.
Pixel_t GetColorByIndex(Int_t ix) const
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for the color selection dialog.
virtual void ColorSelected(Pixel_t)
Emit signal about selected color.
static void Pixel2RGB(ULong_t pixel, Int_t &r, Int_t &g, Int_t &b)
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::Ge...
void UpdateAlpha(Pixel_t *c)
Upadate Opacity text entry with alpha value of color c.
static const double x3[11]