173 if (cx >= 0 && cx < fCols && cy >= 0 && cy <
fRows) {
200 if (cx >= 0 && cx < fCols && cy >= 0 && cy <
fRows) {
226 gVirtualX->LookupString(event, input,
sizeof(input), keysym);
237 if (cx <
fCols - 1) ++cx;
245 if (cy <
fRows - 1) ++cy;
261 if (cx !=
fCx || cy !=
fCy) {
335 for (i = 0; i <
fRows; ++i) {
337 for (j = 0; j <
fCols; ++j) {
371 if (
fCx >= 0 &&
fCy >= 0) {
533 for (i = 0; i < 64; ++i) {
534 Int_t cc[4] = { 0, 21845, 43691, 65535 };
536 color.
fRed = cc[i & 0x3];
537 color.
fGreen = cc[(i >> 2) & 0x3];
538 color.
fBlue = cc[(i >> 4) & 0x3];
554 for (i = 0; i < 27; ++i) {
555 Int_t cc[3] = { 0, 32768, 65535 };
557 color.
fRed = cc[i % 3];
558 color.
fGreen = cc[(i / 3) % 3];
559 color.
fBlue = cc[(i / 9) % 3];
575 for (i = 0; i < 8; ++i) {
577 color.
fRed = (i & 1) * 65535;
578 color.
fGreen = ((i >> 1) & 1) * 65535;
579 color.
fBlue = ((i >> 2) & 1) * 65535;
597 for (i = 0; i < 8; ++i) {
599 color.
fRed = (i & 1) * 65535;
600 color.
fGreen = ((i >> 1) & 1) * 65535;
601 color.
fBlue = ((i >> 2) & 1) * 65535;
631 const Int_t kWidth = 20;
634 struct {
Int_t r,
g,
b; } ed[kWidth], ef;
643 for (
x = 0;
x < iw; ++
x) {
644 ed[
x].r = ed[
x].g = ed[
x].b = 0;
649 for (
y = 0;
y < ih; ++
y) {
653 for (
x = 0;
x < iw; ++
x) {
657 s = (ih -
y) * 255 / ih;
666 }
else if (which ==
kIMG_L) {
671 Int_t ll = (ih -
y) * 255 / ih;
675 for (
x = 0;
x < iw; ++
x) {
687 ef.r = ef.g = ef.b = 0;
689 for (
x = 0;
x < iw; ++
x) {
694 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
698 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
702 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
707 for (
x = 0;
x < iw; ++
x) {
712 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
715 v =
line[
x].fGreen + ef.g;
716 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
720 if (
v < 0)
v = 0;
else if (
v > 255)
v = 255;
725 sdist = 255L * 255L * 255L;
732 dist = dr * dr + dg * dg + db * db;
742 e[0] = (7 * v) >> 4; \
744 e[2] = (5 * v) >> 4; \
751 if (
x < iw-1) ed[
x+1].r =
e[1];
752 if (
x == 0) ed[
x].r =
e[2];
else ed[
x].r +=
e[2];
753 if (
x > 0) ed[
x-1].r +=
e[3];
759 if (
x < iw-1) ed[
x+1].g =
e[1];
760 if (
x == 0) ed[
x].g =
e[2];
else ed[
x].g +=
e[2];
761 if (
x > 0) ed[
x-1].g +=
e[3];
767 if (
x < iw-1) ed[
x+1].b =
e[1];
768 if (
x == 0) ed[
x].b =
e[2];
else ed[
x].b +=
e[2];
769 if (
x > 0) ed[
x-1].b +=
e[3];
791 for (
Int_t y = 0;
y < height; ++
y) {
797 s = (height -
y) * 255 / height;
829 for (
Int_t y = 0;
y < height; ++
y) {
834 l = (height -
y) * 255 / height;
890 l =
Int_t((lheight -
fCz) * 255 / lheight);
891 s =
Int_t((sheight -
fCy) * 255 / sheight);
1003 x =
fCx - 9; w = 19;
1004 y =
fCy - 9;
h = 19;
1006 if (
x < 0) { w +=
x;
x = 0; }
1007 if (
y < 0) {
h +=
y;
y = 0; }
1010 if (
y +
h > height)
h = height -
y;
1053 const Int_t kC_X = 175;
1054 const Int_t kC_Y = 180;
1159 wcan->
Connect(
"ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
"TGColorDialog",
this,
1160 "SetColorInfo(Int_t,Int_t,Int_t,TObject*)");
1182 for (i = 0; i < 48; ++i)
1233 if (
gUcolor[0] == 0xff000000) {
1234 for (i = 0; i < 24; i++)
1346 Emit(
"ColorSelected(Pixel_t)", color);
1354 Emit(
"AlphaColorSelected(ULong_t)", color);
1363 for (
Int_t i = 0; i < 24; ++i)
1394 alpha = color->GetAlpha();
const Mask_t kFocusChangeMask
const Mask_t kButtonPressMask
const Mask_t kKeyReleaseMask
const Mask_t kAnyModifier
Handle_t Pixmap_t
Pixmap handle.
const Mask_t kKeyPressMask
const Mask_t kPointerMotionMask
const Mask_t kLeaveWindowMask
const Mask_t kStructureNotifyMask
Handle_t GContext_t
Graphics context handle.
const Mask_t kButtonReleaseMask
const Mask_t kEnterWindowMask
ULong_t Pixel_t
Pixel value.
include TDocParser_001 C image html pict1_TDocParser_001 png width
static ULong_t gUcolor[24]
char * Form(const char *fmt,...)
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 Draw(Option_t *option="")
Paint the 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.
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
TGColorPalette * fPalette
virtual void SetCurrentColor(Pixel_t col)
Change current color.
void DoPreview()
Slot method called when Preview button is clicked.
virtual void CloseWindow()
Called when window is closed via window manager.
TColorWheel * fColorWheel
TGColorDialog(const TGColorDialog &)=delete
void SetColorInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
Set the color info in RGB and HLS parts.
TRootEmbeddedCanvas * fEcanvas
TGColorPalette * fCpalette
virtual void ColorSelected(Pixel_t)
Emit signal about selected color.
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
Process messages for the color selection dialog.
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.
virtual ~TGColorDialog()
TGColorDialog destructor.
void UpdateAlpha(Pixel_t *c)
Upadate Opacity text entry with alpha value of color c.
virtual void AlphaColorSelected(ULong_t)
Emit signal about selected alpha and color.
virtual Bool_t HandleKey(Event_t *event)
Handle keyboard events in color palette.
void SetCellSize(Int_t w=20, Int_t h=17)
Set color cell size.
virtual ~TGColorPalette()
Destructor.
virtual Bool_t HandleButton(Event_t *event)
Handle button events in color palette.
void SetColors(Pixel_t colors[])
Set color entries in color samples.
virtual void DoRedraw()
Redraw color palette.
Pixel_t GetColorByIndex(Int_t ix) const
virtual void LostFocus()
Remove keyboard input.
Pixel_t GetCurrentColor() const
Return currently selected color value.
void SetCurrentCellColor(Pixel_t color)
Set current cell color.
void DrawFocusHilite(Int_t onoff)
Draw a highlight rectangle around cell obtaining focus.
virtual void GotFocus()
Add keyboard input.
void SetColor(Int_t ix, Pixel_t color)
Set color at index ix of color entries.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events in color palette.
TGColorPalette(const TGColorPalette &)=delete
virtual void ColorSelected(Pixel_t col=0)
void SetLcursor(Int_t z)
Set lightness slider cursor position.
void UpdateCurrentColor()
Assign the current cursor position as currently selected color.
virtual Bool_t HandleMotion(Event_t *event)
Handle mouse motion events in color pick widget.
virtual ~TGColorPick()
TGColorPick destructor.
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)
void SetSliderColor()
Set slider colors.
void AllocColors()
Try to allocate first a palette of 64 colors.
Rectangle_t fColormapRect
TGColorPick(const TGWindow *p=0, Int_t w=1, Int_t h=1, Int_t id=-1)
TGColorPick constructor.
void FreeColors()
Free allocated colors.
Pixel_t GetCurrentColor() const
void DrawHScursor(Int_t onoff)
Draw hue / saturation cursor.
virtual Bool_t HandleButton(Event_t *event)
Handle mouse button events in color pick widget.
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.
virtual void DoRedraw()
Redraw the color pick widget.
void InitImages()
Initialize color palette and slider images.
void SetHScursor(Int_t x, Int_t y)
Set hue / saturation cursor position.
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void Cleanup()
Cleanup and delete all objects contained in this composite frame.
virtual void SetCleanup(Int_t mode=kLocalCleanup)
Turn on automatic cleanup of child frames in dtor.
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual UInt_t GetDefaultHeight() const
virtual void SetEditDisabled(UInt_t on=1)
Set edit disable flag for this frame and subframes.
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
void RemoveInput(UInt_t emask)
Remove events specified in emask from the events the frame should handle.
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.
virtual void SetBackgroundColor(Pixel_t back)
Set background color (override from TGWindow base class).
virtual void SendMessage(const TGWindow *w, Long_t msg, Long_t parm1, Long_t parm2)
Send message (i.e.
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
virtual void DeleteWindow()
Delete window.
static const TGGC & GetShadowGC()
Get shadow color graphics context.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
virtual Pixel_t GetBackground() const
virtual void MapWindow()
map window
static const TGGC & GetBckgndGC()
Get background color graphics context.
virtual void UnmapWindow()
unmap window
void SetForeground(Pixel_t v)
Set foreground color.
void SetTextJustify(Int_t tmode)
Set text justification.
virtual void SetText(TGString *newText)
Set new text in label.
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 SetMWMHints(UInt_t value, UInt_t funcs, UInt_t input)
Set decoration style for MWM-compatible wm (mwm, ncdwm, fvwm?).
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.
void SetWindowName(const char *name=0)
Set window name. This is typically done via the window manager.
const TGGC * GetFrameGC() const
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
void AddText(Int_t pos, const char *text)
const char * GetString() const
void SetEnabled(Bool_t flag=kTRUE)
const TGWindow * GetMain() const
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
Position transient frame centered relative to the parent frame.
virtual const char * GetName() const
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=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
TCanvas * GetCanvas() const
Short_t Max(Short_t a, Short_t b)
Short_t Min(Short_t a, Short_t 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)
EGEventType fType
of event (see EGEventType)
Int_t fY
pointer x, y coordinates in event window
UInt_t fCode
key or button code
Point structure (maps to the X11 XPoint structure)
Rectangle structure (maps to the X11 XRectangle structure)