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