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