ROOT  6.06/09
Reference Guide
TGQuartz.mm
Go to the documentation of this file.
1 // @(#)root/graf2d:$Id$
2 // Author: Olivier Couet, Timur Pocheptsov 23/01/2012
3 
4 
5 /*************************************************************************
6  * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers. *
7  * All rights reserved. *
8  * *
9  * For the licensing terms see $ROOTSYS/LICENSE. *
10  * For the list of contributors see $ROOTSYS/README/CREDITS. *
11  *************************************************************************/
12 
13 //#define NDEBUG
14 
15 #include <stdexcept>
16 #include <iostream>
17 #include <cstring>
18 #include <cassert>
19 #include <limits>
20 
21 #include <Cocoa/Cocoa.h>
22 
23 # include <ft2build.h>
24 # include FT_FREETYPE_H
25 # include FT_GLYPH_H
26 
27 #include "QuartzFillArea.h"
28 #include "TColorGradient.h"
29 #include "QuartzMarker.h"
30 #include "CocoaPrivate.h"
31 #include "QuartzWindow.h"
32 #include "QuartzPixmap.h"
33 #include "QuartzUtils.h"
34 #include "X11Drawable.h"
35 #include "QuartzText.h"
36 #include "QuartzLine.h"
37 #include "CocoaUtils.h"
38 #include "TGQuartz.h"
39 #include "TString.h"
40 #include "TPoint.h"
41 #include "TColor.h"
42 #include "TStyle.h"
43 #include "TROOT.h"
44 #include "TEnv.h"
45 
46 // To scale fonts to the same size as the TTF version
47 const Float_t kScale = 0.93376068;
48 
50 
51 //TODO:
52 //Originally, Olivier Couet suggested to have a separate module quartz with quartz-related graphics,
53 //to be used by both iOS and MacOSX code. Also, the separation of non-GUI and gui parts was suggested
54 //that's why we have TGQuartz and TGCocoa classes (TGCocoa is never used as it is, TGQuartz is
55 //created and initialzed by TROOT.
56 //Today it's clear that there is not need in any special quartz classes anymore -
57 //in my iOS applications/module I do not need anything from quartz module, also, the
58 //amount of code in quartz module is so small, that it can be merged back into cocoa module.
59 
60 //At some point, I'll merge cocoa and quartz modules and cleanup all this
61 //mess and weird code we have in a quartz module.
62 
63 
64 namespace X11 = ROOT::MacOSX::X11;
65 namespace Quartz = ROOT::Quartz;
66 namespace Util = ROOT::MacOSX::Util;
67 
68 namespace {
69 
70 //______________________________________________________________________________
71 void ConvertPointsROOTToCocoa(Int_t nPoints, const TPoint *xy, std::vector<TPoint> &dst,
72  NSObject<X11Drawable> *drawable)
73 {
74  assert(nPoints != 0 && "ConvertPointsROOTToCocoa, nPoints parameter is 0");
75  assert(xy != 0 && "ConvertPointsROOTToCocoa, xy parameter is null");
76  assert(drawable != 0 && "ConvertPointsROOTToCocoa, drawable parameter is null");
77 
78  dst.resize(nPoints);
79  for (Int_t i = 0; i < nPoints; ++i) {
80  dst[i].fX = xy[i].fX;
81  dst[i].fY = SCoord_t(X11::LocalYROOTToCocoa(drawable, xy[i].fY));
82  }
83 }
84 
85 }
86 
87 //______________________________________________________________________________
89  : fUseAA(true)
90 {
91  //Default ctor.
92 
93 
94  if (!TTF::IsInitialized())
95  TTF::Init();
96 
97  //I do not know why TTF::Init returns void and I have to check IsInitialized() again.
98  if (!TTF::IsInitialized())
99  Error("TGQuartz", "TTF::Init() failed");
100 
101  fAlign.x = 0;
102  fAlign.y = 0;
103 
104  SetAA();
105 }
106 
107 
108 //______________________________________________________________________________
109 TGQuartz::TGQuartz(const char *name, const char *title)
110  : TGCocoa(name, title),
111  fUseAA(true)
112 {
113  //Constructor.
114  if (!TTF::IsInitialized())
115  TTF::Init();
116 
117  //I do not know why TTF::Init returns void and I have to check IsInitialized() again.
118  if (!TTF::IsInitialized())
119  Error("TGQuartz", "TTF::Init() failed");
120 
121  fAlign.x = 0;
122  fAlign.y = 0;
123 
124  SetAA();
125 }
126 
127 
128 //______________________________________________________________________________
130 {
131  //Check some conditions first.
132  if (fDirectDraw) {
133  if (!fPimpl->GetDrawable(fSelectedDrawable).fIsPixmap)
134  fPimpl->fX11CommandBuffer.AddDrawBoxXor(fSelectedDrawable, x1, y1, x2, y2);
135  return;
136  }
137 
138  NSObject<X11Drawable> * const drawable = (NSObject<X11Drawable> *)GetSelectedDrawableChecked("DrawBox");
139  if (!drawable)
140  return;
141 
142  CGContextRef ctx = drawable.fContext;
143  const Quartz::CGStateGuard ctxGuard(ctx);
144  //AA flag is not a part of a state.
145  const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseAA);
146 
147  //Go to low-left-corner system.
148  y1 = Int_t(X11::LocalYROOTToCocoa(drawable, y1));
149  y2 = Int_t(X11::LocalYROOTToCocoa(drawable, y2));
150 
151  if (const TColorGradient * const gradient = dynamic_cast<TColorGradient *>(gROOT->GetColor(GetFillColor()))) {
152  //Draw a box with a gradient fill and a shadow.
153  //Ignore all fill styles and EBoxMode, use a gradient fill.
154  TPoint polygon[4];
155  polygon[0].fX = x1, polygon[0].fY = y1;
156  polygon[1].fX = x2, polygon[1].fY = y1;
157  polygon[2].fX = x2, polygon[2].fY = y2;
158  polygon[3].fX = x1, polygon[3].fY = y2;
159 
160  Quartz::DrawPolygonWithGradientFill(ctx, gradient, CGSizeMake(drawable.fWidth, drawable.fHeight),
161  4, polygon, kFALSE); //kFALSE == don't draw a shadow.
162  } else {
163  const bool isHollow = mode == kHollow || GetFillStyle() / 1000 == 2;
164 
165  //Note! Pattern index (and its address) MUST live
166  //long enough to be valid at the point of Quartz::DrawBox call!
167  unsigned patternIndex = 0;
168  if (isHollow) {
169  if (!Quartz::SetLineColor(ctx, GetLineColor())) {
170  Error("DrawBox", "Can not find color for index %d", int(GetLineColor()));
171  return;
172  }
173  } else {
174  if (!Quartz::SetFillAreaParameters(ctx, &patternIndex)) {
175  Error("DrawBox", "SetFillAreaParameters failed");
176  return;
177  }
178  }
181  Quartz::DrawBox(ctx, x1, y1, x2, y2, isHollow);
182  }
183 }
184 
185 
186 //______________________________________________________________________________
188 {
189  //Comment from TVirtualX:
190 
191  // Draw a filled area through all points.
192  // n : number of points
193  // xy : array of points
194 
195  //End of comment.
196  if (n < 3)
197  return;
198 
199  //Do some checks first.
200  if (fDirectDraw)//To avoid warnings from Quartz - no context at the moment!
201  return;
202 
203  NSObject<X11Drawable> * const drawable =
204  (NSObject<X11Drawable> *)GetSelectedDrawableChecked("DrawFillArea");
205 
206  if (!drawable)
207  return;
208 
209  CGContextRef ctx = drawable.fContext;
210 
211  //Convert points to bottom-left system:
212  ConvertPointsROOTToCocoa(n, xy, fConvertedPoints, drawable);
213 
214  const Quartz::CGStateGuard ctxGuard(ctx);
215  //AA flag is not a part of a state.
216  const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseAA);
217 
218  const TColor * const fillColor = gROOT->GetColor(GetFillColor());
219  if (!fillColor) {
220  Error("DrawFillArea", "Could not find TColor for index %d", GetFillColor());
221  return;
222  }
223 
224  if (const TColorGradient * const gradient = dynamic_cast<const TColorGradient *>(fillColor)) {
225  Quartz::DrawPolygonWithGradientFill(ctx, gradient, CGSizeMake(drawable.fWidth, drawable.fHeight),
226  n, &fConvertedPoints[0], kFALSE);//kFALSE == don't draw a shadow.
227  } else {
228  unsigned patternIndex = 0;
229  if (!Quartz::SetFillAreaParameters(ctx, &patternIndex)) {
230  Error("DrawFillArea", "SetFillAreaParameters failed");
231  return;
232  }
233 
234  Quartz::DrawFillArea(ctx, n, &fConvertedPoints[0], kFALSE);//The last argument - do not draw shadows.
235  }
236 }
237 
238 
239 //______________________________________________________________________________
240 void TGQuartz::DrawCellArray(Int_t /*x1*/, Int_t /*y1*/, Int_t /*x2*/, Int_t /*y2*/,
241  Int_t /*nx*/, Int_t /*ny*/, Int_t */*ic*/)
242 {
243  //Noop.
244 }
245 
246 
247 //______________________________________________________________________________
249 {
250  // Draw a line.
251  // x1,y1 : begin of line
252  // x2,y2 : end of line
253 
254  if (fDirectDraw) {
255  if (!fPimpl->GetDrawable(fSelectedDrawable).fIsPixmap)
256  fPimpl->fX11CommandBuffer.AddDrawLineXor(fSelectedDrawable, x1, y1, x2, y2);
257  return;
258  }
259 
260  //Do some checks first:
261  assert(fSelectedDrawable > fPimpl->GetRootWindowID() && "DrawLine, bad drawable is selected");
262  NSObject<X11Drawable> * const drawable =
263  (NSObject<X11Drawable> *)GetSelectedDrawableChecked("DrawLine");
264  if (!drawable)
265  return;
266 
267  CGContextRef ctx = drawable.fContext;
268  const Quartz::CGStateGuard ctxGuard(ctx);
269  //AA flag is not a part of a state.
270  const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseAA);
271 
272  if (!Quartz::SetLineColor(ctx, GetLineColor())) {
273  Error("DrawLine", "Could not set line color for index %d", int(GetLineColor()));
274  return;
275  }
276 
279 
280  Quartz::DrawLine(ctx, x1, X11::LocalYROOTToCocoa(drawable, y1), x2,
281  X11::LocalYROOTToCocoa(drawable, y2));
282 }
283 
284 
285 //______________________________________________________________________________
287 {
288  //Comment from TVirtualX:
289  // Draw a line through all points.
290  // n : number of points
291  // xy : list of points
292  //End of comment.
293 
294  //Some checks first.
295  if (fDirectDraw)//To avoid warnings from Quartz - no context at the moment!
296  return;
297 
298  NSObject<X11Drawable> * const drawable =
299  (NSObject<X11Drawable> *)GetSelectedDrawableChecked("DrawPolyLine");
300  if (!drawable)
301  return;
302 
303  CGContextRef ctx = drawable.fContext;
304  const Quartz::CGStateGuard ctxGuard(ctx);
305  //AA flag is not a part of a state.
306  const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseAA);
307 
308  if (!Quartz::SetLineColor(ctx, GetLineColor())) {
309  Error("DrawPolyLine", "Could not find TColor for index %d", GetLineColor());
310  return;
311  }
312 
315 
316  //Convert to bottom-left-corner system.
317  ConvertPointsROOTToCocoa(n, xy, fConvertedPoints, drawable);
318 
320 }
321 
322 
323 //______________________________________________________________________________
325 {
326  //Comment from TVirtualX:
327  // Draw PolyMarker
328  // n : number of points
329  // xy : list of points
330  //End of comment.
331 
332  //Do some checks first.
333  if (fDirectDraw)//To avoid warnings from Quartz - no context at the moment!
334  return;
335 
336  NSObject<X11Drawable> * const drawable =
337  (NSObject<X11Drawable> *)GetSelectedDrawableChecked("DrawPolyMarker");
338  if (!drawable)
339  return;
340 
341  CGContextRef ctx = drawable.fContext;
342  const Quartz::CGStateGuard ctxGuard(ctx);
343  //AA flag is not a part of a state.
344  const Quartz::CGAAStateGuard aaCtxGuard(ctx, fUseAA);
345 
346  if (!Quartz::SetFillColor(ctx, GetMarkerColor())) {
347  Error("DrawPolyMarker", "Could not find TColor for index %d", GetMarkerColor());
348  return;
349  }
350 
351  Quartz::SetLineColor(ctx, GetMarkerColor());//Can not fail (for coverity).
352  Quartz::SetLineStyle(ctx, 1);
353  Quartz::SetLineWidth(ctx, 1);
354 
355  ConvertPointsROOTToCocoa(n, xy, fConvertedPoints, drawable);
356 
358 }
359 
360 
361 //______________________________________________________________________________
362 void TGQuartz::DrawText(Int_t x, Int_t y, Float_t /*angle*/, Float_t /*mgn*/,
363  const char *text, ETextMode /*mode*/)
364 {
365  if (fDirectDraw)//To avoid warnings from Quartz - no context at the moment!
366  return;
367 
368  if (!text || !text[0])//Can this ever happen? TPad::PaintText does not check this.
369  return;
370 
371  if (!GetTextSize())//Do not draw anything, or CoreText will create some small (but not of size 0 font).
372  return;
373 
374  NSObject<X11Drawable> * const drawable =
375  (NSObject<X11Drawable> *)GetSelectedDrawableChecked("DrawText");
376  if (!drawable)
377  return;
378 
379  CGContextRef ctx = drawable.fContext;
380  const Quartz::CGStateGuard ctxGuard(ctx);
381 
382  //Before any core text drawing operations, reset text matrix.
383  CGContextSetTextMatrix(ctx, CGAffineTransformIdentity);
384 
385  try {
386  if (CTFontRef currentFont = fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize())) {
387  const unsigned fontIndex = GetTextFont() / 10;
388  if (fontIndex == 12 || fontIndex == 15) {//Greek and math symbols.
389  //This is a hack. Correct way is to extract glyphs from symbol.ttf,
390  //find correct mapping, place this glyphs. This requires manual layout though (?),
391  //and as usually, I have to many things to do, may be, one day I'll fix text rendering also.
392  //This hack work only on MacOSX 10.7.3, does not work on iOS and I'm not sure about future/previous
393  //versions of MacOSX.
394  typedef std::vector<UniChar>::size_type size_type;
395 
396  std::vector<UniChar> unichars(std::strlen(text));
397  for (size_type i = 0, len = unichars.size(); i < len; ++i)
398  unichars[i] = 0xF000 + (unsigned char)text[i];
399 
400  Quartz::TextLine ctLine(unichars, currentFont, GetTextColor());
401  ctLine.DrawLine(ctx, x, X11::LocalYROOTToCocoa(drawable, y));
402  } else {
403  const Quartz::TextLine ctLine(text, currentFont, GetTextColor());
404  ctLine.DrawLine(ctx, x, X11::LocalYROOTToCocoa(drawable, y));
405  }
406  }
407  } catch (const std::exception &e) {
408  Error("DrawText", "Exception from Quartz::TextLine: %s", e.what());
409  }
410 }
411 
412 //______________________________________________________________________________
413 void TGQuartz::DrawText(Int_t x, Int_t y, Float_t angle, Float_t /*mgn*/, const wchar_t *text, ETextMode mode)
414 {
415  if (!text || !text[0])
416  return;
417 
418  if (!TTF::IsInitialized()) {
419  Error("DrawText", "wchar_t string to draw, but TTF initialization failed");
420  return;
421  }
422 
423  if (!GetTextSize())//Do not draw anything, or CoreText will create some small (but not of size 0 font).
424  return;
425 
426  (void)x;
427  (void)y;
428  (void)angle;
429  (void)mode;
430 
432  TTF::SetRotationMatrix(angle);
433  TTF::PrepareString(text);
435 
436  AlignTTFString();
437  RenderTTFString(x, y, mode);
438 }
439 
440 //______________________________________________________________________________
442 {
443  // Returns the size of the specified character string "mess".
444  //
445  // w - the text width
446  // h - the text height
447  // text - the string
448 
449  if (!text || !text[0]) {
450  w = 0;
451  h = 0;
452  return;
453  }
454 
455  if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize())) {
456  const unsigned fontIndex = GetTextFont() / 10;
457  if (fontIndex == 12 || fontIndex == 15) {//Greek and math symbols.
458  typedef std::vector<UniChar>::size_type size_type;
459 
460  std::vector<UniChar> unichars(std::strlen(text));
461  for (size_type i = 0, len = unichars.size(); i < len; ++i)
462  unichars[i] = 0xF000 + (unsigned char)text[i];
463 
464  fPimpl->fFontManager.GetTextBounds(w, h, unichars);
465  } else {
466  fPimpl->fFontManager.GetTextBounds(w, h, text);
467  }
468  }
469 }
470 
471 //______________________________________________________________________________
473 {
474  // Returns the ascent of the current font (in pixels).
475  // The ascent of a font is the distance from the baseline
476  // to the highest position characters extend to.
477  if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize()))
478  return Int_t(fPimpl->fFontManager.GetAscent());
479 
480  return 0;
481 }
482 
483 //______________________________________________________________________________
485 {
486  // Returns the ascent of the current font (in pixels).
487  // The ascent of a font is the distance from the baseline
488  // to the highest position characters extend to.
489 
490  //In case of any problem we can always resort to the old version:
491  if (!text || !text[0])//How it's usually tested in ROOT
492  return GetFontAscent();
493 
494  if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize())) {
495  const unsigned fontIndex = GetTextFont() / 10;
496  if (fontIndex == 12 || fontIndex == 15) {//Greek and math symbols.
497  //That's an ugly hack :)
498  typedef std::vector<UniChar>::size_type size_type;
499 
500  std::vector<UniChar> unichars(std::strlen(text));
501  for (size_type i = 0, len = unichars.size(); i < len; ++i)
502  unichars[i] = 0xF000 + (unsigned char)text[i];
503 
504  return Int_t(fPimpl->fFontManager.GetAscent(unichars));
505  } else
506  return Int_t(fPimpl->fFontManager.GetAscent(text));
507  }
508 
509  return 0;
510 }
511 
512 //______________________________________________________________________________
514 {
515  // Returns the descent of the current font (in pixels.
516  // The descent is the distance from the base line
517  // to the lowest point characters extend to.
518  if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize()))
519  return Int_t(fPimpl->fFontManager.GetDescent());
520 
521  return 0;
522 }
523 
524 //______________________________________________________________________________
526 {
527  // Returns the descent of the current font (in pixels.
528  // The descent is the distance from the base line
529  // to the lowest point characters extend to.
530 
531  //That's how it's tested in ROOT:
532  if (!text || !text[0])
533  return GetFontDescent();
534 
535  if (fPimpl->fFontManager.SelectFont(GetTextFont(), kScale*GetTextSize())) {
536  const unsigned fontIndex = GetTextFont() / 10;
537  if (fontIndex == 12 || fontIndex == 15) {//Greek and math symbols.
538  //That's an ugly hack :)
539  typedef std::vector<UniChar>::size_type size_type;
540 
541  std::vector<UniChar> unichars(std::strlen(text));
542  for (size_type i = 0, len = unichars.size(); i < len; ++i)
543  unichars[i] = 0xF000 + (unsigned char)text[i];
544 
545  return Int_t(fPimpl->fFontManager.GetDescent(unichars));
546  } else
547  return Int_t(fPimpl->fFontManager.GetDescent(text));
548  }
549 
550  return 0;
551 }
552 
553 
554 //______________________________________________________________________________
556 {
557  // Returns the current font magnification factor
558  return 0;
559 }
560 
561 //______________________________________________________________________________
563 {
564  // Set color index "cindex" for drawing lines.
565  TAttLine::SetLineColor(cindex);
566 }
567 
568 
569 //______________________________________________________________________________
571 {
572  // Set line style.
573  TAttLine::SetLineStyle(lstyle);
574 }
575 
576 
577 //______________________________________________________________________________
579 {
580  // Set the line width.
581 
582  TAttLine::SetLineWidth(width);
583 }
584 
585 
586 //______________________________________________________________________________
588 {
589  // Set color index "cindex" for fill areas.
590 
591  TAttFill::SetFillColor(cindex);
592 }
593 
594 
595 //______________________________________________________________________________
597 {
598  // Set fill area style.
599  TAttFill::SetFillStyle(style);
600 }
601 
602 
603 //______________________________________________________________________________
605 {
606  // Set color index "cindex" for markers.
608 }
609 
610 
611 //______________________________________________________________________________
613 {
614  // Set marker size index.
615  //
616  // markersize - the marker scale factor
617  TAttMarker::SetMarkerSize(markersize);
618 }
619 
620 
621 //______________________________________________________________________________
623 {
624  // Set marker style.
625 
626  TAttMarker::SetMarkerStyle(markerstyle);
627 }
628 
629 
630 //______________________________________________________________________________
632 {
633  // Set the text alignment.
634  //
635  // talign = txalh horizontal text alignment
636  // talign = txalv vertical text alignment
637 
638  TAttText::SetTextAlign(talign);
639 }
640 
641 //______________________________________________________________________________
643 {
644  // Set the color index "cindex" for text.
645 
646  TAttText::SetTextColor(cindex);
647 }
648 
649 
650 //______________________________________________________________________________
652 {
653  // Set the current text font number.
654 
655  TAttText::SetTextFont(fontNumber);
656 
657  if (!TTF::IsInitialized()) {
658  Error("SetTextFont", "TTF is not initialized");
659  return;
660  }
661 
662  TTF::SetTextFont(fontNumber);
663 }
664 
665 //______________________________________________________________________________
666 Int_t TGQuartz::SetTextFont(char *fontName, ETextSetMode /*mode*/)
667 {
668  //This function is never used in gPad (in normal text rendering,
669  //so I'm not setting anything for CoreText).
670  if (!TTF::IsInitialized()) {
671  Error("SetTextFont", "TTF is not initialized");
672  return 0;
673  }
674 
675  return TTF::SetTextFont(fontName);
676 }
677 
678 //______________________________________________________________________________
680 {
681  // Set the current text size to "textsize"
682 
683  TAttText::SetTextSize(textsize);
684 
685  if (!TTF::IsInitialized()) {
686  Error("SetTextSize", "TTF is not initialized");
687  return;
688  }
689 
690  TTF::SetTextSize(textsize);
691 }
692 
693 
694 //______________________________________________________________________________
695 void TGQuartz::SetOpacity(Int_t /*percent*/)
696 {
697  // Set opacity of the current window. This image manipulation routine
698  // works by adding to a percent amount of neutral to each pixels RGB.
699  // Since it requires quite some additional color map entries is it
700  // only supported on displays with more than > 8 color planes (> 256
701  // colors).
702 }
703 
704 //TTF related part.
705 
706 //______________________________________________________________________________
708 {
709  //Comment from TGX11TTF:
710  // Compute alignment variables. The alignment is done on the horizontal string
711  // then the rotation is applied on the alignment variables.
712  // SetRotation and LayoutGlyphs should have been called before.
713  //End of comment.
714 
715  //This code is from TGX11TTF (with my fixes).
716  //It looks like align can not be both X and Y aling?
717 
718  const EAlign align = EAlign(fTextAlign);
719 
720  // vertical alignment
721  if (align == kTLeft || align == kTCenter || align == kTRight) {
722  fAlign.y = TTF::GetAscent();
723  } else if (align == kMLeft || align == kMCenter || align == kMRight) {
724  fAlign.y = TTF::GetAscent() / 2;
725  } else {
726  fAlign.y = 0;
727  }
728 
729  // horizontal alignment
730  if (align == kTRight || align == kMRight || align == kBRight) {
731  fAlign.x = TTF::GetWidth();
732  } else if (align == kTCenter || align == kMCenter || align == kBCenter) {
733  fAlign.x = TTF::GetWidth() / 2;
734  } else {
735  fAlign.x = 0;
736  }
737 
738  FT_Vector_Transform(&fAlign, TTF::GetRotMatrix());
739  //This shift is from the original code.
740  fAlign.x = fAlign.x >> 6;
741  fAlign.y = fAlign.y >> 6;
742 }
743 
744 //______________________________________________________________________________
746 {
747  //Comment from TGX11TTF:
748  // Test if there is really something to render.
749  //End of comment.
750 
751  //This code is from TGX11TTF (with modifications).
752 
753  //Comment from TGX11TTF:
754  // If w or h is 0, very likely the string is only blank characters
755  if (!w || !h)
756  return kFALSE;
757 
758  UInt_t width = 0;
759  UInt_t height = 0;
760  Int_t xy = 0;
761 
762  GetWindowSize(GetCurrentWindow(), xy, xy, width, height);
763 
764  // If string falls outside window, there is probably no need to draw it.
765  if (x + int(w) <= 0 || x >= int(width))
766  return kFALSE;
767 
768  if (y + int(h) <= 0 || y >= int(height))
769  return kFALSE;
770 
771  return kTRUE;
772 }
773 
774 //______________________________________________________________________________
776 {
777  //Comment from TGX11TTF:
778  // Perform the string rendering in the pad.
779  // LayoutGlyphs should have been called before.
780  //End of comment.
781 
782  //This code is a modified (for Quartz) version of TG11TTF::RenderString.
783 
784  NSObject<X11Drawable> * const drawable = (NSObject<X11Drawable> *)GetSelectedDrawableChecked("DrawText");
785  if (!drawable)
786  return;
787 
788  QuartzPixmap *dstPixmap = nil;
789  if ([drawable isKindOfClass : [QuartzPixmap class]])
790  dstPixmap = (QuartzPixmap *)drawable;
791  else if ([drawable isKindOfClass : [QuartzView class]] || [drawable isKindOfClass : [QuartzWindow class]])
792  dstPixmap = ((NSObject<X11Window> *)drawable).fBackBuffer;
793 
794  if (!dstPixmap) {
795  //I can not read pixels from a window (I can, but this is too slow and unreliable).
796  Error("DrawText", "fSelectedDrawable is neither QuartzPixmap nor a double buffered window");
797  return;
798  }
799 
800  //Comment from TGX11TTF:
801  // compute the size and position of the XImage that will contain the text
802  const Int_t xOff = TTF::GetBox().xMin < 0 ? -TTF::GetBox().xMin : 0;
803  const Int_t yOff = TTF::GetBox().yMin < 0 ? -TTF::GetBox().yMin : 0;
804 
805  const Int_t w = TTF::GetBox().xMax + xOff;
806  const Int_t h = TTF::GetBox().yMax + yOff;
807 
808  const Int_t x1 = x - xOff - fAlign.x;
809  const Int_t y1 = y + yOff + fAlign.y - h;
810 
811  if (!IsTTFStringVisible(x1, y1, w, h))
812  return;
813 
814  //By default, all pixels are set to 0 (all components, that's what code in TGX11TTF also does here).
815  Util::NSScopeGuard<QuartzPixmap> pixmap([[QuartzPixmap alloc] initWithW : w H : h scaleFactor : 1.f]);
816  if (!pixmap.Get()) {
817  Error("DrawText", "pixmap creation failed");
818  return;
819  }
820 
821  const unsigned char defaultBackgroundPixel[] = {255, 255, 255, 255};
822  Util::ScopedArray<unsigned char> arrayGuard;
823  if (mode == kClear) {
824  //For this mode, TGX11TTF does some work to: a) preserve pixels under symbols
825  //b) calculate (interpolate) pixel for glyphs.
826 
827  X11::Rectangle bbox(x1, y1, w, h);
828  //We already check IsVisible, so, in principle, bbox at least has intersection with
829  //the current selected drawable.
830  if (X11::AdjustCropArea(dstPixmap, bbox))
831  arrayGuard.Reset([dstPixmap readColorBits : bbox]);
832 
833  if (!arrayGuard.Get()) {
834  Error("DrawText", "problem with reading background pixels");
835  return;
836  }
837 
838  //TODO: this is copy & paste from TGX11TTF, needs more checks (indices).
839  const Int_t xo = x1 < 0 ? -x1 : 0;
840  const Int_t yo = y1 < 0 ? -y1 : 0;
841 
842  for (int yp = 0; yp < int(bbox.fHeight) && yo + yp < h; ++yp) {
843  const unsigned char *srcBase = arrayGuard.Get() + bbox.fWidth * yp * 4;
844  for (int xp = 0; xp < int(bbox.fWidth) && xo + xp < w; ++xp) {
845  const unsigned char * const pixel = srcBase + xp * 4;
846  [pixmap.Get() putPixel : pixel X : xo + xp Y : yo + yp];
847  }
848  }
849  } else {
850  //Find background color and set for all pixels.
851  [pixmap.Get() addPixel : defaultBackgroundPixel];
852  }
853 
854  CGContextRef ctx = drawable.fContext;
855  const Quartz::CGStateGuard ctxGuard(ctx);
856 
857  CGContextSetRGBStrokeColor(ctx, 0., 0., 1., 1.);
858  // paint the glyphs in the pixmap.
859  TTF::TTGlyph *glyph = TTF::GetGlyphs();
860  for (int n = 0; n < TTF::GetNumGlyphs(); ++n, ++glyph) {
861  if (FT_Glyph_To_Bitmap(&glyph->fImage, TTF::GetSmoothing() ? ft_render_mode_normal : ft_render_mode_mono, 0, 1 ))
862  continue;
863 
864  FT_BitmapGlyph bitmap = (FT_BitmapGlyph)glyph->fImage;
865  FT_Bitmap *source = &bitmap->bitmap;
866  const Int_t bx = bitmap->left + xOff;
867  const Int_t by = h - bitmap->top - yOff;
868 
869  DrawFTGlyphIntoPixmap(pixmap.Get(), source, TGCocoa::GetPixel(GetTextColor()),
870  mode == kClear ? ULong_t(-1) : 0xffffff, bx, by);
871  }
872 
873  const X11::Rectangle copyArea(0, 0, w, h);
874  const X11::Point dstPoint(x1, y1);
875  [dstPixmap copy : pixmap.Get() area : copyArea withMask : nil clipOrigin : X11::Point() toPoint : dstPoint];
876 }
877 
878 //______________________________________________________________________________
879 void TGQuartz::DrawFTGlyphIntoPixmap(void *pHack, FT_Bitmap *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by)
880 {
881  //This function is a "remake" of TGX11FFT::DrawImage.
882 
883  //I'm using this code to reproduce the same text as generated by TGX11TTF.
884  //It's quite sloppy, as in original version. I tried to make it not so ugly and
885  //more or less readable.
886 
887  QuartzPixmap *pixmap = (QuartzPixmap *)pHack;
888  assert(pixmap != nil && "DrawFTGlyphIntoPixmap, pixmap parameter is nil");
889  assert(source != 0 && "DrawFTGlyphIntoPixmap, source parameter is null");
890 
891  if (TTF::GetSmoothing()) {
892  static ColorStruct_t col[5];
893  // background kClear, i.e. transparent, we take as background color
894  // the average of the rgb values of all pixels covered by this character
895  if (back == ULong_t(-1) && source->width) {
896  const int maxDots = 50000;
897  int dots = Int_t(source->width * source->rows);
898  if (dots > maxDots)
899  dots = maxDots;
900 
901  //In original code, they first have to extract
902  //pixels and call XQueryColors.
903  //I have only one loop here.
904  ULong_t r = 0, g = 0, b = 0;
905  for (int y = 0, dotCnt = 0; y < int(source->rows); y++) {
906  for (int x = 0; x < int(source->width); x++) {
907  if (x + bx < int(pixmap.fWidth) && y + by < int(pixmap.fHeight)) {
908  const unsigned char * const pixels = pixmap.fData + (y + by) * pixmap.fWidth * 4 + (x + bx) * 4;
909  r += UShort_t(pixels[0] / 255. * 0xffff);
910  g += UShort_t(pixels[1] / 255. * 0xffff);
911  b += UShort_t(pixels[2] / 255. * 0xffff);
912  }
913 
914  if (++dotCnt >= maxDots)
915  break;
916  }
917  }
918 
919  if (dots) {
920  r /= dots;
921  g /= dots;
922  b /= dots;
923  }
924 
925  if (col[0].fRed == r && col[0].fGreen == g && col[0].fBlue == b) {
926  col[0].fPixel = back;
927  } else {
928  col[0].fPixel = ~back;//???
929  col[0].fRed = (UShort_t) r;
930  col[0].fGreen = (UShort_t) g;
931  col[0].fBlue = (UShort_t) b;
932  }
933  }
934 
935  // if fore or background have changed from previous character
936  // recalculate the 3 smooting colors (interpolation between fore-
937  // and background colors)
938  if (fore != col[4].fPixel || back != col[0].fPixel) {
939  col[4].fPixel = fore;
940  TGCocoa::QueryColor(kNone, col[4]);//calculate fRed/fGreen/fBlue triple from fPixel.
941  if (back != (ULong_t)-1) {
942  col[0].fPixel = back;
943  TGCocoa::QueryColor(kNone, col[0]);
944  }
945 
946  // interpolate between fore and backgound colors
947  for (int x = 3; x > 0; --x) {
948  col[x].fRed = (col[4].fRed * x + col[0].fRed * (4 - x)) / 4;
949  col[x].fGreen = (col[4].fGreen * x + col[0].fGreen * (4 - x)) / 4;
950  col[x].fBlue = (col[4].fBlue * x + col[0].fBlue * (4 - x)) / 4;
951  TGCocoa::AllocColor(kNone, col[x]);//Calculate fPixel from fRed/fGreen/fBlue triplet.
952  }
953  }
954 
955  // put smoothed character, character pixmap values are an index
956  // into the 5 colors used for aliasing (4 = foreground, 0 = background)
957  const unsigned char *s = source->buffer;
958  for (int y = 0; y < (int) source->rows; ++y) {
959  for (int x = 0; x < (int) source->width; ++x) {
960  unsigned char d = *s++ & 0xff;//???
961  d = ((d + 10) * 5) / 256;//???
962  if (d > 4)
963  d = 4;
964  if (d && x < (int) source->width) {
965  const UChar_t pixel[] = {UChar_t(double(col[d].fRed) / 0xffff * 255),
966  UChar_t(double(col[d].fGreen) / 0xffff * 255),
967  UChar_t(double(col[d].fBlue) / 0xffff * 255), 255};
968  [pixmap putPixel : pixel X : bx + x Y : by + y];
969  }
970  }
971  }
972  } else {
973  // no smoothing, just put character using foreground color
974  unsigned char rgba[4] = {};
975  rgba[3] = 255;
976  X11::PixelToRGB(fore, rgba);
977  unsigned char d = 0;
978 
979  const unsigned char *row = source->buffer;
980  for (int y = 0; y < int(source->rows); ++y) {
981  int n = 0;
982  const unsigned char *s = row;
983  for (int x = 0; x < int(source->width); ++x) {
984  if (!n)
985  d = *s++;
986 
987  if (TESTBIT(d,7 - n))
988  [pixmap putPixel : rgba X : bx + x Y : by + y];
989 
990  if (++n == int(kBitsPerByte))
991  n = 0;
992  }
993 
994  row += source->pitch;
995  }
996  }
997 }
998 
999 //Aux. functions.
1000 
1001 //______________________________________________________________________________
1003 {
1004  if (gEnv) {
1005  const TString value(TString(gEnv->GetValue("Cocoa.EnableAntiAliasing", "auto")).Strip());
1006  if (value == "auto") {
1007  //TODO: what about multi-head setup?
1008  [[NSScreen mainScreen] backingScaleFactor] > 1. ? fUseAA = true : fUseAA = false;
1009  } else if (value == "no")
1010  fUseAA = false;
1011  else {
1012  assert(value == "yes" && "SetAA, value must be 'yes', 'no' or 'auto'");
1013  fUseAA = true;
1014  }
1015  }
1016 }
1017 
1018 //______________________________________________________________________________
1019 void *TGQuartz::GetSelectedDrawableChecked(const char *calledFrom) const
1020 {
1021  assert(calledFrom != 0 && "GetSelectedDrawableChecked, calledFrom parameter is null");
1022  assert(fSelectedDrawable > fPimpl->GetRootWindowID() && "GetSelectedDrawableChecked, bad drawable is selected");
1023 
1024  NSObject<X11Drawable> *drawable = fPimpl->GetDrawable(fSelectedDrawable);
1025  if (!drawable.fIsPixmap) {
1026  //TPad/TCanvas ALWAYS draw only into a pixmap.
1027  if ([drawable isKindOfClass : [QuartzView class]]) {
1028  QuartzView *view = (QuartzView *)drawable;
1029  if (!view.fBackBuffer) {
1030  Error(calledFrom, "Selected window is not double buffered");
1031  return 0;
1032  }
1033 
1034  drawable = view.fBackBuffer;
1035  } else {
1036  Error(calledFrom, "Selected drawable is neither a pixmap, nor a double buffered window");
1037  return 0;
1038  }
1039  }
1040 
1041  if (!drawable.fContext) {
1042  Error(calledFrom, "Context is null");
1043  return 0;
1044  }
1045 
1046  return drawable;
1047 }
UShort_t fBlue
Definition: GuiTypes.h:315
virtual Style_t GetLineStyle() const
Definition: TAttLine.h:48
virtual Style_t GetFillStyle() const
Definition: TAttFill.h:44
virtual void SetLineWidth(Width_t lwidth)
Definition: TAttLine.h:57
static void Init()
Initialise the TrueType fonts interface.
Definition: TTF.cxx:67
void DrawLine(CGContextRef ctx) const
Definition: QuartzText.mm:278
ClassImp(TGQuartz) namespace X11
virtual void SetMarkerColor(Color_t cindex)
Sets color index "cindex" for markers.
Definition: TGQuartz.mm:604
bool fUseAA
Definition: TGQuartz.h:98
virtual Float_t GetTextMagnitude()
Returns the current font magnification factor.
Definition: TGQuartz.mm:555
Bool_t SetFillAreaParameters(CGContextRef ctx, unsigned *patternIndex)
virtual Font_t GetTextFont() const
Definition: TAttText.h:49
short Style_t
Definition: RtypesCore.h:76
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
virtual void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode)
Draws a box between [x1,y1] and [x2,y2] according to the "mode".
Definition: TGQuartz.mm:129
float Float_t
Definition: RtypesCore.h:53
std::auto_ptr< ROOT::MacOSX::Details::CocoaPrivate > fPimpl
Definition: TGCocoa.h:450
virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode)
Draws a text string using current font.
Definition: TGQuartz.mm:362
virtual void SetTextColor(Color_t cindex)
Sets the color index "cindex" for text.
Definition: TGQuartz.mm:642
#define assert(cond)
Definition: unittest.h:542
static Bool_t IsInitialized()
Definition: TTF.cxx:618
FT_Glyph fImage
Definition: TTF.h:79
unsigned short UShort_t
Definition: RtypesCore.h:36
bool AdjustCropArea(const Rectangle &srcRect, Rectangle &cropArea)
TH1 * h
Definition: legend2.C:5
virtual void DrawFillArea(Int_t n, TPoint *xy)
Fills area described by the polygon.
Definition: TGQuartz.mm:187
SCoord_t fX
Definition: TPoint.h:37
virtual Float_t GetTextSize() const
Definition: TAttText.h:50
void AlignTTFString()
Definition: TGQuartz.mm:707
#define gROOT
Definition: TROOT.h:340
#define H(x, y, z)
SCoord_t fY
Definition: TPoint.h:38
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void SetFillStyle(Style_t fstyle)
Definition: TAttFill.h:52
QuartzPixmap * fBackBuffer
Definition: QuartzWindow.h:195
virtual Int_t GetFontDescent() const
Returns the descent of the current font (in pixels.
Definition: TGQuartz.mm:513
short Font_t
Definition: RtypesCore.h:75
virtual void QueryColor(Colormap_t cmap, ColorStruct_t &color)
Returns the current RGB value for the pixel in the "color" structure.
Definition: TGCocoa.mm:2929
std::vector< TPoint > fConvertedPoints
Definition: TGQuartz.h:91
virtual void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic)
Draws a cell array.
Definition: TGQuartz.mm:240
void SetAA()
Definition: TGQuartz.mm:1002
virtual void SetLineWidth(Width_t width)
Sets the line width.
Definition: TGQuartz.mm:578
virtual void DrawPolyMarker(Int_t n, TPoint *xy)
Draws "n" markers with the current attributes at position [x,y].
Definition: TGQuartz.mm:324
virtual void SetTextFont(Font_t tfont=62)
Definition: TAttText.h:59
UShort_t fRed
Definition: GuiTypes.h:313
static const double x2[5]
virtual void SetLineColor(Color_t cindex)
Sets color index "cindex" for drawing lines.
Definition: TGQuartz.mm:562
Double_t x[n]
Definition: legend1.C:17
static void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
Definition: TTF.cxx:183
virtual void SetOpacity(Int_t percent)
Sets opacity of the current window.
static void SetTextFont(Font_t fontnumber)
Set specified font.
Definition: TTF.cxx:496
static void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
Definition: TTF.cxx:249
short SCoord_t
Definition: RtypesCore.h:80
virtual void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draws a line.
Definition: TGQuartz.mm:248
virtual Color_t GetTextColor() const
Definition: TAttText.h:48
unsigned fHeight
Definition: QuartzPixmap.h:46
virtual void SetMarkerColor(Color_t mcolor=1)
Definition: TAttMarker.h:51
static TTGlyph * GetGlyphs()
Definition: TTF.cxx:660
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
virtual Bool_t AllocColor(Colormap_t cmap, ColorStruct_t &color)
Allocates a read-only colormap entry corresponding to the closest RGB value supported by the hardware...
Definition: TGCocoa.mm:2919
lv SetLineColor(kBlue)
virtual Window_t GetCurrentWindow() const
pointer to the current internal window used in canvas graphics
Definition: TGCocoa.mm:773
virtual void SetTextSize(Float_t textsize)
Sets the current text size to "textsize".
Definition: TGQuartz.mm:679
short Color_t
Definition: RtypesCore.h:79
virtual void SetTextAlign(Short_t align=11)
Definition: TAttText.h:55
void DrawPolyLine(CGContextRef ctx, Int_t n, TPoint *xy)
Definition: QuartzLine.mm:135
static void SetSmoothing(Bool_t state)
Set smoothing (anti-aliasing) flag.
Definition: TTF.cxx:364
Drawable_t fSelectedDrawable
Definition: TGCocoa.h:448
Definition: TPoint.h:33
UShort_t fGreen
Definition: GuiTypes.h:314
virtual void SetLineColor(Color_t lcolor)
Definition: TAttLine.h:54
virtual Size_t GetMarkerSize() const
Definition: TAttMarker.h:46
static Int_t GetWidth()
Definition: TTF.cxx:625
ROOT::R::TRInterface & r
Definition: Object.C:4
void DrawFillArea(CGContextRef ctx, Int_t n, TPoint *xy, Bool_t drawShadow)
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
bool fDirectDraw
Definition: TGCocoa.h:454
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
virtual void SetMarkerSize(Float_t markersize)
Sets marker size index.
Definition: TGQuartz.mm:612
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Definition: TEnv.cxx:494
char * Strip(const char *str, char c= ' ')
Strip leading and trailing c (blanks by default) from a string.
Definition: TString.cxx:2477
virtual Color_t GetFillColor() const
Definition: TAttFill.h:43
h1 SetFillColor(kGreen)
TGQuartz()
Definition: TGQuartz.mm:88
static FT_Matrix * GetRotMatrix()
Definition: TTF.cxx:646
unsigned int UInt_t
Definition: RtypesCore.h:42
TTF helper class containing glyphs description.
Definition: TTF.h:75
const Float_t kScale
Definition: TGQuartz.mm:47
void DrawPolyMarker(CGContextRef ctx, const std::vector< TPoint > &marker, Size_t markerSize, Style_t markerStyle)
short Short_t
Definition: RtypesCore.h:35
f1 SetLineWidth(4)
void DrawFTGlyphIntoPixmap(void *pixmap, FT_Bitmap *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by)
Definition: TGQuartz.mm:879
virtual void SetMarkerStyle(Style_t mstyle=1)
Definition: TAttMarker.h:53
void DrawPolygonWithGradientFill(CGContextRef ctx, const TColorGradient *extendedColor, const CGSize &sizeOfDrawable, Int_t nPoints, const TPoint *xy, Bool_t drawShadow)
virtual void SetFillColor(Color_t cindex)
Sets color index "cindex" for fill areas.
Definition: TGQuartz.mm:587
void PixelToRGB(Pixel_t pixelColor, CGFloat *rgb)
Definition: X11Colors.mm:920
virtual Int_t GetFontAscent() const
Returns the ascent of the current font (in pixels).
Definition: TGQuartz.mm:472
virtual Color_t GetLineColor() const
Definition: TAttLine.h:47
ULong_t fPixel
Definition: GuiTypes.h:312
virtual void SetMarkerStyle(Style_t markerstyle)
Sets marker style.
Definition: TGQuartz.mm:622
lv DrawLine(0.33, 0.0, 0.33, 1.0)
virtual void SetMarkerSize(Size_t msize=1)
Definition: TAttMarker.h:54
int LocalYROOTToCocoa(NSView< X11Window > *parentView, CGFloat yROOT)
short Width_t
Definition: RtypesCore.h:78
unsigned fWidth
Definition: QuartzPixmap.h:45
static const double x1[5]
double f(double x)
virtual ULong_t GetPixel(Color_t cindex)
Returns pixel value associated to specified ROOT color number "cindex".
Definition: TGCocoa.mm:2944
static Int_t GetAscent()
Definition: TTF.cxx:632
std::vector< unsigned char > fData
Definition: QuartzPixmap.h:48
TText * text
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
unsigned long ULong_t
Definition: RtypesCore.h:51
TCanvas * style()
Definition: style.C:1
Double_t y[n]
Definition: legend1.C:17
The color creation and management class.
Definition: TColor.h:23
virtual void SetLineStyle(Style_t lstyle)
Definition: TAttLine.h:56
virtual void SetTextAlign(Short_t talign=11)
Sets the text alignment.
Definition: TGQuartz.mm:631
virtual void GetWindowSize(Drawable_t wid, Int_t &x, Int_t &y, UInt_t &w, UInt_t &h)
Returns the location and the size of window "id".
Definition: TGCocoa.mm:1349
FT_Vector fAlign
Definition: TGQuartz.h:39
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual void SetTextFont(Font_t fontnumber)
Sets the current text font number.
Definition: TGQuartz.mm:651
static void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
Definition: TTF.cxx:341
typedef void((*Func_t)())
void RenderTTFString(Int_t x, Int_t y, ETextMode mode)
Definition: TGQuartz.mm:775
virtual Color_t GetMarkerColor() const
Definition: TAttMarker.h:44
Bool_t IsTTFStringVisible(Int_t x, Int_t y, UInt_t w, UInt_t h)
Definition: TGQuartz.mm:745
This class implements TVirtualX interface for MacOS X, using Cocoa and Quartz 2D. ...
Definition: TGCocoa.h:64
lv SetLineStyle(3)
void DrawBox(CGContextRef ctx, Int_t x1, Int_t y1, Int_t x2, Int_t y2, bool hollow)
const size_t kBitsPerByte
Definition: Rtypes.h:114
virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *text)
Returns the size of the specified character string "mess".
Definition: TGQuartz.mm:441
virtual void DrawPolyLine(Int_t n, TPoint *xy)
Draws a line through all points in the list.
Definition: TGQuartz.mm:286
virtual void SetTextColor(Color_t tcolor=1)
Definition: TAttText.h:57
#define TESTBIT(n, i)
Definition: Rtypes.h:123
static void SetTextSize(Float_t textsize)
Set current text size.
Definition: TTF.cxx:572
void * GetSelectedDrawableChecked(const char *calledFrom) const
Definition: TGQuartz.mm:1019
unsigned char UChar_t
Definition: RtypesCore.h:34
virtual void SetTextSize(Float_t tsize=1)
Definition: TAttText.h:60
virtual void SetLineStyle(Style_t linestyle)
Sets the line style.
Definition: TGQuartz.mm:570
static Int_t GetNumGlyphs()
Definition: TTF.cxx:639
virtual Style_t GetMarkerStyle() const
Definition: TAttMarker.h:45
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual Width_t GetLineWidth() const
Definition: TAttLine.h:49
TColorGradient extends basic TColor.
float value
Definition: math.cpp:443
virtual void SetFillStyle(Style_t style)
Sets fill area style.
Definition: TGQuartz.mm:596
const Int_t n
Definition: legend1.C:16
This is non-GUI part of TVirtualX interface, implemented for MacOS X, using CoreGraphics (Quartz)...
Definition: TGQuartz.h:34
static const FT_BBox & GetBox()
Definition: TTF.cxx:653
static Bool_t GetSmoothing()
Definition: TTF.cxx:611
Short_t fTextAlign
Definition: TAttText.h:37