Logo ROOT  
Reference Guide
TGGC.cxx
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 20/9/2000
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 
13 /** \class TGGC
14  \ingroup guiwidgets
15 
16 Encapsulate a graphics context used in the low level graphics.
17 TGGCPool provides a pool of graphics contexts.
18 
19 */
20 
21 
22 #include "TGClient.h"
23 #include "TGGC.h"
24 #include "TVirtualX.h"
25 #include "THashTable.h"
26 #include "TColor.h"
27 #include "TROOT.h"
28 
29 #include <iostream>
30 #include <cstring>
31 
32 
33 ClassImp(TGGC);
34 
35 ////////////////////////////////////////////////////////////////////////////////
36 /// Create a graphics context (only called via TGGCPool::GetGC()).
37 
39 {
40  fContext = 0;
41  if (values) {
42  fValues = *values;
43  fContext = gVirtualX->CreateGC(gVirtualX->GetDefaultRootWindow(), values);
44  if (values->fMask & kGCDashList) {
45  if (values->fDashLen > (Int_t)sizeof(fValues.fDashes))
46  Warning("TGGC", "dash list can have only up to %ld elements",
47  (Long_t)sizeof(fValues.fDashes));
51  }
52  } else {
53  fValues = {};
54  fContext = 0;
55  }
56  SetRefCount(1);
57 }
58 
59 ////////////////////////////////////////////////////////////////////////////////
60 /// Create a graphics context, registers GC in GCPool.
61 
63 {
64  fContext = 0;
65  // case of default ctor at program startup before gClient exists
66  if (!values) {
67  fValues = {};
68  fContext = 0;
69  SetRefCount(1);
70  return;
71  }
72 
73  if (gClient)
74  gClient->GetGC(values, kTRUE);
75  else {
76  fContext = 0;
77  Error("TGGC", "TGClient not yet initialized, should never happen");
78  }
79 }
80 
81 ////////////////////////////////////////////////////////////////////////////////
82 /// Copy a graphics context.
83 
85 {
86  fValues = g.fValues;
87  if (g.fContext) {
88  fContext = gVirtualX->CreateGC(gVirtualX->GetDefaultRootWindow(), &fValues);
92  } else
93  fContext = 0;
94  SetRefCount(1);
95 
96  if (gClient)
97  gClient->GetGCPool()->fList->Add(this);
98 }
99 
100 ////////////////////////////////////////////////////////////////////////////////
101 /// Delete graphics context.
102 
104 {
105  if (gClient)
106  gClient->GetGCPool()->ForceFreeGC(this);
107 
108  if (fContext)
109  gVirtualX->DeleteGC(fContext);
110 }
111 
112 ////////////////////////////////////////////////////////////////////////////////
113 /// Graphics context assignment operator.
114 
116 {
117  if (this != &rhs) {
118  if (!fContext && gClient) {
119  TGGC *gc = gClient->GetGCPool()->FindGC(this);
120  if (!gc)
121  gClient->GetGCPool()->fList->Add(this);
122  }
123  if (fContext)
124  gVirtualX->DeleteGC(fContext);
125  TObject::operator=(rhs);
126  fValues = rhs.fValues;
127  fContext = gVirtualX->CreateGC(gVirtualX->GetDefaultRootWindow(), &fValues);
128  if (fValues.fMask & kGCDashList)
130  fValues.fDashLen);
131  }
132  return *this;
133 }
134 
135 ////////////////////////////////////////////////////////////////////////////////
136 /// Not inline due to a bug in g++ 2.96 20000731 (Red Hat Linux 7.0).
137 
139 {
140  return fContext;
141 }
142 
143 ////////////////////////////////////////////////////////////////////////////////
144 /// Update values + mask.
145 
147 {
148  fValues.fMask |= values->fMask;
149 
150  for (Mask_t bit = 1; bit <= fValues.fMask; bit <<= 1) {
151  switch (bit & values->fMask) {
152  default:
153  case 0:
154  continue;
155  case kGCFunction:
156  fValues.fFunction = values->fFunction;
157  break;
158  case kGCPlaneMask:
159  fValues.fPlaneMask = values->fPlaneMask;
160  break;
161  case kGCForeground:
162  fValues.fForeground = values->fForeground;
163  break;
164  case kGCBackground:
165  fValues.fBackground = values->fBackground;
166  break;
167  case kGCLineWidth:
168  fValues.fLineWidth = values->fLineWidth;
169  break;
170  case kGCLineStyle:
171  fValues.fLineStyle = values->fLineStyle;
172  break;
173  case kGCCapStyle:
174  fValues.fCapStyle = values->fCapStyle;
175  break;
176  case kGCJoinStyle:
177  fValues.fJoinStyle = values->fJoinStyle;
178  break;
179  case kGCFillStyle:
180  fValues.fFillStyle = values->fFillStyle;
181  break;
182  case kGCFillRule:
183  fValues.fFillRule = values->fFillRule;
184  break;
185  case kGCTile:
186  fValues.fTile = values->fTile;
187  break;
188  case kGCStipple:
189  fValues.fStipple = values->fStipple;
190  break;
191  case kGCTileStipXOrigin:
192  fValues.fTsXOrigin = values->fTsXOrigin;
193  break;
194  case kGCTileStipYOrigin:
195  fValues.fTsYOrigin = values->fTsYOrigin;
196  break;
197  case kGCFont:
198  fValues.fFont = values->fFont;
199  break;
200  case kGCSubwindowMode:
202  break;
205  break;
206  case kGCClipXOrigin:
208  break;
209  case kGCClipYOrigin:
211  break;
212  case kGCClipMask:
213  fValues.fClipMask = values->fClipMask;
214  break;
215  case kGCDashOffset:
216  fValues.fDashOffset = values->fDashOffset;
217  break;
218  case kGCDashList:
219  if (values->fDashLen > (Int_t)sizeof(fValues.fDashes))
220  Warning("UpdateValues", "dash list can have only up to %ld elements",
221  (Long_t)sizeof(fValues.fDashes));
222  fValues.fDashLen = TMath::Min(values->fDashLen, (Int_t)sizeof(fValues.fDashes));
223  memcpy(fValues.fDashes, values->fDashes, fValues.fDashLen);
224  break;
225  case kGCArcMode:
226  fValues.fArcMode = values->fArcMode;
227  break;
228  }
229  }
230 }
231 
232 ////////////////////////////////////////////////////////////////////////////////
233 /// Set attributes as specified in the values structure.
234 
236 {
237  if (!fContext && gClient) {
238  TGGC *gc = gClient->GetGCPool()->FindGC(this);
239  if (!gc)
240  gClient->GetGCPool()->fList->Add(this);
241  }
242 
243  if (fContext)
244  gVirtualX->ChangeGC(fContext, values);
245  else
246  fContext = gVirtualX->CreateGC(gVirtualX->GetDefaultRootWindow(), values);
247  UpdateValues(values);
248  if (values->fMask & kGCDashList)
250  fValues.fDashLen);
251 }
252 
253 ////////////////////////////////////////////////////////////////////////////////
254 /// Set graphics context drawing function.
255 
257 {
258  GCValues_t values;
259  values.fFunction = v;
260  values.fMask = kGCFunction;
261  SetAttributes(&values);
262 }
263 
264 ////////////////////////////////////////////////////////////////////////////////
265 /// Set plane mask.
266 
268 {
269  GCValues_t values;
270  values.fPlaneMask = v;
271  values.fMask = kGCPlaneMask;
272  SetAttributes(&values);
273 }
274 
275 ////////////////////////////////////////////////////////////////////////////////
276 /// Set foreground color.
277 
279 {
280  GCValues_t values;
281  values.fForeground = v;
282  values.fMask = kGCForeground;
283  SetAttributes(&values);
284 }
285 
286 ////////////////////////////////////////////////////////////////////////////////
287 /// Set background color.
288 
290 {
291  GCValues_t values;
292  values.fBackground = v;
293  values.fMask = kGCBackground;
294  SetAttributes(&values);
295 }
296 
297 ////////////////////////////////////////////////////////////////////////////////
298 /// Set line width.
299 
301 {
302  GCValues_t values;
303  values.fLineWidth = v;
304  values.fMask = kGCLineWidth;
305  SetAttributes(&values);
306 }
307 
308 ////////////////////////////////////////////////////////////////////////////////
309 /// Set line style (kLineSolid, kLineOnOffDash, kLineDoubleDash).
310 
312 {
313  GCValues_t values;
314  values.fLineStyle = v;
315  values.fMask = kGCLineStyle;
316  SetAttributes(&values);
317 }
318 
319 ////////////////////////////////////////////////////////////////////////////////
320 /// Set cap style (kCapNotLast, kCapButt, kCapRound, kCapProjecting).
321 
323 {
324  GCValues_t values;
325  values.fCapStyle = v;
326  values.fMask = kGCCapStyle;
327  SetAttributes(&values);
328 }
329 
330 ////////////////////////////////////////////////////////////////////////////////
331 /// Set line join style (kJoinMiter, kJoinRound, kJoinBevel).
332 
334 {
335  GCValues_t values;
336  values.fJoinStyle = v;
337  values.fMask = kGCJoinStyle;
338  SetAttributes(&values);
339 }
340 
341 ////////////////////////////////////////////////////////////////////////////////
342 /// Set fill style (kFillSolid, kFillTiled, kFillStippled,
343 /// kFillOpaeueStippled).
344 
346 {
347  GCValues_t values;
348  values.fFillStyle = v;
349  values.fMask = kGCFillStyle;
350  SetAttributes(&values);
351 }
352 
353 ////////////////////////////////////////////////////////////////////////////////
354 /// Set fill rule (kEvenOddRule, kWindingRule).
355 
357 {
358  GCValues_t values;
359  values.fFillRule = v;
360  values.fMask = kGCFillRule;
361  SetAttributes(&values);
362 }
363 
364 ////////////////////////////////////////////////////////////////////////////////
365 /// Set tile pixmap for tiling operations.
366 
368 {
369  GCValues_t values;
370  values.fTile = v;
371  values.fMask = kGCTile;
372  SetAttributes(&values);
373 }
374 
375 ////////////////////////////////////////////////////////////////////////////////
376 /// Set 1 plane pixmap for stippling.
377 
379 {
380  GCValues_t values;
381  values.fStipple = v;
382  values.fMask = kGCStipple;
383  SetAttributes(&values);
384 }
385 
386 ////////////////////////////////////////////////////////////////////////////////
387 /// X offset for tile or stipple operations.
388 
390 {
391  GCValues_t values;
392  values.fTsXOrigin = v;
393  values.fMask = kGCTileStipXOrigin;
394  SetAttributes(&values);
395 }
396 
397 ////////////////////////////////////////////////////////////////////////////////
398 /// Y offset for tile or stipple operations.
399 
401 {
402  GCValues_t values;
403  values.fTsYOrigin = v;
404  values.fMask = kGCTileStipYOrigin;
405  SetAttributes(&values);
406 }
407 
408 ////////////////////////////////////////////////////////////////////////////////
409 /// Set font.
410 
412 {
413  GCValues_t values;
414  values.fFont = v;
415  values.fMask = kGCFont;
416  SetAttributes(&values);
417 }
418 
419 ////////////////////////////////////////////////////////////////////////////////
420 /// Set sub window mode (kClipByChildren, kIncludeInferiors).
421 
423 {
424  GCValues_t values;
425  values.fSubwindowMode = v;
426  values.fMask = kGCSubwindowMode;
427  SetAttributes(&values);
428 }
429 
430 ////////////////////////////////////////////////////////////////////////////////
431 /// True if graphics exposure should be generated.
432 
434 {
435  GCValues_t values;
436  values.fGraphicsExposures = v;
437  values.fMask = kGCGraphicsExposures;
438  SetAttributes(&values);
439 }
440 
441 ////////////////////////////////////////////////////////////////////////////////
442 /// X origin for clipping.
443 
445 {
446  GCValues_t values;
447  values.fClipXOrigin = v;
448  values.fMask = kGCClipXOrigin;
449  SetAttributes(&values);
450 }
451 
452 ////////////////////////////////////////////////////////////////////////////////
453 /// Y origin for clipping.
454 
456 {
457  GCValues_t values;
458  values.fClipYOrigin = v;
459  values.fMask = kGCClipYOrigin;
460  SetAttributes(&values);
461 }
462 
463 ////////////////////////////////////////////////////////////////////////////////
464 /// Bitmap for clipping.
465 
467 {
468  GCValues_t values;
469  values.fClipMask = v;
470  values.fMask = kGCClipMask;
471  SetAttributes(&values);
472 }
473 
474 ////////////////////////////////////////////////////////////////////////////////
475 /// Patterned/dashed line offset.
476 
478 {
479  GCValues_t values;
480  values.fDashOffset = v;
481  values.fMask = kGCDashOffset;
482  SetAttributes(&values);
483 }
484 
485 ////////////////////////////////////////////////////////////////////////////////
486 /// Set dash pattern. First use SetDashOffset() if not 0.
487 
488 void TGGC::SetDashList(const char v[], Int_t len)
489 {
490  GCValues_t values;
491  if (len > (Int_t)sizeof(values.fDashes))
492  Warning("SetDashList", "dash list can have only up to %ld elements",
493  (Long_t)sizeof(values.fDashes));
494  values.fDashLen = TMath::Min(len, (Int_t)sizeof(values.fDashes));
495  memcpy(values.fDashes, v, values.fDashLen);
496  values.fMask = kGCDashList;
497  SetAttributes(&values);
498 }
499 
500 ////////////////////////////////////////////////////////////////////////////////
501 /// Set arc mode (kArcChord, kArcPieSlice).
502 
504 {
505  GCValues_t values;
506  values.fArcMode = v;
507  values.fMask = kGCArcMode;
508  SetAttributes(&values);
509 }
510 
511 ////////////////////////////////////////////////////////////////////////////////
512 /// Print graphics contexts info.
513 
514 void TGGC::Print(Option_t *) const
515 {
516  Printf("TGGC: mask = %x, handle = %lx, ref cnt = %u", fValues.fMask,
517  fContext, References());
518 }
519 
520 ////////////////////////////////////////////////////////////////////////////////
521 /// Returns GC mask as a string - used in SavePrimitive().
522 
524 {
525  TString mask;
526 
527  Mask_t fmask = GetMask();
528 
529  if (fmask & kGCFunction) {
530  if (mask.Length() == 0) mask = "kGCFunction";
531  else mask += " | kGCFunction";
532  }
533  if (fmask & kGCPlaneMask) {
534  if (mask.Length() == 0) mask = "kGCPlaneMask";
535  else mask += " | kGCPlaneMask";
536  }
537  if (fmask & kGCForeground) {
538  if (mask.Length() == 0) mask = "kGCForeground";
539  else mask += " | kGCForeground";
540  }
541  if (fmask & kGCBackground) {
542  if (mask.Length() == 0) mask = "kGCBackground";
543  else mask += " | kGCBackground";
544  }
545  if (fmask & kGCLineWidth) {
546  if (mask.Length() == 0) mask = "kGCLineWidth";
547  else mask += " | kGCLineWidth";
548  }
549  if (fmask & kGCLineStyle) {
550  if (mask.Length() == 0) mask = "kGCLineStyle";
551  else mask += " | kGCLineStyle";
552  }
553  if (fmask & kGCCapStyle) {
554  if (mask.Length() == 0) mask = "kGCCapStyle";
555  else mask += " | kGCCapStyle";
556  }
557  if (fmask & kGCJoinStyle) {
558  if (mask.Length() == 0) mask = "kGCJoinStyle";
559  else mask += " | kGCJoinStyle";
560  }
561  if (fmask & kGCFillStyle) {
562  if (mask.Length() == 0) mask = "kGCFillStyle";
563  else mask += " | kGCFillStyle";
564  }
565  if (fmask & kGCFillRule) {
566  if (mask.Length() == 0) mask = "kGCFillRule";
567  else mask += " | kGCFillRule";
568  }
569  if (fmask & kGCTile) {
570  if (mask.Length() == 0) mask = "kGCTile";
571  else mask += " | kGCTile";
572  }
573  if (fmask & kGCStipple) {
574  if (mask.Length() == 0) mask = "kGCStipple";
575  else mask += " | kGCStipple";
576  }
577  if (fmask & kGCTileStipXOrigin) {
578  if (mask.Length() == 0) mask = "kGCTileStipXOrigin";
579  else mask += " | kGCTileStipXOrigin";
580  }
581  if (fmask & kGCTileStipYOrigin) {
582  if (mask.Length() == 0) mask = "kGCTileStipYOrigin";
583  else mask += " | kGCTileStipYOrigin";
584  }
585  if (fmask & kGCFont) {
586  if (mask.Length() == 0) mask = "kGCFont";
587  else mask += " | kGCFont";
588  }
589  if (fmask & kGCSubwindowMode) {
590  if (mask.Length() == 0) mask = "kGCSubwindowMode";
591  else mask += " | kGCSubwindowMode";
592  }
593  if (fmask & kGCGraphicsExposures) {
594  if (mask.Length() == 0) mask = "kGCGraphicsExposures";
595  else mask += " | kGCGraphicsExposures";
596  }
597  if (fmask & kGCClipXOrigin) {
598  if (mask.Length() == 0) mask = "kGCClipXOrigin";
599  else mask += " | kGCClipXOrigin";
600  }
601  if (fmask & kGCClipYOrigin) {
602  if (mask.Length() == 0) mask = "kGCClipYOrigin";
603  else mask += " | kGCClipYOrigin";
604  }
605  if (fmask & kGCClipMask) {
606  if (mask.Length() == 0) mask = "kGCClipMask";
607  else mask += " | kGCClipMask";
608  }
609  if (fmask & kGCDashOffset) {
610  if (mask.Length() == 0) mask = "kGCDashOffset";
611  else mask += " | kGCDashOffset";
612  }
613  if (fmask & kGCDashList) {
614  if (mask.Length() == 0) mask = "kGCDashList";
615  else mask += " | kGCDashList";
616  }
617  if (fmask & kGCArcMode) {
618  if (mask.Length() == 0) mask = "kGCArcMode";
619  else mask += " | kGCArcMode";
620  }
621  return mask;
622 }
623 
624 ////////////////////////////////////////////////////////////////////////////////
625 /// Save graphics context info as a C++ statement(s) on output stream out
626 
627 void TGGC::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
628 {
629  if (gROOT->ClassSaved(TGGC::Class())) {
630  out << std::endl;
631  } else {
632  // declare graphics context object to reflect required user changes
633  out << std::endl;
634  out << " TGGC *uGC; // will reflect user GC changes" << std::endl;
635  }
636 
637  Mask_t fmask = GetMask();
638 
639  const char *colorname;
640  TString valname;
641  char quote ='"';
642  ULong_t color;
643 
644  valname = TString::Format("val%s", option);
645 
646  out << " // graphics context changes" << std::endl;
647  //out << " TGGC *uGC" << option << ";" << std::endl;
648  out << " GCValues_t " << valname.Data() << ";" << std::endl;
649  out << " " << valname.Data() << ".fMask = " << GetMaskString() << ";" << std::endl;
650 
651  for (Mask_t bit = 1; bit <= fmask; bit <<= 1) {
652  switch (bit & fmask) {
653  default:
654  case 0:
655  continue;
656  case kGCFunction:
657  out << " " << valname.Data() << ".fFunction = ";
658  switch (GetFunction()) {
659  case kGXclear:
660  out << "kGXclear";
661  break;
662  case kGXand:
663  out << "kGXand";
664  break;
665  case kGXandReverse:
666  out << "kGXandReverse";
667  break;
668  case kGXcopy:
669  out << "kGXcopy";
670  break;
671  case kGXandInverted:
672  out << "kGXandInverted";
673  break;
674  case kGXnoop:
675  out << "kGXnoop";
676  break;
677  case kGXxor:
678  out << "kGXxor";
679  break;
680  case kGXor:
681  out << "kGXor";
682  break;
683  case kGXnor:
684  out << "kGXnor";
685  break;
686  case kGXequiv:
687  out << "kGXequiv";
688  break;
689  case kGXinvert:
690  out << "kGXinvert";
691  break;
692  case kGXorReverse:
693  out << "kGXorReverse";
694  break;
695  case kGXcopyInverted:
696  out << "kGXcopyInverted";
697  break;
698  case kGXorInverted:
699  out << "kGXorInverted";
700  break;
701  case kGXnand:
702  out << "kGXnand";
703  break;
704  case kGXset:
705  out << "kGXset";
706  break;
707  }
708  out << ";" << std::endl;
709  break;
710  case kGCPlaneMask:
711  out << " " << valname.Data() << ".fPlaneMask = " << GetPlaneMask() << ";" << std::endl;
712  break;
713  case kGCForeground:
714  color = GetForeground();
715  colorname = TColor::PixelAsHexString(color);
716  out << " gClient->GetColorByName(" << quote << colorname << quote
717  << "," << valname.Data() << ".fForeground);" << std::endl;
718  break;
719  case kGCBackground:
720  color = GetBackground();
721  colorname = TColor::PixelAsHexString(color);
722  out << " gClient->GetColorByName(" << quote << colorname << quote
723  << "," << valname.Data() << ".fBackground);" << std::endl;
724  break;
725  case kGCLineWidth:
726  out << " " << valname.Data() << ".fLineWidth = " << GetLineWidth() << ";" << std::endl;
727  break;
728  case kGCLineStyle:
729  out << " " << valname.Data() << ".fLineStyle = ";
730  switch (GetLineStyle()) {
731  case kLineSolid:
732  out << "kLineSolid";
733  break;
734  case kLineOnOffDash:
735  out << "kLineOnOffDash";
736  break;
737  case kLineDoubleDash:
738  out << "kLineDoubleDash";
739  break;
740  }
741  out << ";" << std::endl;
742  break;
743  case kGCCapStyle:
744  out << " " << valname.Data() << ".fCapStyle = ";
745  switch (GetCapStyle()) {
746  case kCapNotLast:
747  out << "kCapNotLast";
748  break;
749  case kCapButt:
750  out << "kCapButt";
751  break;
752  case kCapRound:
753  out << "kCapRound";
754  break;
755  case kCapProjecting:
756  out << "kCapProjecting";
757  break;
758  }
759  out << ";" << std::endl;
760  break;
761  case kGCJoinStyle:
762  out << " " << valname.Data() << ".fJoinStyle = ";
763  switch (GetJoinStyle()) {
764  case kJoinMiter:
765  out << "kJoinMiter";
766  break;
767  case kJoinRound:
768  out << "kJoinRound";
769  break;
770  case kJoinBevel:
771  out << "kJoinBevel";
772  break;
773  }
774  out << ";" << std::endl;
775  break;
776  case kGCFillStyle:
777  out << " " << valname.Data() << ".fFillStyle = ";
778  switch (GetFillStyle()) {
779  case kFillSolid:
780  out << "kFillSolid";
781  break;
782  case kFillTiled:
783  out << "kFillTiled";
784  break;
785  case kFillStippled:
786  out << "kFillStippled";
787  break;
788  case kFillOpaqueStippled:
789  out << "kFillOpaqueStippled";
790  break;
791  }
792  out << ";" << std::endl;
793  break;
794  case kGCFillRule:
795  out << " " << valname.Data() << ".fFillRule = ";
796  switch (GetFillRule()) {
797  case kEvenOddRule:
798  out << "kEvenOddRule";
799  break;
800  case kWindingRule:
801  out << "kWindingRule";
802  break;
803  }
804  out << ";" << std::endl;
805  break;
806  case kGCTile:
807  out << " " << valname.Data() << ".fTile = " << GetTile() << ";" << std::endl;
808  break;
809  case kGCStipple:
810  out << " " << valname.Data() << ".fStipple = " << GetStipple() << ";" << std::endl;
811  break;
812  case kGCTileStipXOrigin:
813  out << " " << valname.Data() << ".fTsXOrigin = " << GetTileStipXOrigin() << ";" << std::endl;
814  break;
815  case kGCTileStipYOrigin:
816  out << " " << valname.Data() << ".fTsYOrigin = " << GetTileStipYOrigin() << ";" << std::endl;
817  break;
818  case kGCFont:
819  out << " " << valname.Data() << ".fFont = ufont->GetFontHandle();" << std::endl;
820  break;
821  case kGCSubwindowMode:
822  out << " " << valname.Data() << ".fSubwindowMode = ";
823  switch (GetSubwindowMode()) {
824  case kClipByChildren:
825  out << "kClipByChildren";
826  break;
827  case kIncludeInferiors:
828  out << "kIncludeInferiors";
829  break;
830  }
831  out << ";" << std::endl;
832  break;
834  out << " " << valname.Data() << ".fGraphicsExposures = ";
835  if (GetGraphicsExposures())
836  out << "kTRUE";
837  else
838  out << "kFALSE";
839  out << ";" << std::endl;
840  break;
841  case kGCClipXOrigin:
842  out << " " << valname.Data() << ".fClipXOrigin = " << GetClipXOrigin() << ";" << std::endl;
843  break;
844  case kGCClipYOrigin:
845  out << " " << valname.Data() << ".fClipYOrigin = " << GetClipYOrigin() << ";" << std::endl;
846  break;
847  case kGCClipMask:
848  out << " " << valname.Data() << ".fClipMask = " << GetClipMask() << ";" << std::endl;
849  break;
850  case kGCDashOffset:
851  out << " " << valname.Data() << ".fDashOffset = " << GetDashOffset() << ";" << std::endl;
852  break;
853  case kGCDashList:
854  if (GetDashLen() > (Int_t)sizeof(GetDashes()))
855  Warning("TGGC::SavePrimitive", "dash list can have only up to %ld elements",
856  (Long_t)sizeof(GetDashes()));
857  out << " " << valname.Data() << ".fDashLen = "
858  << TMath::Min(GetDashLen(),(Int_t)sizeof(GetDashes())) << ";" << std::endl;
859  out << " memcpy(GetDashes()," << valname.Data() << ".fDashes,"
860  << valname.Data() << ".fDashLen);" << std::endl;
861  break;
862  case kGCArcMode:
863  out << " " << valname.Data() << ".fArcMode = ";
864  switch (GetArcMode()) {
865  case kArcChord:
866  out << "kArcChord";
867  break;
868  case kArcPieSlice:
869  out << "kArcPieSlice";
870  break;
871  }
872  out << ";" << std::endl;
873  break;
874  }
875  }
876  out << " uGC = gClient->GetGC(&" << valname.Data() << ", kTRUE);" << std::endl;
877 }
878 
879 
881 
882 ////////////////////////////////////////////////////////////////////////////////
883 /// Create graphics context pool.
884 
886 {
887  fClient = client;
888  fList = new THashTable;
889  fList->SetOwner();
890 }
891 
892 ////////////////////////////////////////////////////////////////////////////////
893 /// Delete graphics context pool.
894 
896 {
897  delete fList;
898 }
899 
900 ////////////////////////////////////////////////////////////////////////////////
901 /// Force remove graphics context from list. Is only called via ~TGGC().
902 
903 void TGGCPool::ForceFreeGC(const TGGC *gct)
904 {
905  TGGC *gc = (TGGC *) fList->FindObject(gct);
906 
907  if (gc) {
908  if (gc->References() > 1)
909  Error("ForceFreeGC", "removed a shared graphics context\n"
910  "best to use graphics contexts via the TGGCPool()");
911  fList->Remove(gc);
912  }
913 }
914 
915 ////////////////////////////////////////////////////////////////////////////////
916 /// Delete graphics context if it is not used anymore.
917 
918 void TGGCPool::FreeGC(const TGGC *gct)
919 {
920  TGGC *gc = (TGGC *) fList->FindObject(gct);
921 
922  if (gc) {
923  if (gc->RemoveReference() == 0) {
924  fList->Remove(gc);
925  delete gc;
926  }
927  }
928 }
929 
930 ////////////////////////////////////////////////////////////////////////////////
931 /// Delete graphics context if it is not used anymore.
932 
934 {
935  TIter next(fList);
936 
937  while (TGGC *gc = (TGGC *) next()) {
938  if (gc->fContext == gct) {
939  if (gc->RemoveReference() == 0) {
940  fList->Remove(gc);
941  delete gc;
942  return;
943  }
944  }
945  }
946 }
947 
948 ////////////////////////////////////////////////////////////////////////////////
949 /// Find graphics context. Returns 0 in case gc is not found.
950 
952 {
953  return (TGGC*) fList->FindObject(gct);
954 }
955 
956 ////////////////////////////////////////////////////////////////////////////////
957 /// Find graphics context based on its GContext_t handle. Returns 0
958 /// in case gc is not found.
959 
961 {
962  TIter next(fList);
963 
964  while (TGGC *gc = (TGGC *) next()) {
965  if (gc->fContext == gct)
966  return gc;
967  }
968  return 0;
969 }
970 
971 ////////////////////////////////////////////////////////////////////////////////
972 /// returns graphics context based on its GContext_t handle.
973 
975 {
976  GCValues_t gval;
977  gVirtualX->GetGCValues(gct, gval);
978  return GetGC(&gval, kTRUE);
979 }
980 
981 ////////////////////////////////////////////////////////////////////////////////
982 /// Get the best matching graphics context depending on values.
983 /// If rw is false only a readonly, not modifiable graphics context
984 /// is returned. If rw is true a new modifiable graphics context is
985 /// returned.
986 
988 {
989  TGGC *gc, *best_match = 0;
990  Int_t matching_bits, best_matching_bits = -1;
991  Bool_t exact = kFALSE;
992 
993  if (!values)
994  rw = kTRUE;
995 
996  if (!rw) {
997 
998  // First, try to find an exact matching GC.
999  // If no one found, then use the closest one.
1000 
1001  TIter next(fList);
1002 
1003  while ((gc = (TGGC *) next())) {
1004  matching_bits = MatchGC(gc, values);
1005  if (matching_bits > best_matching_bits) {
1006  best_matching_bits = matching_bits;
1007  best_match = gc;
1008  if ((gc->fValues.fMask & values->fMask) == values->fMask) {
1009  exact = kTRUE;
1010  break;
1011  }
1012  }
1013  }
1014 
1015  if (best_match) {
1016  if (gDebug > 0)
1017  Printf("<TGGCPool::GetGC>: %smatching GC found\n", exact ? "exact " : "");
1018  best_match->AddReference();
1019  if (!exact) {
1020  // add missing values to the best_match'ing GC...
1021  UpdateGC(best_match, values);
1022  }
1023  return best_match;
1024  }
1025  }
1026 
1027  gc = new TGGC(values, kTRUE);
1028 
1029  fList->Add(gc);
1030 
1031  return gc;
1032 }
1033 
1034 ////////////////////////////////////////////////////////////////////////////////
1035 /// Try to find matching graphics context. On success returns the amount
1036 /// of matching bits (which may be zero if masks have no common bits),
1037 /// -1 on failure (when there are common bits but not a single match).
1038 
1040 {
1041  Mask_t bit, common_bits;
1042  Int_t matching_bits = -1;
1043  Bool_t match = kFALSE;
1044  const GCValues_t *gcv = &gc->fValues;
1045 
1046  common_bits = values->fMask & gcv->fMask;
1047 
1048  if (common_bits == 0) return 0; // no common bits, a possible
1049  // candidate anyway.
1050 
1051  // Careful, check first the tile and stipple mask bits, as these
1052  // influence nearly all other GC functions... (do the same for
1053  // some other such bits as GCFunction, etc...). Perhaps we should
1054  // allow only exact GC matches.
1055 
1056  if (gcv->fMask & kGCTile)
1057  if ((gcv->fTile != kNone) && !(values->fMask & kGCTile)) return -1;
1058  if (values->fMask & kGCTile)
1059  if ((values->fTile != kNone) && !(gcv->fMask & kGCTile)) return -1;
1060  if (gcv->fMask & kGCStipple)
1061  if ((gcv->fStipple != kNone) && !(values->fMask & kGCStipple)) return -1;
1062  if (values->fMask & kGCStipple)
1063  if ((values->fStipple != kNone) && !(gcv->fMask & kGCStipple)) return -1;
1064 
1065  for (bit = 1; bit <= common_bits; bit <<= 1) {
1066  switch (bit & common_bits) {
1067  default:
1068  case 0:
1069  continue;
1070  case kGCFunction:
1071  match = (values->fFunction == gcv->fFunction);
1072  break;
1073  case kGCPlaneMask:
1074  match = (values->fPlaneMask == gcv->fPlaneMask);
1075  break;
1076  case kGCForeground:
1077  match = (values->fForeground == gcv->fForeground);
1078  break;
1079  case kGCBackground:
1080  match = (values->fBackground == gcv->fBackground);
1081  break;
1082  case kGCLineWidth:
1083  match = (values->fLineWidth == gcv->fLineWidth);
1084  break;
1085  case kGCLineStyle:
1086  match = (values->fLineStyle == gcv->fLineStyle);
1087  break;
1088  case kGCCapStyle:
1089  match = (values->fCapStyle == gcv->fCapStyle);
1090  break;
1091  case kGCJoinStyle:
1092  match = (values->fJoinStyle == gcv->fJoinStyle);
1093  break;
1094  case kGCFillStyle:
1095  match = (values->fFillStyle == gcv->fFillStyle);
1096  break;
1097  case kGCFillRule:
1098  match = (values->fFillRule == gcv->fFillRule);
1099  break;
1100  case kGCTile:
1101  match = (values->fTile == gcv->fTile);
1102  break;
1103  case kGCStipple:
1104  match = (values->fStipple == gcv->fStipple);
1105  break;
1106  case kGCTileStipXOrigin:
1107  match = (values->fTsXOrigin == gcv->fTsXOrigin);
1108  break;
1109  case kGCTileStipYOrigin:
1110  match = (values->fTsYOrigin == gcv->fTsYOrigin);
1111  break;
1112  case kGCFont:
1113  match = (values->fFont == gcv->fFont);
1114  break;
1115  case kGCSubwindowMode:
1116  match = (values->fSubwindowMode == gcv->fSubwindowMode);
1117  break;
1118  case kGCGraphicsExposures:
1119  match = (values->fGraphicsExposures == gcv->fGraphicsExposures);
1120  break;
1121  case kGCClipXOrigin:
1122  match = (values->fClipXOrigin == gcv->fClipXOrigin);
1123  break;
1124  case kGCClipYOrigin:
1125  match = (values->fClipYOrigin == gcv->fClipYOrigin);
1126  break;
1127  case kGCClipMask:
1128  match = (values->fClipMask == gcv->fClipMask);
1129  break;
1130  case kGCDashOffset:
1131  match = (values->fDashOffset == gcv->fDashOffset);
1132  break;
1133  case kGCDashList:
1134  if (values->fDashLen == gcv->fDashLen)
1135  match = (strncmp(values->fDashes, gcv->fDashes, gcv->fDashLen) == 0);
1136  break;
1137  case kGCArcMode:
1138  match = (values->fArcMode == gcv->fArcMode);
1139  break;
1140  }
1141  if (!match)
1142  return -1;
1143  matching_bits++;
1144  match = kFALSE;
1145  }
1146 
1147  return matching_bits;
1148 }
1149 
1150 ////////////////////////////////////////////////////////////////////////////////
1151 /// Update graphics context with the values spcified in values->fMask.
1152 
1154 {
1155  gc->SetAttributes(values);
1156 }
1157 
1158 ////////////////////////////////////////////////////////////////////////////////
1159 /// List all graphics contexts in the pool.
1160 
1162 {
1163  fList->Print();
1164 }
kGCTileStipXOrigin
const Mask_t kGCTileStipXOrigin
Definition: GuiTypes.h:298
kGCTileStipYOrigin
const Mask_t kGCTileStipYOrigin
Definition: GuiTypes.h:299
TGGCPool::fList
THashTable * fList
Definition: TGGC.h:108
GCValues_t::fJoinStyle
Int_t fJoinStyle
kJoinMiter, kJoinRound, kJoinBevel
Definition: GuiTypes.h:233
kArcPieSlice
@ kArcPieSlice
Definition: GuiTypes.h:54
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
Pixmap_t
Handle_t Pixmap_t
Pixmap handle.
Definition: GuiTypes.h:30
TGGC::Print
void Print(Option_t *option="") const
Print graphics contexts info.
Definition: TGGC.cxx:514
TGGC::GetDashes
const char * GetDashes() const
Definition: TGGC.h:93
TGGCPool::~TGGCPool
virtual ~TGGCPool()
Delete graphics context pool.
Definition: TGGC.cxx:895
TGGC::SetLineStyle
void SetLineStyle(Int_t v)
Set line style (kLineSolid, kLineOnOffDash, kLineDoubleDash).
Definition: TGGC.cxx:311
TGGC::GetTileStipYOrigin
Int_t GetTileStipYOrigin() const
Definition: TGGC.h:80
kGCArcMode
const Mask_t kGCArcMode
Definition: GuiTypes.h:308
TGGCPool::Print
void Print(Option_t *option="") const
List all graphics contexts in the pool.
Definition: TGGC.cxx:1161
TGGC::GetForeground
Pixel_t GetForeground() const
Definition: TGGC.h:73
TRefCnt::SetRefCount
void SetRefCount(UInt_t r)
Definition: TRefCnt.h:39
Option_t
const char Option_t
Definition: RtypesCore.h:66
TRefCnt::References
UInt_t References() const
Definition: TRefCnt.h:38
THashTable::Add
void Add(TObject *obj)
Add object to the hash table.
Definition: THashTable.cxx:92
TGGC::GetSubwindowMode
Int_t GetSubwindowMode() const
Definition: TGGC.h:81
kLineSolid
@ kLineSolid
Definition: GuiTypes.h:48
kGXorReverse
@ kGXorReverse
src OR NOT dst
Definition: GuiTypes.h:79
gVirtualX
#define gVirtualX
Definition: TVirtualX.h:338
TGGC::SetJoinStyle
void SetJoinStyle(Int_t v)
Set line join style (kJoinMiter, kJoinRound, kJoinBevel).
Definition: TGGC.cxx:333
TString::Data
const char * Data() const
Definition: TString.h:369
TGGC::SetClipYOrigin
void SetClipYOrigin(Int_t v)
Y origin for clipping.
Definition: TGGC.cxx:455
TGGC::SetClipXOrigin
void SetClipXOrigin(Int_t v)
X origin for clipping.
Definition: TGGC.cxx:444
GCValues_t::fStipple
Pixmap_t fStipple
stipple 1 plane pixmap for stippling
Definition: GuiTypes.h:239
FontH_t
Handle_t FontH_t
Font handle (as opposed to Font_t which is an index)
Definition: GuiTypes.h:35
kFillStippled
@ kFillStippled
Definition: GuiTypes.h:51
TGGC::SetTileStipXOrigin
void SetTileStipXOrigin(Int_t v)
X offset for tile or stipple operations.
Definition: TGGC.cxx:389
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TGGC::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *option="")
Save graphics context info as a C++ statement(s) on output stream out.
Definition: TGGC.cxx:627
kLineDoubleDash
@ kLineDoubleDash
Definition: GuiTypes.h:48
GCValues_t::fClipXOrigin
Int_t fClipXOrigin
origin for clipping
Definition: GuiTypes.h:245
kGCClipMask
const Mask_t kGCClipMask
Definition: GuiTypes.h:305
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
kGXandInverted
@ kGXandInverted
NOT src AND dst.
Definition: GuiTypes.h:72
TGGC::GetMaskString
TString GetMaskString() const
Returns GC mask as a string - used in SavePrimitive().
Definition: TGGC.cxx:523
TCollection::SetOwner
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
Definition: TCollection.cxx:746
GCValues_t
Graphics context structure.
Definition: GuiTypes.h:224
TGGC::SetFillRule
void SetFillRule(Int_t v)
Set fill rule (kEvenOddRule, kWindingRule).
Definition: TGGC.cxx:356
TGGC::SetFillStyle
void SetFillStyle(Int_t v)
Set fill style (kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled).
Definition: TGGC.cxx:345
TGGC::SetAttributes
void SetAttributes(GCValues_t *values)
Set attributes as specified in the values structure.
Definition: TGGC.cxx:235
kGXequiv
@ kGXequiv
NOT src XOR dst.
Definition: GuiTypes.h:77
GCValues_t::fDashes
Char_t fDashes[8]
dash pattern list (dash length per byte)
Definition: GuiTypes.h:249
TGGC::SetGraphicsExposures
void SetGraphicsExposures(Bool_t v)
True if graphics exposure should be generated.
Definition: TGGC.cxx:433
kFillSolid
@ kFillSolid
Definition: GuiTypes.h:51
GCValues_t::fFillStyle
Int_t fFillStyle
kFillSolid, kFillTiled, kFillStippled, kFillOpaeueStippled
Definition: GuiTypes.h:234
TGGCPool::TGGC
friend class TGGC
Definition: TGGC.h:105
GCValues_t::fTsXOrigin
Int_t fTsXOrigin
offset for tile or stipple operations
Definition: GuiTypes.h:240
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
kGCFillRule
const Mask_t kGCFillRule
Definition: GuiTypes.h:295
TGGC::GetJoinStyle
Int_t GetJoinStyle() const
Definition: TGGC.h:88
TColor.h
TVirtualX.h
TGGC::GetFillRule
Int_t GetFillRule() const
Definition: TGGC.h:90
TColor::PixelAsHexString
static const char * PixelAsHexString(ULong_t pixel)
Convert machine dependent pixel value (obtained via RGB2Pixel or via Number2Pixel() or via TColor::Ge...
Definition: TColor.cxx:2115
TGGC::GetTile
Pixmap_t GetTile() const
Definition: TGGC.h:77
kEvenOddRule
@ kEvenOddRule
Definition: GuiTypes.h:52
TGGC::SetLineWidth
void SetLineWidth(Int_t v)
Set line width.
Definition: TGGC.cxx:300
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2336
GCValues_t::fFillRule
Int_t fFillRule
kEvenOddRule, kWindingRule
Definition: GuiTypes.h:236
TString
Basic string class.
Definition: TString.h:136
kGXor
@ kGXor
src OR dst
Definition: GuiTypes.h:75
TGGC::SetDashOffset
void SetDashOffset(Int_t v)
Patterned/dashed line offset.
Definition: TGGC.cxx:477
TGGC::GetArcMode
Int_t GetArcMode() const
Definition: TGGC.h:94
v
@ v
Definition: rootcling_impl.cxx:3664
kGXnoop
@ kGXnoop
dst
Definition: GuiTypes.h:73
GCValues_t::fPlaneMask
ULong_t fPlaneMask
plane mask
Definition: GuiTypes.h:226
TGGCPool::GetGC
TGGC * GetGC(GCValues_t *values, Bool_t rw=kFALSE)
Get the best matching graphics context depending on values.
Definition: TGGC.cxx:987
kGXorInverted
@ kGXorInverted
NOT src OR dst.
Definition: GuiTypes.h:81
TGGC::GetGraphicsExposures
Bool_t GetGraphicsExposures() const
Definition: TGGC.h:83
bool
kGCLineStyle
const Mask_t kGCLineStyle
Definition: GuiTypes.h:291
TGGCPool::FreeGC
void FreeGC(const TGGC *gc)
Delete graphics context if it is not used anymore.
Definition: TGGC.cxx:918
TGGC::GetClipYOrigin
Int_t GetClipYOrigin() const
Definition: TGGC.h:85
kWindingRule
@ kWindingRule
Definition: GuiTypes.h:52
kGXcopyInverted
@ kGXcopyInverted
NOT src.
Definition: GuiTypes.h:80
GCValues_t::fTsYOrigin
Int_t fTsYOrigin
Definition: GuiTypes.h:241
TROOT.h
GContext_t
Handle_t GContext_t
Graphics context handle.
Definition: GuiTypes.h:38
kGXnand
@ kGXnand
NOT src OR NOT dst.
Definition: GuiTypes.h:82
kGCJoinStyle
const Mask_t kGCJoinStyle
Definition: GuiTypes.h:293
TGGC::operator()
GContext_t operator()() const
Not inline due to a bug in g++ 2.96 20000731 (Red Hat Linux 7.0).
Definition: TGGC.cxx:138
gClient
#define gClient
Definition: TGClient.h:157
TGGC::GetDashLen
Int_t GetDashLen() const
Definition: TGGC.h:92
TRefCnt::AddReference
void AddReference()
Definition: TRefCnt.h:40
TGGC::GetLineStyle
Int_t GetLineStyle() const
Definition: TGGC.h:76
GCValues_t::fSubwindowMode
Int_t fSubwindowMode
kClipByChildren, kIncludeInferiors
Definition: GuiTypes.h:243
TGGC::SetCapStyle
void SetCapStyle(Int_t v)
Set cap style (kCapNotLast, kCapButt, kCapRound, kCapProjecting).
Definition: TGGC.cxx:322
kNone
const Handle_t kNone
Definition: GuiTypes.h:88
TGGC::TGGC
TGGC(GCValues_t *values, Bool_t calledByGCPool)
Create a graphics context (only called via TGGCPool::GetGC()).
Definition: TGGC.cxx:38
TGGC::GetLineWidth
Int_t GetLineWidth() const
Definition: TGGC.h:75
GCValues_t::fArcMode
Int_t fArcMode
kArcChord, kArcPieSlice
Definition: GuiTypes.h:237
TGGC::GetFunction
EGraphicsFunction GetFunction() const
Definition: TGGC.h:71
kLineOnOffDash
@ kLineOnOffDash
Definition: GuiTypes.h:48
kCapProjecting
@ kCapProjecting
Definition: GuiTypes.h:49
kGXinvert
@ kGXinvert
NOT dst.
Definition: GuiTypes.h:78
TGGC::GetClipXOrigin
Int_t GetClipXOrigin() const
Definition: TGGC.h:84
kJoinMiter
@ kJoinMiter
Definition: GuiTypes.h:50
THashTable
THashTable implements a hash table to store TObject's.
Definition: THashTable.h:35
kGCFillStyle
const Mask_t kGCFillStyle
Definition: GuiTypes.h:294
TGGC::SetTileStipYOrigin
void SetTileStipYOrigin(Int_t v)
Y offset for tile or stipple operations.
Definition: TGGC.cxx:400
TGGC
Encapsulate a graphics context used in the low level graphics.
Definition: TGGC.h:22
TGGC::GetDashOffset
Int_t GetDashOffset() const
Definition: TGGC.h:91
TGGC.h
kGXandReverse
@ kGXandReverse
src AND NOT dst
Definition: GuiTypes.h:70
kGCFunction
const Mask_t kGCFunction
Definition: GuiTypes.h:286
THashTable::FindObject
TObject * FindObject(const char *name) const
Find object using its name.
Definition: THashTable.cxx:238
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
GCValues_t::fLineStyle
Int_t fLineStyle
kLineSolid, kLineOnOffDash, kLineDoubleDash
Definition: GuiTypes.h:230
kGCForeground
const Mask_t kGCForeground
Definition: GuiTypes.h:288
Long_t
long Long_t
Definition: RtypesCore.h:54
kGCGraphicsExposures
const Mask_t kGCGraphicsExposures
Definition: GuiTypes.h:302
GCValues_t::fFont
FontH_t fFont
default text font for text operations
Definition: GuiTypes.h:242
kArcChord
@ kArcChord
Definition: GuiTypes.h:54
TGGC::GetStipple
Pixmap_t GetStipple() const
Definition: TGGC.h:78
TGGC::SetClipMask
void SetClipMask(Pixmap_t v)
Bitmap for clipping.
Definition: TGGC.cxx:466
TGGC::SetSubwindowMode
void SetSubwindowMode(Int_t v)
Set sub window mode (kClipByChildren, kIncludeInferiors).
Definition: TGGC.cxx:422
kGCFont
const Mask_t kGCFont
Definition: GuiTypes.h:300
kGCCapStyle
const Mask_t kGCCapStyle
Definition: GuiTypes.h:292
gDebug
Int_t gDebug
Definition: TROOT.cxx:589
GCValues_t::fBackground
ULong_t fBackground
background pixel
Definition: GuiTypes.h:228
kGCLineWidth
const Mask_t kGCLineWidth
Definition: GuiTypes.h:290
GCValues_t::fDashOffset
Int_t fDashOffset
patterned/dashed line information
Definition: GuiTypes.h:248
TGGCPool::UpdateGC
void UpdateGC(TGGC *gc, GCValues_t *values)
Update graphics context with the values spcified in values->fMask.
Definition: TGGC.cxx:1153
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
TGGC::SetDashList
void SetDashList(const char v[], Int_t len)
Set dash pattern. First use SetDashOffset() if not 0.
Definition: TGGC.cxx:488
TGGC::UpdateValues
void UpdateValues(GCValues_t *v)
Update values + mask.
Definition: TGGC.cxx:146
GCValues_t::fGraphicsExposures
Bool_t fGraphicsExposures
boolean, should exposures be generated
Definition: GuiTypes.h:244
TGClient.h
kGCBackground
const Mask_t kGCBackground
Definition: GuiTypes.h:289
TGGCPool::ForceFreeGC
void ForceFreeGC(const TGGC *gc)
Force remove graphics context from list. Is only called via ~TGGC().
Definition: TGGC.cxx:903
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:879
TGGC::GetCapStyle
Int_t GetCapStyle() const
Definition: TGGC.h:87
kGCDashList
const Mask_t kGCDashList
Definition: GuiTypes.h:307
GCValues_t::fClipYOrigin
Int_t fClipYOrigin
Definition: GuiTypes.h:246
TGGC::fContext
GContext_t fContext
graphics context handle
Definition: TGGC.h:28
TMath::Min
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
kGXset
@ kGXset
1
Definition: GuiTypes.h:83
kCapRound
@ kCapRound
Definition: GuiTypes.h:49
unsigned int
GCValues_t::fTile
Pixmap_t fTile
tile pixmap for tiling operations
Definition: GuiTypes.h:238
kGXcopy
@ kGXcopy
src
Definition: GuiTypes.h:71
TGGC::SetPlaneMask
void SetPlaneMask(ULong_t v)
Set plane mask.
Definition: TGGC.cxx:267
Printf
void Printf(const char *fmt,...)
kFillTiled
@ kFillTiled
Definition: GuiTypes.h:51
kJoinRound
@ kJoinRound
Definition: GuiTypes.h:50
THashTable::Remove
TObject * Remove(TObject *obj)
Remove object from the hashtable.
Definition: THashTable.cxx:417
TGGC::fValues
GCValues_t fValues
graphics context values + mask
Definition: TGGC.h:27
TObject::operator=
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Definition: TObject.h:283
TGGC::SetArcMode
void SetArcMode(Int_t v)
Set arc mode (kArcChord, kArcPieSlice).
Definition: TGGC.cxx:503
EGraphicsFunction
EGraphicsFunction
Definition: GuiTypes.h:67
kCapButt
@ kCapButt
Definition: GuiTypes.h:49
TGGC::GetBackground
Pixel_t GetBackground() const
Definition: TGGC.h:74
TRefCnt::RemoveReference
UInt_t RemoveReference()
Definition: TRefCnt.h:41
kGCClipXOrigin
const Mask_t kGCClipXOrigin
Definition: GuiTypes.h:303
kGXclear
@ kGXclear
0
Definition: GuiTypes.h:68
TGGC::GetPlaneMask
ULong_t GetPlaneMask() const
Definition: TGGC.h:72
GCValues_t::fMask
Mask_t fMask
bit mask specifying which fields are valid
Definition: GuiTypes.h:251
TGObject::fClient
TGClient * fClient
Connection to display server.
Definition: TGObject.h:27
kGCClipYOrigin
const Mask_t kGCClipYOrigin
Definition: GuiTypes.h:304
kGCPlaneMask
const Mask_t kGCPlaneMask
Definition: GuiTypes.h:287
TGGCPool
Definition: TGGC.h:103
TGGC::SetBackground
void SetBackground(Pixel_t v)
Set background color.
Definition: TGGC.cxx:289
TGGC::SetForeground
void SetForeground(Pixel_t v)
Set foreground color.
Definition: TGGC.cxx:278
GCValues_t::fClipMask
Pixmap_t fClipMask
bitmap clipping; other calls for rects
Definition: GuiTypes.h:247
GCValues_t::fDashLen
Int_t fDashLen
number of dashes in fDashes
Definition: GuiTypes.h:250
kFillOpaqueStippled
@ kFillOpaqueStippled
Definition: GuiTypes.h:51
TGGC::GetTileStipXOrigin
Int_t GetTileStipXOrigin() const
Definition: TGGC.h:79
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TGGC::GetClipMask
Pixmap_t GetClipMask() const
Definition: TGGC.h:86
TGGC::operator=
TGGC & operator=(const TGGC &rhs)
Graphics context assignment operator.
Definition: TGGC.cxx:115
GCValues_t::fFunction
EGraphicsFunction fFunction
logical operation
Definition: GuiTypes.h:225
GCValues_t::fForeground
ULong_t fForeground
foreground pixel
Definition: GuiTypes.h:227
kGXand
@ kGXand
src AND dst
Definition: GuiTypes.h:69
kJoinBevel
@ kJoinBevel
Definition: GuiTypes.h:50
THashTable::Print
void Print(Option_t *option, Int_t recurse) const
Print the collection header and its elements.
Definition: THashTable.cxx:328
TRefCnt
Definitions for TRefCnt, base class for reference counted objects.
Definition: TRefCnt.h:27
TGGC::GetMask
Mask_t GetMask() const
Definition: TGGC.h:70
TIter
Definition: TCollection.h:233
TGGCPool::FindGC
TGGC * FindGC(const TGGC *gc)
Find graphics context. Returns 0 in case gc is not found.
Definition: TGGC.cxx:951
kIncludeInferiors
@ kIncludeInferiors
Definition: GuiTypes.h:53
Class
void Class()
Definition: Class.C:29
kClipByChildren
@ kClipByChildren
Definition: GuiTypes.h:53
kGXnor
@ kGXnor
NOT src AND NOT dst.
Definition: GuiTypes.h:76
TGGCPool::MatchGC
Int_t MatchGC(const TGGC *gc, GCValues_t *values)
Try to find matching graphics context.
Definition: TGGC.cxx:1039
kGCDashOffset
const Mask_t kGCDashOffset
Definition: GuiTypes.h:306
kGCTile
const Mask_t kGCTile
Definition: GuiTypes.h:296
TGGC::SetFunction
void SetFunction(EGraphicsFunction v)
Set graphics context drawing function.
Definition: TGGC.cxx:256
TGGCPool::TGGCPool
TGGCPool(const TGGCPool &gp)
Definition: TGGC.h:115
TGGC::SetFont
void SetFont(FontH_t v)
Set font.
Definition: TGGC.cxx:411
TGClient
Window client.
Definition: TGClient.h:37
kGCStipple
const Mask_t kGCStipple
Definition: GuiTypes.h:297
TGGC::~TGGC
virtual ~TGGC()
Delete graphics context.
Definition: TGGC.cxx:103
TGGC::SetTile
void SetTile(Pixmap_t v)
Set tile pixmap for tiling operations.
Definition: TGGC.cxx:367
kGXxor
@ kGXxor
src XOR dst
Definition: GuiTypes.h:74
TGGC::GetFillStyle
Int_t GetFillStyle() const
Definition: TGGC.h:89
GCValues_t::fLineWidth
Int_t fLineWidth
line width
Definition: GuiTypes.h:229
gROOT
#define gROOT
Definition: TROOT.h:404
kCapNotLast
@ kCapNotLast
Definition: GuiTypes.h:49
int
GCValues_t::fCapStyle
Int_t fCapStyle
kCapNotLast, kCapButt, kCapRound, kCapProjecting
Definition: GuiTypes.h:231
TGGC::SetStipple
void SetStipple(Pixmap_t v)
Set 1 plane pixmap for stippling.
Definition: TGGC.cxx:378
kGCSubwindowMode
const Mask_t kGCSubwindowMode
Definition: GuiTypes.h:301
THashTable.h
g
#define g(i)
Definition: RSha256.hxx:105