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#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]
unsigned long ULong_t
Definition RtypesCore.h:55
short Width_t
Definition RtypesCore.h:82
short Font_t
Definition RtypesCore.h:79
short Short_t
Definition RtypesCore.h:39
short Color_t
Definition RtypesCore.h:83
short Style_t
Definition RtypesCore.h:80
float Float_t
Definition RtypesCore.h:57
#define ClassDef(name, id)
Definition Rtypes.h:325
include TDocParser_001 C image html pict1_TDocParser_001 png width
char name[80]
Definition TGX11.cxx:110
XPoint xy[kMAXMK]
Definition TGX11.cxx:123
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:1745
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:333
virtual void SetTextAlign(Short_t talign=11)
Sets the text alignment.
Definition TGQuartz.mm:658
virtual Int_t GetFontAscent() const
Returns the ascent of the current font (in pixels).
Definition TGQuartz.mm:499
virtual Float_t GetTextMagnitude()
Returns the current font magnification factor.
Definition TGQuartz.mm:582
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
bool fUseFAAA
Definition TGQuartz.h:94
Bool_t IsTTFStringVisible(Int_t x, Int_t y, UInt_t w, UInt_t h)
Definition TGQuartz.mm:772
virtual void SetLineWidth(Width_t width)
Sets the line width.
Definition TGQuartz.mm:605
virtual void SetTextColor(Color_t cindex)
Sets the color index "cindex" for text.
Definition TGQuartz.mm:669
virtual void SetMarkerSize(Float_t markersize)
Sets marker size index.
Definition TGQuartz.mm:639
@ 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:802
void SetAA()
Definition TGQuartz.mm:1029
virtual void DrawPolyLine(Int_t n, TPoint *xy)
Draws a line through all points in the list.
Definition TGQuartz.mm:290
virtual void SetTextSize(Float_t textsize)
Sets the current text size to "textsize".
Definition TGQuartz.mm:706
void AlignTTFString()
Definition TGQuartz.mm:734
virtual Int_t GetFontDescent() const
Returns the descent of the current font (in pixels.
Definition TGQuartz.mm:540
void * GetSelectedDrawableChecked(const char *calledFrom) const
Definition TGQuartz.mm:1054
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:906
virtual void SetFillStyle(Style_t style)
Sets fill area style.
Definition TGQuartz.mm:623
std::vector< TPoint > fConvertedPoints
Definition TGQuartz.h:85
virtual void SetMarkerColor(Color_t cindex)
Sets color index "cindex" for markers.
Definition TGQuartz.mm:631
virtual void SetLineColor(Color_t cindex)
Sets color index "cindex" for drawing lines.
Definition TGQuartz.mm:589
virtual void SetLineStyle(Style_t linestyle)
Sets the line style.
Definition TGQuartz.mm:597
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:389
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
virtual void DrawLine(Int_t x1, Int_t y1, Int_t x2, Int_t y2)
Draws a line.
Definition TGQuartz.mm:243
virtual void GetTextExtent(UInt_t &w, UInt_t &h, char *text)
Returns the size of the specified character string "mess".
Definition TGQuartz.mm:468
virtual void SetTextFont(Font_t fontnumber)
Sets the current text font number.
Definition TGQuartz.mm:678
virtual void DrawFillArea(Int_t n, TPoint *xy)
Fills area described by the polygon.
Definition TGQuartz.mm:177
virtual void SetOpacity(Int_t percent)
Sets opacity of the current window.
Definition TGQuartz.mm:722
virtual void SetMarkerStyle(Style_t markerstyle)
Sets marker style.
Definition TGQuartz.mm:649
virtual void SetFillColor(Color_t cindex)
Sets color index "cindex" for fill areas.
Definition TGQuartz.mm:614
FT_Vector fAlign
Definition TGQuartz.h:33
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