Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TGQuartz.h
Go to the documentation of this file.
1// @(#)root/graf2d:$Id$
2// Author: Olivier Couet and Timur Pocheptsov 23/01/2012
3
4/*************************************************************************
5 * Copyright (C) 1995-2011, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGQuartz
13#define ROOT_TGQuartz
14
15#include <vector>
16
17#include "TGCocoa.h"
18#include "TPoint.h"
19
20/** \class TGQuartz
21\ingroup cocoa
22
23This is non-GUI part of TVirtualX interface, implemented for
24MacOS X, using CoreGraphics (Quartz).
25*/
26
27class TGQuartz : public TGCocoa {
28public:
29 TGQuartz();
30 TGQuartz(const char *name, const char *title);
31
32 //Final-overriders for TVirtualX.
33 void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2,
34 EBoxMode mode) override;
35 void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2,
36 Int_t nx, Int_t ny, Int_t *ic) override;
37 void DrawFillArea(Int_t n, TPoint *xy) override;
38
39 using TGCocoa::DrawLine;//There is a GUI version of DrawLine.
40
41 void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2) override;
42 void DrawPolyLine(Int_t n, TPoint *xy) override;
43 void DrawPolyMarker(Int_t n, TPoint *xy) override;
44 void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
45 const char *text, ETextMode mode) override;
46 void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
47 const wchar_t *text, ETextMode mode) override;
48
49 //I have to override these setters, since they are alredy overriden
50 //in TVirtualX (originally, they are declared in TAttXXX classes)
51 //and do nothing in TVirtualX (though, they are implemented
52 //correctly in TAttXXX classes).
53 void SetFillColor(Color_t cindex) override;
54 void SetFillStyle(Style_t style) override;
55 void SetLineColor(Color_t cindex) override;
56 void SetLineStyle(Style_t linestyle) override;
57 void SetLineWidth(Width_t width) override;
58 void SetMarkerColor(Color_t cindex) override;
59 void SetMarkerSize(Float_t markersize) override;
60 void SetMarkerStyle(Style_t markerstyle) override;
61 void SetOpacity(Int_t percent) override;
62 void SetTextAlign(Short_t talign=11) override;
63 void SetTextColor(Color_t cindex) override;
64 void SetTextFont(Font_t fontnumber) override;
65 Int_t SetTextFont(char *fontname, ETextSetMode mode) override;
66 void SetTextSize(Float_t textsize) override;
67
68 void GetTextExtent(UInt_t &w, UInt_t &h, char *text) override;
69 Int_t GetFontAscent() const override;
70 Int_t GetFontAscent(const char *text) const override;
71 Int_t GetFontDescent() const override;
72 Int_t GetFontDescent(const char *text) const override;
73
74 Float_t GetTextMagnitude() override;
75
76 //---- Methods used for new graphics -----
77 void SetOpacityW(WinContext_t wctxt, Int_t percent) override;
78 void SetAttFill(WinContext_t wctxt, const TAttFill &att) override;
79 void SetAttLine(WinContext_t wctxt, const TAttLine &att) override;
80 void SetAttMarker(WinContext_t wctxt, const TAttMarker &att) override;
81 void SetAttText(WinContext_t wctxt, const TAttText &att) override;
82
83 void DrawBoxW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override;
84 void DrawFillAreaW(WinContext_t wctxt, Int_t n, TPoint *xy) override;
85 void DrawLineW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2) override;
86 void DrawPolyLineW(WinContext_t wctxt, Int_t n, TPoint *xy) override;
87 void DrawLinesSegmentsW(WinContext_t wctxt, Int_t n, TPoint *xy) override;
88 void DrawPolyMarkerW(WinContext_t wctxt, Int_t n, TPoint *xy) override;
89 void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override;
90 void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn, const wchar_t *text, ETextMode mode) override;
91
92 Bool_t GetTextExtentA(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const char *mess) override;
93 Bool_t GetTextExtentA(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const wchar_t *mess) override;
94 Bool_t GetFontAscentDescent(Font_t font, Double_t size, UInt_t &a, UInt_t &d, const char *mess) override;
95
96private:
97
98 //Unfortunately, I have to convert from
99 //top-left to bottom-left corner system.
100 std::vector<TPoint> fConvertedPoints;
101
102 //Lines with AA can be quite different
103 //from what we always had with X11.
104 //Now this is a switch in our configuration file (system.rootrc),
105 //so it can be disabled. This flag affects _only_ pad's graphics,
106 //GUI graphics is special and different. AA for fill area has a special
107 // switch because it is better to have it off by default.
108 bool fUseAA;
110
111 void DrawFTGlyph(void *pixmap, void *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by);
112
113 void SetAA();
118 void *GetPixmapDrawable(void *drawable0, const char *calledFrom) const;
119
120 TGQuartz(const TGQuartz &rhs);
122
123 ClassDefOverride(TGQuartz, 0);//2D non-GUI graphics for Mac OSX.
124};
125
126#endif
Handle_t WinContext_t
Window drawing context.
Definition GuiTypes.h:30
#define d(i)
Definition RSha256.hxx:102
#define a(i)
Definition RSha256.hxx:99
#define h(i)
Definition RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int).
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
Definition RtypesCore.h:60
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
bool Bool_t
Boolean (0=false, 1=true) (bool).
Definition RtypesCore.h:77
short Font_t
Font number (short).
Definition RtypesCore.h:95
short Short_t
Signed Short integer 2 bytes (short).
Definition RtypesCore.h:53
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
short Color_t
Color number (short).
Definition RtypesCore.h:99
short Style_t
Style number (short).
Definition RtypesCore.h:96
float Float_t
Float 4 bytes (float).
Definition RtypesCore.h:71
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
char name[80]
Definition TGX11.cxx:148
TGCocoa()
Definition TGCocoa.mm:430
void DrawLine(Drawable_t wid, GContext_t gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Uses the components of the specified GC to draw a line between the specified set of points (x1,...
Definition TGCocoa.mm:1791
void SetLineWidth(Width_t width) override
Set the line width.
Definition TGQuartz.mm:869
TAttMarker & GetAttMarker(WinContext_t wctxt)
Definition TGQuartz.mm:1200
bool fUseFAAA
Definition TGQuartz.h:109
void SetAttLine(WinContext_t wctxt, const TAttLine &att) override
Set line attributes for specified window.
Definition TGQuartz.mm:1007
void DrawFTGlyph(void *pixmap, void *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by)
Definition TGQuartz.mm:1044
void SetMarkerColor(Color_t cindex) override
Set the marker color.
Definition TGQuartz.mm:901
void SetFillStyle(Style_t style) override
Set the fill area style.
Definition TGQuartz.mm:891
void SetOpacity(Int_t percent) override
Sets opacity of the current window.
Definition TGQuartz.mm:982
void SetFillColor(Color_t cindex) override
Set the fill area color.
Definition TGQuartz.mm:880
void DrawPolyLine(Int_t n, TPoint *xy) override
Draws a line through all points in the list.
Definition TGQuartz.mm:354
Float_t GetTextMagnitude() override
Returns the current font magnification factor.
Definition TGQuartz.mm:842
void SetAttText(WinContext_t wctxt, const TAttText &att) override
Set text attributes for specified window.
Definition TGQuartz.mm:1029
void SetAA()
Definition TGQuartz.mm:1155
void DrawFillArea(Int_t n, TPoint *xy) override
Fills area described by the polygon.
Definition TGQuartz.mm:242
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:504
void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draws a line.
Definition TGQuartz.mm:300
void DrawTextW(WinContext_t wctxt, Int_t x, Int_t y, Float_t angle, Float_t mgn, const char *text, ETextMode mode) override
Draw text on specified window.
Definition TGQuartz.mm:457
void SetTextColor(Color_t cindex) override
Set the text color.
Definition TGQuartz.mm:944
Bool_t GetTextExtentA(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const char *mess) override
Returns the size of the specified character string "mess" for font and size.
Definition TGQuartz.mm:710
void SetMarkerStyle(Style_t markerstyle) override
Set the marker style.
Definition TGQuartz.mm:923
bool fUseAA
Definition TGQuartz.h:108
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:174
void SetAttFill(WinContext_t wctxt, const TAttFill &att) override
Set fill attributes for specified window.
Definition TGQuartz.mm:997
std::vector< TPoint > fConvertedPoints
Definition TGQuartz.h:100
void SetTextAlign(Short_t talign=11) override
Set the text alignment.
Definition TGQuartz.mm:934
TAttText & GetAttText(WinContext_t wctxt)
Definition TGQuartz.mm:1210
void SetLineColor(Color_t cindex) override
Set the line color.
Definition TGQuartz.mm:849
void SetTextFont(Font_t fontnumber) override
Set the text font.
Definition TGQuartz.mm:955
void SetAttMarker(WinContext_t wctxt, const TAttMarker &att) override
Set marker attributes for specified window.
Definition TGQuartz.mm:1018
void GetTextExtent(UInt_t &w, UInt_t &h, char *text) override
Returns the size of the specified character string "mess".
Definition TGQuartz.mm:683
Int_t GetFontAscent() const override
Returns the ascent of the current font (in pixels).
Definition TGQuartz.mm:743
void SetMarkerSize(Float_t markersize) override
Set the marker size.
Definition TGQuartz.mm:911
TGQuartz(const TGQuartz &rhs)
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:249
TGQuartz & operator=(const TGQuartz &rhs)
void DrawLinesSegmentsW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw line segments on specified window.
Definition TGQuartz.mm:368
void SetTextSize(Float_t textsize) override
Set the text size.
Definition TGQuartz.mm:972
Bool_t GetFontAscentDescent(Font_t font, Double_t size, UInt_t &a, UInt_t &d, const char *mess) override
Returns ascent/descent for specified character string "mess" with font and size.
Definition TGQuartz.mm:815
void DrawPolyMarkerW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw poly marker on specified window.
Definition TGQuartz.mm:375
void DrawLineW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2) override
Draw line on specified window.
Definition TGQuartz.mm:256
void DrawPolyLineW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw poly line on specified window.
Definition TGQuartz.mm:313
void SetLineStyle(Style_t linestyle) override
Set the line style.
Definition TGQuartz.mm:859
TAttFill & GetAttFill(WinContext_t wctxt)
Definition TGQuartz.mm:1180
Int_t GetFontDescent() const override
Returns the descent of the current font (in pixels.
Definition TGQuartz.mm:779
void DrawBoxW(WinContext_t wctxt, Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode) override
Draw box on specified window.
Definition TGQuartz.mm:102
void SetOpacityW(WinContext_t wctxt, Int_t percent) override
Set opactity for specified window.
Definition TGQuartz.mm:992
void DrawPolyMarker(Int_t n, TPoint *xy) override
Draws "n" markers with the current attributes at position [x,y].
Definition TGQuartz.mm:429
void * GetPixmapDrawable(void *drawable0, const char *calledFrom) const
Definition TGQuartz.mm:1220
void DrawFillAreaW(WinContext_t wctxt, Int_t n, TPoint *xy) override
Draw fill area on specified window.
Definition TGQuartz.mm:180
TAttLine & GetAttLine(WinContext_t wctxt)
Definition TGQuartz.mm:1190
TText * text
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
TCanvas * style()
Definition style.C:1