43 if (values->fDashLen > (
Int_t)
sizeof(fValues.fDashes))
44 Warning(
"TGGC",
"dash list can have only up to %ld elements",
45 (
Long_t)
sizeof(fValues.fDashes));
46 fValues.fDashLen =
TMath::Min(values->fDashLen, (
Int_t)
sizeof(fValues.fDashes));
47 gVirtualX->SetDashes(fContext, fValues.fDashOffset, fValues.fDashes,
75 Error(
"TGGC",
"TGClient not yet initialized, should never happen");
95 gClient->GetGCPool()->fList->Add(
this);
104 gClient->GetGCPool()->ForceFreeGC(
this);
119 gClient->GetGCPool()->fList->Add(
this);
149 switch (bit & values->
fMask) {
218 Warning(
"UpdateValues",
"dash list can have only up to %ld elements",
238 gClient->GetGCPool()->fList->Add(
this);
490 Warning(
"SetDashList",
"dash list can have only up to %ld elements",
528 if (mask.
Length() == 0) mask =
"kGCFunction";
529 else mask +=
" | kGCFunction";
532 if (mask.
Length() == 0) mask =
"kGCPlaneMask";
533 else mask +=
" | kGCPlaneMask";
536 if (mask.
Length() == 0) mask =
"kGCForeground";
537 else mask +=
" | kGCForeground";
540 if (mask.
Length() == 0) mask =
"kGCBackground";
541 else mask +=
" | kGCBackground";
544 if (mask.
Length() == 0) mask =
"kGCLineWidth";
545 else mask +=
" | kGCLineWidth";
548 if (mask.
Length() == 0) mask =
"kGCLineStyle";
549 else mask +=
" | kGCLineStyle";
552 if (mask.
Length() == 0) mask =
"kGCCapStyle";
553 else mask +=
" | kGCCapStyle";
556 if (mask.
Length() == 0) mask =
"kGCJoinStyle";
557 else mask +=
" | kGCJoinStyle";
560 if (mask.
Length() == 0) mask =
"kGCFillStyle";
561 else mask +=
" | kGCFillStyle";
564 if (mask.
Length() == 0) mask =
"kGCFillRule";
565 else mask +=
" | kGCFillRule";
568 if (mask.
Length() == 0) mask =
"kGCTile";
569 else mask +=
" | kGCTile";
572 if (mask.
Length() == 0) mask =
"kGCStipple";
573 else mask +=
" | kGCStipple";
576 if (mask.
Length() == 0) mask =
"kGCTileStipXOrigin";
577 else mask +=
" | kGCTileStipXOrigin";
580 if (mask.
Length() == 0) mask =
"kGCTileStipYOrigin";
581 else mask +=
" | kGCTileStipYOrigin";
584 if (mask.
Length() == 0) mask =
"kGCFont";
585 else mask +=
" | kGCFont";
588 if (mask.
Length() == 0) mask =
"kGCSubwindowMode";
589 else mask +=
" | kGCSubwindowMode";
592 if (mask.
Length() == 0) mask =
"kGCGraphicsExposures";
593 else mask +=
" | kGCGraphicsExposures";
596 if (mask.
Length() == 0) mask =
"kGCClipXOrigin";
597 else mask +=
" | kGCClipXOrigin";
600 if (mask.
Length() == 0) mask =
"kGCClipYOrigin";
601 else mask +=
" | kGCClipYOrigin";
604 if (mask.
Length() == 0) mask =
"kGCClipMask";
605 else mask +=
" | kGCClipMask";
608 if (mask.
Length() == 0) mask =
"kGCDashOffset";
609 else mask +=
" | kGCDashOffset";
612 if (mask.
Length() == 0) mask =
"kGCDashList";
613 else mask +=
" | kGCDashList";
616 if (mask.
Length() == 0) mask =
"kGCArcMode";
617 else mask +=
" | kGCArcMode";
632 out <<
" TGGC *uGC; // will reflect user GC changes" << std::endl;
637 const char *colorname;
644 out <<
" // graphics context changes" << std::endl;
646 out <<
" GCValues_t " << valname.
Data() <<
";" << std::endl;
647 out <<
" " << valname.
Data() <<
".fMask = " <<
GetMaskString() <<
";" << std::endl;
649 for (
Mask_t bit = 1; bit <= fmask; bit <<= 1) {
650 switch (bit & fmask) {
655 out <<
" " << valname.
Data() <<
".fFunction = ";
664 out <<
"kGXandReverse";
670 out <<
"kGXandInverted";
691 out <<
"kGXorReverse";
694 out <<
"kGXcopyInverted";
697 out <<
"kGXorInverted";
706 out <<
";" << std::endl;
709 out <<
" " << valname.
Data() <<
".fPlaneMask = " <<
GetPlaneMask() <<
";" << std::endl;
714 out <<
" gClient->GetColorByName(" << quote << colorname << quote
715 <<
"," << valname.
Data() <<
".fForeground);" << std::endl;
720 out <<
" gClient->GetColorByName(" << quote << colorname << quote
721 <<
"," << valname.
Data() <<
".fBackground);" << std::endl;
724 out <<
" " << valname.
Data() <<
".fLineWidth = " <<
GetLineWidth() <<
";" << std::endl;
727 out <<
" " << valname.
Data() <<
".fLineStyle = ";
733 out <<
"kLineOnOffDash";
736 out <<
"kLineDoubleDash";
739 out <<
";" << std::endl;
742 out <<
" " << valname.
Data() <<
".fCapStyle = ";
745 out <<
"kCapNotLast";
754 out <<
"kCapProjecting";
757 out <<
";" << std::endl;
760 out <<
" " << valname.
Data() <<
".fJoinStyle = ";
772 out <<
";" << std::endl;
775 out <<
" " << valname.
Data() <<
".fFillStyle = ";
784 out <<
"kFillStippled";
787 out <<
"kFillOpaqueStippled";
790 out <<
";" << std::endl;
793 out <<
" " << valname.
Data() <<
".fFillRule = ";
796 out <<
"kEvenOddRule";
799 out <<
"kWindingRule";
802 out <<
";" << std::endl;
805 out <<
" " << valname.
Data() <<
".fTile = " <<
GetTile() <<
";" << std::endl;
808 out <<
" " << valname.
Data() <<
".fStipple = " <<
GetStipple() <<
";" << std::endl;
817 out <<
" " << valname.
Data() <<
".fFont = ufont->GetFontHandle();" << std::endl;
820 out <<
" " << valname.
Data() <<
".fSubwindowMode = ";
823 out <<
"kClipByChildren";
826 out <<
"kIncludeInferiors";
829 out <<
";" << std::endl;
832 out <<
" " << valname.
Data() <<
".fGraphicsExposures = ";
837 out <<
";" << std::endl;
840 out <<
" " << valname.
Data() <<
".fClipXOrigin = " <<
GetClipXOrigin() <<
";" << std::endl;
843 out <<
" " << valname.
Data() <<
".fClipYOrigin = " <<
GetClipYOrigin() <<
";" << std::endl;
846 out <<
" " << valname.
Data() <<
".fClipMask = " <<
GetClipMask() <<
";" << std::endl;
849 out <<
" " << valname.
Data() <<
".fDashOffset = " <<
GetDashOffset() <<
";" << std::endl;
853 Warning(
"TGGC::SavePrimitive",
"dash list can have only up to %ld elements",
855 out <<
" " << valname.
Data() <<
".fDashLen = "
857 out <<
" memcpy(GetDashes()," << valname.
Data() <<
".fDashes,"
858 << valname.
Data() <<
".fDashLen);" << std::endl;
861 out <<
" " << valname.
Data() <<
".fArcMode = ";
867 out <<
"kArcPieSlice";
870 out <<
";" << std::endl;
874 out <<
" uGC = gClient->GetGC(&" << valname.
Data() <<
", kTRUE);" << std::endl;
907 Error(
"ForceFreeGC",
"removed a shared graphics context\n"
908 "best to use graphics contexts via the TGGCPool()");
936 if (gc->fContext == gct) {
937 if (gc->RemoveReference() == 0) {
963 if (gc->fContext == gct)
987 TGGC *gc, *best_match = 0;
988 Int_t matching_bits, best_matching_bits = -1;
1002 matching_bits =
MatchGC(gc, values);
1003 if (matching_bits > best_matching_bits) {
1004 best_matching_bits = matching_bits;
1015 Printf(
"<TGGCPool::GetGC>: %smatching GC found\n", exact ?
"exact " :
"");
1040 Int_t matching_bits = -1;
1046 if (common_bits == 0)
return 0;
1063 for (bit = 1; bit <= common_bits; bit <<= 1) {
1064 switch (bit & common_bits) {
1145 return matching_bits;
TGGC(GCValues_t *values, Bool_t calledByGCPool)
void SetPlaneMask(ULong_t v)
Set plane mask.
void SetTileStipYOrigin(Int_t v)
Y offset for tile or stipple operations.
Int_t GetSubwindowMode() const
void UpdateValues(GCValues_t *v)
Update values + mask.
Int_t GetLineStyle() const
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
UInt_t References() const
void SetForeground(Pixel_t v)
Set foreground color.
const Mask_t kGCDashOffset
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Definitions for TRefCnt, base class for reference counted objects.
std::vector< double > values
Int_t GetTileStipXOrigin() const
Pixel_t GetBackground() const
const Mask_t kGCLineStyle
Short_t Min(Short_t a, Short_t b)
TGGC * FindGC(const TGGC *gc)
Find graphics context. Returns 0 in case gc is not found.
TGGC & operator=(const TGGC &rhs)
Graphics context assignment operator.
Pixmap_t GetStipple() const
Pixmap_t GetClipMask() const
EGraphicsFunction fFunction
Int_t GetJoinStyle() const
void SetFunction(EGraphicsFunction v)
Set graphics context drawing function.
virtual ~TGGCPool()
Delete graphics context pool.
Int_t GetDashOffset() const
static const char * PixelAsHexString(ULong_t pixel)
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::Ge...
const char * Data() const
Int_t MatchGC(const TGGC *gc, GCValues_t *values)
Try to find matching graphics context.
void SetBackground(Pixel_t v)
Set background color.
THashTable implements a hash table to store TObject's.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
void ForceFreeGC(const TGGC *gc)
Force remove graphics context from list. Is only called via ~TGGC().
void SetArcMode(Int_t v)
Set arc mode (kArcChord, kArcPieSlice).
const Mask_t kGCLineWidth
Int_t GetCapStyle() const
const Mask_t kGCGraphicsExposures
TObject & operator=(const TObject &rhs)
TObject assignment operator.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void Print(Option_t *option="") const
List all graphics contexts in the pool.
void SetStipple(Pixmap_t v)
Set 1 plane pixmap for stippling.
Int_t GetClipYOrigin() const
void Print(Option_t *option="") const
Print graphics contexts info.
void SetClipYOrigin(Int_t v)
Y origin for clipping.
void SetFont(FontH_t v)
Set font.
Bool_t fGraphicsExposures
void SetTileStipXOrigin(Int_t v)
X offset for tile or stipple operations.
void SetRefCount(UInt_t r)
void SetTile(Pixmap_t v)
Set tile pixmap for tiling operations.
const Mask_t kGCClipXOrigin
void SetFillStyle(Int_t v)
Set fill style (kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled).
ULong_t GetPlaneMask() const
void SetJoinStyle(Int_t v)
Set line join style (kJoinMiter, kJoinRound, kJoinBevel).
Bool_t GetGraphicsExposures() const
Int_t GetFillRule() const
virtual ~TGGC()
Delete graphics context.
const Mask_t kGCClipYOrigin
const Mask_t kGCJoinStyle
Int_t GetFillStyle() const
Pixel_t GetForeground() const
void Warning(const char *location, const char *msgfmt,...)
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
TString GetMaskString() const
Returns GC mask as a string - used in SavePrimitive().
void SetClipXOrigin(Int_t v)
X origin for clipping.
void SavePrimitive(std::ostream &out, Option_t *option="")
Save graphics context info as a C++ statement(s) on output stream out.
const Mask_t kGCFillStyle
void SetLineStyle(Int_t v)
Set line style (kLineSolid, kLineOnOffDash, kLineDoubleDash).
ClassImp(TGGC) TGGC
Create a graphics context (only called via TGGCPool::GetGC()).
void Add(TObject *obj)
Add object to the hash table.
const Mask_t kGCForeground
void SetAttributes(GCValues_t *values)
Set attributes as specified in the values structure.
void SetGraphicsExposures(Bool_t v)
True if graphics exposure should be generated.
Mother of all ROOT objects.
const char * GetDashes() const
const Mask_t kGCTileStipYOrigin
const Mask_t kGCSubwindowMode
const Mask_t kGCBackground
Int_t GetLineWidth() const
const Mask_t kGCTileStipXOrigin
void SetFillRule(Int_t v)
Set fill rule (kEvenOddRule, kWindingRule).
void UpdateGC(TGGC *gc, GCValues_t *values)
Update graphics context with the values spcified in values->fMask.
TObject * FindObject(const char *name) const
Find object using its name.
void SetLineWidth(Int_t v)
Set line width.
void SetDashOffset(Int_t v)
Patterned/dashed line offset.
EGraphicsFunction GetFunction() const
void SetClipMask(Pixmap_t v)
Bitmap for clipping.
void SetSubwindowMode(Int_t v)
Set sub window mode (kClipByChildren, kIncludeInferiors).
Int_t GetClipXOrigin() const
GContext_t operator()() const
Not inline due to a bug in g++ 2.96 20000731 (Red Hat Linux 7.0).
const Mask_t kGCPlaneMask
void FreeGC(const TGGC *gc)
Delete graphics context if it is not used anymore.
void SetDashList(const char v[], Int_t len)
Set dash pattern. First use SetDashOffset() if not 0.
void SetCapStyle(Int_t v)
Set cap style (kCapNotLast, kCapButt, kCapRound, kCapProjecting).
TObject * Remove(TObject *obj)
Remove object from the hashtable.
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get the best matching graphics context depending on values.
Int_t GetTileStipYOrigin() const
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.