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
24This is non-GUI part of TVirtualX interface, implemented for
25MacOS X, using CoreGraphics (Quartz).
26*/
27
28class TGQuartz : public TGCocoa {
29private:
32
33 FT_Vector fAlign; // alignment vector
34public:
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
81private:
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;
95
96 void AlignTTFString();
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);
107
108 ClassDef(TGQuartz, 0);//2D non-GUI graphics for Mac OSX.
109};
110
111#endif
#define h(i)
Definition: RSha256.hxx:106
static const double x2[5]
static const double x1[5]
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
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 Color_t
Definition: RtypesCore.h:79
short Style_t
Definition: RtypesCore.h:76
float Float_t
Definition: RtypesCore.h:53
#define ClassDef(name, id)
Definition: Rtypes.h:326
include TDocParser_001 C image html pict1_TDocParser_001 png width
Definition: TDocParser.cxx:121
char name[80]
Definition: TGX11.cxx:109
XPoint xy[kMAXMK]
Definition: TGX11.cxx:122
This class implements TVirtualX interface for MacOS X, using Cocoa and Quartz 2D.
Definition: TGCocoa.h:58
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
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
@ kBLeft
Definition: TGQuartz.h:31
@ 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
TGQuartz(const TGQuartz &rhs)
TGQuartz & operator=(const TGQuartz &rhs)
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
Definition: TPoint.h:31
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