ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #ifndef ROOT_TGCocoa
18 #include "TGCocoa.h"
19 #endif
20 #ifndef ROOT_TPoint
21 #include "TPoint.h"
22 #endif
23 #ifndef ROOT_TTF
24 #include "TTF.h"
25 #endif
26 
27 /** \class TGQuartz
28 \ingroup cocoa
29 
30 This is non-GUI part of TVirtualX interface, implemented for
31 MacOS X, using CoreGraphics (Quartz).
32 */
33 
34 class TGQuartz : public TGCocoa {
35 private:
38 
39  FT_Vector fAlign; // alignment vector
40 public:
41  TGQuartz();
42  TGQuartz(const char *name, const char *title);
43 
44  //Final-overriders for TVirtualX.
45  virtual void DrawBox(Int_t x1, Int_t y1, Int_t x2, Int_t y2,
46  EBoxMode mode);
47  virtual void DrawCellArray(Int_t x1, Int_t y1, Int_t x2, Int_t y2,
48  Int_t nx, Int_t ny, Int_t *ic);
49  virtual void DrawFillArea(Int_t n, TPoint *xy);
50 
51  using TGCocoa::DrawLine;//There is a GUI version of DrawLine.
52 
53  virtual void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2);
54  virtual void DrawPolyLine(Int_t n, TPoint *xy);
55  virtual void DrawPolyMarker(Int_t n, TPoint *xy);
56  virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
57  const char *text, ETextMode mode);
58  virtual void DrawText(Int_t x, Int_t y, Float_t angle, Float_t mgn,
59  const wchar_t *text, ETextMode mode);
60 
61  //I have to override these setters, since they are alredy overriden
62  //in TVirtualX (originally, they are declared in TAttXXX classes)
63  //and do nothing in TVirtualX (though, they are implemented
64  //correctly in TAttXXX classes).
65  virtual void SetFillColor(Color_t cindex);
66  virtual void SetFillStyle(Style_t style);
67  virtual void SetLineColor(Color_t cindex);
68  virtual void SetLineStyle(Style_t linestyle);
69  virtual void SetLineWidth(Width_t width);
70  virtual void SetMarkerColor(Color_t cindex);
71  virtual void SetMarkerSize(Float_t markersize);
72  virtual void SetMarkerStyle(Style_t markerstyle);
73  virtual void SetOpacity(Int_t percent);
74  virtual void SetTextAlign(Short_t talign=11);
75  virtual void SetTextColor(Color_t cindex);
76  virtual void SetTextFont(Font_t fontnumber);
77  virtual Int_t SetTextFont(char *fontname, ETextSetMode mode);
78  virtual void SetTextSize(Float_t textsize);
79 
80  virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *text);
81  virtual Int_t GetFontAscent() const;
82  virtual Int_t GetFontAscent(const char *text) const;
83  virtual Int_t GetFontDescent() const;
84  virtual Int_t GetFontDescent(const char *text) const;
85  virtual Float_t GetTextMagnitude();
86 
87 private:
88 
89  //Unfortunately, I have to convert from
90  //top-left to bottom-left corner system.
91  std::vector<TPoint> fConvertedPoints;
92 
93  //Lines with AA can be quite different
94  //from what we always had with X11.
95  //Now this is a switch in our configuration file (system.rootrc),
96  //so it can be disabled. This flag affects _only_ pad's graphics,
97  //GUI graphics is special and different.
98  bool fUseAA;
99 
100  void AlignTTFString();
102  void RenderTTFString(Int_t x, Int_t y, ETextMode mode);
103  //I have to use void * instead of QuartzPixmap * because of CINT :(
104  void DrawFTGlyphIntoPixmap(void *pixmap, FT_Bitmap *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by);
105 
106  void SetAA();
107  void *GetSelectedDrawableChecked(const char *calledFrom) const;
108 
109  TGQuartz(const TGQuartz &rhs);
110  TGQuartz &operator = (const TGQuartz &rhs);
111 
112  ClassDef(TGQuartz, 0);//2D non-GUI graphics for Mac OSX.
113 };
114 
115 #endif
const int nx
Definition: kalman.C:16
virtual void SetMarkerColor(Color_t cindex)
Sets color index "cindex" for markers.
Definition: TGQuartz.mm:604
bool fUseAA
Definition: TGQuartz.h:98
virtual Float_t GetTextMagnitude()
Returns the current font magnification factor.
Definition: TGQuartz.mm:555
short Style_t
Definition: RtypesCore.h:76
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:129
float Float_t
Definition: RtypesCore.h:53
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:362
virtual void SetTextColor(Color_t cindex)
Sets the color index "cindex" for text.
Definition: TGQuartz.mm:642
TH1 * h
Definition: legend2.C:5
virtual void DrawFillArea(Int_t n, TPoint *xy)
Fills area described by the polygon.
Definition: TGQuartz.mm:187
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:1679
void AlignTTFString()
Definition: TGQuartz.mm:707
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Int_t GetFontDescent() const
Returns the descent of the current font (in pixels.
Definition: TGQuartz.mm:513
short Font_t
Definition: RtypesCore.h:75
std::vector< TPoint > fConvertedPoints
Definition: TGQuartz.h:91
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:240
void SetAA()
Definition: TGQuartz.mm:1002
virtual void SetLineWidth(Width_t width)
Sets the line width.
Definition: TGQuartz.mm:578
virtual void DrawPolyMarker(Int_t n, TPoint *xy)
Draws "n" markers with the current attributes at position [x,y].
Definition: TGQuartz.mm:324
static const double x2[5]
virtual void SetLineColor(Color_t cindex)
Sets color index "cindex" for drawing lines.
Definition: TGQuartz.mm:562
Double_t x[n]
Definition: legend1.C:17
virtual void SetOpacity(Int_t percent)
Sets opacity of the current window.
const int ny
Definition: kalman.C:17
virtual void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draws a line.
Definition: TGQuartz.mm:248
virtual void SetTextSize(Float_t textsize)
Sets the current text size to "textsize".
Definition: TGQuartz.mm:679
short Color_t
Definition: RtypesCore.h:79
Definition: TPoint.h:33
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
virtual void SetMarkerSize(Float_t markersize)
Sets marker size index.
Definition: TGQuartz.mm:612
TGQuartz()
Definition: TGQuartz.mm:88
unsigned int UInt_t
Definition: RtypesCore.h:42
tuple w
Definition: qtexample.py:51
short Short_t
Definition: RtypesCore.h:35
void DrawFTGlyphIntoPixmap(void *pixmap, FT_Bitmap *source, ULong_t fore, ULong_t back, Int_t bx, Int_t by)
Definition: TGQuartz.mm:879
virtual void SetFillColor(Color_t cindex)
Sets color index "cindex" for fill areas.
Definition: TGQuartz.mm:587
virtual Int_t GetFontAscent() const
Returns the ascent of the current font (in pixels).
Definition: TGQuartz.mm:472
virtual void SetMarkerStyle(Style_t markerstyle)
Sets marker style.
Definition: TGQuartz.mm:622
short Width_t
Definition: RtypesCore.h:78
TGQuartz & operator=(const TGQuartz &rhs)
static const double x1[5]
TText * text
ClassDef(TGQuartz, 0)
unsigned long ULong_t
Definition: RtypesCore.h:51
TCanvas * style()
Definition: style.C:1
Double_t y[n]
Definition: legend1.C:17
virtual void SetTextAlign(Short_t talign=11)
Sets the text alignment.
Definition: TGQuartz.mm:631
FT_Vector fAlign
Definition: TGQuartz.h:39
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual void SetTextFont(Font_t fontnumber)
Sets the current text font number.
Definition: TGQuartz.mm:651
void RenderTTFString(Int_t x, Int_t y, ETextMode mode)
Definition: TGQuartz.mm:775
Bool_t IsTTFStringVisible(Int_t x, Int_t y, UInt_t w, UInt_t h)
Definition: TGQuartz.mm:745
This class implements TVirtualX interface for MacOS X, using Cocoa and Quartz 2D. ...
Definition: TGCocoa.h:64
virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *text)
Returns the size of the specified character string "mess".
Definition: TGQuartz.mm:441
virtual void DrawPolyLine(Int_t n, TPoint *xy)
Draws a line through all points in the list.
Definition: TGQuartz.mm:286
void * GetSelectedDrawableChecked(const char *calledFrom) const
Definition: TGQuartz.mm:1019
virtual void SetLineStyle(Style_t linestyle)
Sets the line style.
Definition: TGQuartz.mm:570
virtual void SetFillStyle(Style_t style)
Sets fill area style.
Definition: TGQuartz.mm:596
const Int_t n
Definition: legend1.C:16
This is non-GUI part of TVirtualX interface, implemented for MacOS X, using CoreGraphics (Quartz)...
Definition: TGQuartz.h:34