Logo ROOT  
Reference Guide
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 #include "TTF.h"
20 
21 /** \class TGQuartz
22 \ingroup cocoa
23 
24 This is non-GUI part of TVirtualX interface, implemented for
25 MacOS X, using CoreGraphics (Quartz).
26 */
27 
28 class TGQuartz : public TGCocoa {
29 private:
32 
33  FT_Vector fAlign; // alignment vector
34 public:
35  TGQuartz();
36  TGQuartz(const char *name, const char *title);
37 
38  //Final-overriders for TVirtualX.
39  virtual void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2,
40  EBoxMode mode);
41  virtual void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2,
42  Int_t nx, Int_t ny, Int_t *ic);
43  virtual void DrawFillArea(Int_t n, TPoint *xy);
44 
45  using TGCocoa::DrawLine;//There is a GUI version of DrawLine.
46 
47  virtual void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2);
48  virtual void DrawPolyLine(Int_t n, TPoint *xy);
49  virtual void DrawPolyMarker(Int_t n, TPoint *xy);
50  virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
51  const char *text, ETextMode mode);
52  virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
53  const wchar_t *text, ETextMode mode);
54 
55  //I have to override these setters, since they are alredy overriden
56  //in TVirtualX (originally, they are declared in TAttXXX classes)
57  //and do nothing in TVirtualX (though, they are implemented
58  //correctly in TAttXXX classes).
59  virtual void SetFillColor(Color_t cindex);
60  virtual void SetFillStyle(Style_t style);
61  virtual void SetLineColor(Color_t cindex);
62  virtual void SetLineStyle(Style_t linestyle);
63  virtual void SetLineWidth(Width_t width);
64  virtual void SetMarkerColor(Color_t cindex);
65  virtual void SetMarkerSize(Float_t markersize);
66  virtual void SetMarkerStyle(Style_t markerstyle);
67  virtual void SetOpacity(Int_t percent);
68  virtual void SetTextAlign(Short_t talign=11);
69  virtual void SetTextColor(Color_t cindex);
70  virtual void SetTextFont(Font_t fontnumber);
71  virtual Int_t SetTextFont(char *fontname, ETextSetMode mode);
72  virtual void SetTextSize(Float_t textsize);
73 
74  virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *text);
75  virtual Int_t GetFontAscent() const;
76  virtual Int_t GetFontAscent(const char *text) const;
77  virtual Int_t GetFontDescent() const;
78  virtual Int_t GetFontDescent(const char *text) const;
79  virtual Float_t GetTextMagnitude();
80 
81 private:
82 
83  //Unfortunately, I have to convert from
84  //top-left to bottom-left corner system.
85  std::vector<TPoint> fConvertedPoints;
86 
87  //Lines with AA can be quite different
88  //from what we always had with X11.
89  //Now this is a switch in our configuration file (system.rootrc),
90  //so it can be disabled. This flag affects _only_ pad's graphics,
91  //GUI graphics is special and different. AA for fill area has a special
92  // switch because it is better to have it off by default.
93  bool fUseAA;
94  bool fUseFAAA;
95 
96  void AlignTTFString();
98  void RenderTTFString(Int_t x, Int_t y, ETextMode mode);
99  //I have to use void * instead of QuartzPixmap * because of CINT :(
100  void DrawFTGlyphIntoPixmap(void *pixmap, FT_Bitmap *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by);
101 
102  void SetAA();
103  void *GetSelectedDrawableChecked(const char *calledFrom) const;
104 
105  TGQuartz(const TGQuartz &rhs);
106  TGQuartz &operator = (const TGQuartz &rhs);
107 
108  ClassDef(TGQuartz, 0);//2D non-GUI graphics for Mac OSX.
109 };
110 
111 #endif
TGQuartz::fAlign
FT_Vector fAlign
Definition: TGQuartz.h:33
TGQuartz::SetTextFont
virtual void SetTextFont(Font_t fontnumber)
Sets the current text font number.
Definition: TGQuartz.mm:670
n
const Int_t n
Definition: legend1.C:16
TGQuartz::kMLeft
@ kMLeft
Definition: TGQuartz.h:30
TGQuartz::kMRight
@ kMRight
Definition: TGQuartz.h:31
TGQuartz::kBLeft
@ kBLeft
Definition: TGQuartz.h:31
Style_t
short Style_t
Definition: RtypesCore.h:80
TGQuartz::DrawText
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:381
TGQuartz::IsTTFStringVisible
Bool_t IsTTFStringVisible(Int_t x, Int_t y, UInt_t w, UInt_t h)
Definition: TGQuartz.mm:764
TGCocoa::DrawLine
virtual void DrawLine(Drawable_t wid, GContext_t gc, Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Uses the components of the specified GC to draw a line between the specified set of points (x1,...
Definition: TGCocoa.mm:1712
TGQuartz::DrawBox
virtual void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2, EBoxMode mode)
Draws a box between [x1,y1] and [x2,y2] according to the "mode".
Definition: TGQuartz.mm:119
TGQuartz::SetAA
void SetAA()
Definition: TGQuartz.mm:1021
TGQuartz::kNone
@ kNone
Definition: TGQuartz.h:30
TGQuartz::EAlign
EAlign
Definition: TGQuartz.h:30
TVirtualX::ETextSetMode
ETextSetMode
Definition: TVirtualX.h:52
TGQuartz::fUseAA
bool fUseAA
Definition: TGQuartz.h:93
Float_t
float Float_t
Definition: RtypesCore.h:57
width
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
Font_t
short Font_t
Definition: RtypesCore.h:79
TGQuartz::SetMarkerColor
virtual void SetMarkerColor(Color_t cindex)
Sets color index "cindex" for markers.
Definition: TGQuartz.mm:623
TGQuartz::AlignTTFString
void AlignTTFString()
Definition: TGQuartz.mm:726
x
Double_t x[n]
Definition: legend1.C:17
TGQuartz::GetTextMagnitude
virtual Float_t GetTextMagnitude()
Returns the current font magnification factor.
Definition: TGQuartz.mm:574
TGQuartz::DrawLine
virtual void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draws a line.
Definition: TGQuartz.mm:243
TGQuartz::kTLeft
@ kTLeft
Definition: TGQuartz.h:30
TGQuartz::DrawCellArray
virtual void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2, Int_t nx, Int_t ny, Int_t *ic)
Draws a cell array.
Definition: TGQuartz.mm:235
Color_t
short Color_t
Definition: RtypesCore.h:83
TGQuartz::kBRight
@ kBRight
Definition: TGQuartz.h:31
text
TText * text
Definition: entrylist_figure1.C:10
bool
TGQuartz::SetMarkerStyle
virtual void SetMarkerStyle(Style_t markerstyle)
Sets marker style.
Definition: TGQuartz.mm:641
x1
static const double x1[5]
Definition: RooGaussKronrodIntegrator1D.cxx:346
xy
XPoint xy[kMAXMK]
Definition: TGX11.cxx:123
style
TCanvas * style()
Definition: style.C:1
TGQuartz
Definition: TGQuartz.h:28
TTF.h
TGCocoa.h
TGQuartz::fConvertedPoints
std::vector< TPoint > fConvertedPoints
Definition: TGQuartz.h:85
TGQuartz::GetFontDescent
virtual Int_t GetFontDescent() const
Returns the descent of the current font (in pixels.
Definition: TGQuartz.mm:532
TGQuartz::SetTextSize
virtual void SetTextSize(Float_t textsize)
Sets the current text size to "textsize".
Definition: TGQuartz.mm:698
h
#define h(i)
Definition: RSha256.hxx:124
TGCocoa
Definition: TGCocoa.h:58
TGQuartz::GetFontAscent
virtual Int_t GetFontAscent() const
Returns the ascent of the current font (in pixels).
Definition: TGQuartz.mm:491
Width_t
short Width_t
Definition: RtypesCore.h:82
TGQuartz::SetTextAlign
virtual void SetTextAlign(Short_t talign=11)
Sets the text alignment.
Definition: TGQuartz.mm:650
TGQuartz::DrawPolyMarker
virtual void DrawPolyMarker(Int_t n, TPoint *xy)
Draws "n" markers with the current attributes at position [x,y].
Definition: TGQuartz.mm:333
TGQuartz::operator=
TGQuartz & operator=(const TGQuartz &rhs)
TGQuartz::TGQuartz
TGQuartz()
Definition: TGQuartz.mm:78
TVirtualX::EBoxMode
EBoxMode
Definition: TVirtualX.h:50
y
Double_t y[n]
Definition: legend1.C:17
ULong_t
unsigned long ULong_t
Definition: RtypesCore.h:55
Short_t
short Short_t
Definition: RtypesCore.h:39
TGQuartz::SetMarkerSize
virtual void SetMarkerSize(Float_t markersize)
Sets marker size index.
Definition: TGQuartz.mm:631
TGQuartz::SetLineWidth
virtual void SetLineWidth(Width_t width)
Sets the line width.
Definition: TGQuartz.mm:597
TGQuartz::fUseFAAA
bool fUseFAAA
Definition: TGQuartz.h:94
unsigned int
TGQuartz::SetLineColor
virtual void SetLineColor(Color_t cindex)
Sets color index "cindex" for drawing lines.
Definition: TGQuartz.mm:581
TGQuartz::RenderTTFString
void RenderTTFString(Int_t x, Int_t y, ETextMode mode)
Definition: TGQuartz.mm:794
TPoint
Definition: TPoint.h:31
TGQuartz::kTRight
@ kTRight
Definition: TGQuartz.h:30
TGQuartz::SetOpacity
virtual void SetOpacity(Int_t percent)
Sets opacity of the current window.
Definition: TGQuartz.mm:714
TGQuartz::DrawFTGlyphIntoPixmap
void DrawFTGlyphIntoPixmap(void *pixmap, FT_Bitmap *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by)
Definition: TGQuartz.mm:898
TGQuartz::GetSelectedDrawableChecked
void * GetSelectedDrawableChecked(const char *calledFrom) const
Definition: TGQuartz.mm:1046
TGQuartz::kBCenter
@ kBCenter
Definition: TGQuartz.h:31
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGQuartz::SetLineStyle
virtual void SetLineStyle(Style_t linestyle)
Sets the line style.
Definition: TGQuartz.mm:589
name
char name[80]
Definition: TGX11.cxx:110
x2
static const double x2[5]
Definition: RooGaussKronrodIntegrator1D.cxx:364
TPoint.h
TGQuartz::kMCenter
@ kMCenter
Definition: TGQuartz.h:31
TGQuartz::SetTextColor
virtual void SetTextColor(Color_t cindex)
Sets the color index "cindex" for text.
Definition: TGQuartz.mm:661
TGQuartz::GetTextExtent
virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *text)
Returns the size of the specified character string "mess".
Definition: TGQuartz.mm:460
TGQuartz::DrawFillArea
virtual void DrawFillArea(Int_t n, TPoint *xy)
Fills area described by the polygon.
Definition: TGQuartz.mm:177
TGQuartz::kTCenter
@ kTCenter
Definition: TGQuartz.h:30
TGQuartz::SetFillStyle
virtual void SetFillStyle(Style_t style)
Sets fill area style.
Definition: TGQuartz.mm:615
TVirtualX::ETextMode
ETextMode
Definition: TVirtualX.h:51
TGQuartz::DrawPolyLine
virtual void DrawPolyLine(Int_t n, TPoint *xy)
Draws a line through all points in the list.
Definition: TGQuartz.mm:290
TGQuartz::SetFillColor
virtual void SetFillColor(Color_t cindex)
Sets color index "cindex" for fill areas.
Definition: TGQuartz.mm:606
int