186 if (cx >= 0 && cx < fCols && cy >= 0 && cy <
fRows) {
213 if (cx >= 0 && cx < fCols && cy >= 0 && cy <
fRows) {
250 if (cx <
fCols - 1) ++cx;
258 if (cy <
fRows - 1) ++cy;
274 if (cx !=
fCx || cy !=
fCy) {
348 for (i = 0; i <
fRows; ++i) {
350 for (j = 0; j <
fCols; ++j) {
384 if (
fCx >= 0 &&
fCy >= 0) {
546 for (i = 0; i < 64; ++i) {
547 Int_t cc[4] = { 0, 21845, 43691, 65535 };
549 color.
fRed = cc[i & 0x3];
550 color.
fGreen = cc[(i >> 2) & 0x3];
551 color.
fBlue = cc[(i >> 4) & 0x3];
567 for (i = 0; i < 27; ++i) {
568 Int_t cc[3] = { 0, 32768, 65535 };
570 color.
fRed = cc[i % 3];
571 color.
fGreen = cc[(i / 3) % 3];
572 color.
fBlue = cc[(i / 9) % 3];
588 for (i = 0; i < 8; ++i) {
590 color.
fRed = (i & 1) * 65535;
591 color.
fGreen = ((i >> 1) & 1) * 65535;
592 color.
fBlue = ((i >> 2) & 1) * 65535;
610 for (i = 0; i < 8; ++i) {
612 color.
fRed = (i & 1) * 65535;
613 color.
fGreen = ((i >> 1) & 1) * 65535;
614 color.
fBlue = ((i >> 2) & 1) * 65535;
644 const Int_t kWidth = 20;
647 struct {
Int_t r,
g,
b; } ed[kWidth], ef;
656 for (
x = 0;
x < iw; ++
x) {
657 ed[
x].r = ed[
x].g = ed[
x].b = 0;
662 for (
y = 0;
y < ih; ++
y) {
666 for (
x = 0;
x < iw; ++
x) {
670 s = (ih -
y) * 255 / ih;
679 }
else if (which ==
kIMG_L) {
684 Int_t ll = (ih -
y) * 255 / ih;
688 for (
x = 0;
x < iw; ++
x) {
700 ef.r = ef.g = ef.b = 0;
702 for (
x = 0;
x < iw; ++
x) {
707 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
711 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
715 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
720 for (
x = 0;
x < iw; ++
x) {
725 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
728 v =
line[
x].fGreen + ef.g;
729 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
733 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
738 sdist = 255L * 255L * 255L;
745 dist = dr * dr + dg * dg + db * db;
755 e[0] = (7 * v) >> 4; \
757 e[2] = (5 * v) >> 4; \
764 if (
x < iw-1) ed[
x+1].r =
e[1];
765 if (
x == 0) ed[
x].r =
e[2];
else ed[
x].r +=
e[2];
766 if (
x > 0) ed[
x-1].r +=
e[3];
772 if (
x < iw-1) ed[
x+1].g =
e[1];
773 if (
x == 0) ed[
x].g =
e[2];
else ed[
x].g +=
e[2];
774 if (
x > 0) ed[
x-1].g +=
e[3];
780 if (
x < iw-1) ed[
x+1].b =
e[1];
781 if (
x == 0) ed[
x].b =
e[2];
else ed[
x].b +=
e[2];
782 if (
x > 0) ed[
x-1].b +=
e[3];
903 l =
Int_t((lheight -
fCz) * 255 / lheight);
904 s =
Int_t((sheight -
fCy) * 255 / sheight);
1016 x =
fCx - 9;
w = 19;
1017 y =
fCy - 9;
h = 19;
1019 if (
x < 0) {
w +=
x;
x = 0; }
1020 if (
y < 0) {
h +=
y;
y = 0; }
1066 const Int_t kC_X = 175;
1067 const Int_t kC_Y = 180;
1172 wcan->
Connect(
"ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
"TGColorDialog",
this,
1173 "SetColorInfo(Int_t,Int_t,Int_t,TObject*)");
1195 for (i = 0; i < 48; ++i)
1246 if (
gUcolor[0] == 0xff000000) {
1247 for (i = 0; i < 24; i++)
1359 Emit(
"ColorSelected(Pixel_t)", color);
1367 Emit(
"AlphaColorSelected(ULong_t)", color);
1376 for (
Int_t i = 0; i < 24; ++i)
1407 alpha = color->GetAlpha();
1644 if (tcolor)
p->PreviewAlphaColor((
ULongptr_t)tcolor);
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kFocusChangeMask
const Mask_t kButtonPressMask
const Mask_t kKeyReleaseMask
const Mask_t kAnyModifier
const Mask_t kKeyPressMask
Handle_t GContext_t
Graphics context handle.
const Mask_t kPointerMotionMask
const Mask_t kLeaveWindowMask
const Mask_t kStructureNotifyMask
const Mask_t kButtonReleaseMask
const Mask_t kEnterWindowMask
ULong_t Pixel_t
Pixel value.
static ULong_t gUcolor[24]
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize UnmapWindow
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void pixel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rect
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetMWMHints
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t SetWMSizeHints
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
void DeleteCanvasPainter()
assert on IsBatch() == false?
static Bool_t SupportAlpha()
Static function returning "true" if transparency is supported.
void Update() override
Update canvas pad buffers.
Draw the ROOT Color Wheel.
virtual void SetCanvas(TCanvas *can)
virtual Int_t GetColor(Int_t px, Int_t py) const
Return the color number pointed by the mouse.
void Draw(Option_t *option="") override
Paint the color wheel.
The color creation and management class.
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 RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
static ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding pixel value.
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
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...
ULong_t GetPixel() const
Return pixel value corresponding to this color.
virtual void SetAlpha(Float_t a)
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.
Bool_t IsEditable() const
const TGWindow * GetRoot() const
Returns current root (i.e.
void WaitForUnmap(TGWindow *w)
Wait for window to be unmapped.
const TGResourcePool * GetResourcePool() const
A full featured color selection dialog.
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process messages for the color selection dialog.
TGColorPalette * fPalette
color palette
TGTab * fTab
tab widget holding the color selectors
TGLabel * fColorInfo
color info
virtual void SetCurrentColor(Pixel_t col)
Change current color.
void DoPreview()
Slot method called when Preview button is clicked.
Int_t * fRetc
return code (kMBOk, kMBCancel)
TColorWheel * fColorWheel
color wheel
TGTextBuffer * fAlb
RGB/HLS associated buffers.
TGTextButton * fPreview
preview button;
Pixel_t fCurrentColor
currently selected color
Pixel_t * fRetColor
return color
TGColorPick * fColors
color pick widget
TGColorDialog(const TGColorDialog &)=delete
TColor * fRetTColor
return TColor, needed for changed alpha
void SetColorInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Set the color info in RGB and HLS parts.
TRootEmbeddedCanvas * fEcanvas
embedded canvas holding the color wheel
TGColorPalette * fCpalette
color palette
virtual void ColorSelected(Pixel_t)
Emit signal about selected color.
void CloseWindow() override
Called when window is closed via window manager.
TGTextEntry * fAle
RGB/HLS text entries.
TGFrame * fSample
color sample frame
virtual void AlphaColorSelected(ULongptr_t)
Emit signal about selected alpha and color.
Bool_t fWaitFor
call WaitFor method in constructor
Pixel_t fInitColor
initially set color
void UpdateRGBentries(Pixel_t *c)
Update RGB text entries with RGB values of color c.
void UpdateHLSentries(Pixel_t *c)
Update HLS text entries with HLS values of color c.
TGFrame * fSampleOld
color sample frame
virtual ~TGColorDialog()
TGColorDialog destructor.
void UpdateAlpha(Pixel_t *c)
Update Opacity text entry with alpha value of color c.
A widget showing an matrix of color cells.
void SetCellSize(Int_t w=20, Int_t h=17)
Set color cell size.
Bool_t HandleButton(Event_t *event) override
Handle button events in color palette.
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion events in color palette.
virtual ~TGColorPalette()
Destructor.
void SetColors(Pixel_t colors[])
Set color entries in color samples.
void DoRedraw() override
Redraw color palette.
Int_t fRows
number of color cell rows
Pixel_t GetColorByIndex(Int_t ix) const
virtual void LostFocus()
Remove keyboard input.
Pixel_t GetCurrentColor() const
Return currently selected color value.
UInt_t fCh
color cell height
void SetCurrentCellColor(Pixel_t color)
Set current cell color.
Int_t fCols
number of color cell columns
UInt_t fCw
color cell width
void DrawFocusHilite(Int_t onoff)
Draw a highlight rectangle around cell obtaining focus.
Pixel_t * fPixels
pixel value of colors
TGGC fDrawGC
graphics context used for drawing
virtual void GotFocus()
Add keyboard input.
void SetColor(Int_t ix, Pixel_t color)
Set color at index ix of color entries.
Int_t fCy
y coordinate of currently selected color cell
TGColorPalette(const TGColorPalette &)=delete
virtual void ColorSelected(Pixel_t col=0)
Bool_t HandleKey(Event_t *event) override
Handle keyboard events in color palette.
Int_t fCx
x coordinate of currently selected color cell
A widget which allows a color to be picked from HLS color space.
Bool_t HandleButton(Event_t *event) override
Handle mouse button events in color pick widget.
void SetLcursor(Int_t z)
Set lightness slider cursor position.
void DoRedraw() override
Redraw the color pick widget.
Int_t fCx
x position in hs colormap
Pixmap_t fLimage
color lightness slider pixmap
Int_t fNColors
number of color samples
Pixmap_t fHSimage
hue / saturation colormap pixmap
void UpdateCurrentColor()
Assign the current cursor position as currently selected color.
virtual ~TGColorPick()
TGColorPick destructor.
Int_t fClick
mouse click location (kCLICK_NONE, kCLICK_HS, kCLICK_L)
void CreateImages()
Create colormap and color slider images.
void SetColor(Pixel_t color)
Position the slider cursor on right color position.
virtual void ColorSelected(Pixel_t col=0)
Pixel_t fCurrentColor
currently selected color value
Int_t fCz
position in lightness slider
void SetSliderColor()
Set slider colors.
TGColorPick(const TGWindow *p=nullptr, Int_t w=1, Int_t h=1, Int_t id=-1)
TGColorPick constructor.
void AllocColors()
Try to allocate first a palette of 64 colors.
Rectangle_t fColormapRect
hue / saturation colormap rectangle
void FreeColors()
Free allocated colors.
Pixel_t GetCurrentColor() const
void DrawHScursor(Int_t onoff)
Draw hue / saturation cursor.
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...
void DrawLcursor(Int_t onoff)
Draw lightness slider cursor.
void InitImages()
Initialize color palette and slider images.
Rectangle_t fSliderRect
color lightness slider rectangle
void SetHScursor(Int_t x, Int_t y)
Set hue / saturation cursor position.
Bool_t HandleMotion(Event_t *event) override
Handle mouse motion events in color pick widget.
Int_t fCy
y position in hs colormap
TGGC fCursorGC
color lightness slider cursor GC
The base class for composite widgets (menu bars, list boxes, etc.).
TGDimension GetDefaultSize() const override
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
UInt_t GetDefaultHeight() const override
void SetCleanup(Int_t mode=kLocalCleanup) override
Turn on automatic cleanup of child frames in dtor.
void SetEditDisabled(UInt_t on=1) override
Set edit disable flag for this frame and subframes.
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
void RemoveInput(UInt_t emask)
Remove events specified in emask from the events the frame should handle.
UInt_t fHeight
frame height
virtual UInt_t GetDefaultWidth() const
virtual UInt_t GetDefaultHeight() const
virtual void DrawBorder()
Draw frame border.
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.
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
void MapWindow() override
map window
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
virtual void DeleteWindow()
Delete window.
virtual void SendMessage(const TGWindow *w, Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Send message (i.e.
static const TGGC & GetShadowGC()
Get shadow color graphics context.
virtual Pixel_t GetBackground() const
static const TGGC & GetBckgndGC()
Get background color graphics context.
void SetForeground(Pixel_t v)
Set foreground color.
A composite frame that layout their children in horizontal way.
TGHotString is a string with a "hot" character underlined.
This class handles GUI labels.
void SetTextJustify(Int_t tmode)
Set text justification.
virtual void SetText(TGString *newText)
Set new text in label.
This class describes layout hints used by the layout classes.
void SetClassHints(const char *className, const char *resourceName)
Set the windows class and resource name.
void SetIconName(const char *name)
Set window icon name. This is typically done via the window manager.
void SetWMSize(UInt_t w, UInt_t h)
Give the window manager a window size hint.
void SetWindowName(const char *name=nullptr) override
Set window name. This is typically done via the window manager.
This layout managers does not make use of TGLayoutHints.
TGClient * fClient
Connection to display server.
Handle_t fId
X11/Win32 Window identifier.
const TGGC * GetFrameGC() const
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
void AddText(Int_t pos, const char *text)
const char * GetString() const
Yield an action as soon as it is clicked.
A TGTextEntry is a one line text input widget.
void SetEnabled(Bool_t flag=kTRUE)
Defines transient windows that typically are used for dialogs windows.
const TGWindow * GetMain() const
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
A composite frame that layout their children in vertical way.
ROOT GUI Window base class.
@ kEditDisable
disable edit of this window
UInt_t fEditDisabled
flags used for "guibuilding"
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t IsZombie() const
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
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.
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
This class creates a TGCanvas in which a TCanvas is created.
TCanvas * GetCanvas() const
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
ULong_t fPixel
color pixel value (index in color table)
UShort_t fRed
red component (0..65535)
UShort_t fGreen
green component (0..65535)
UShort_t fBlue
blue component (0..65535)
Point structure (maps to the X11 XPoint structure)
Rectangle structure (maps to the X11 XRectangle structure)