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