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