ROOT
6.08/07
Reference Guide
graf2d
quartz
src
QuartzUtils.mm
Go to the documentation of this file.
1
// @(#)root/graf2d:$Id$
2
// Author: Timur Pocheptsov, 11/06/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
#include <cassert>
13
14
#include "
QuartzUtils.h
"
15
16
namespace
ROOT
{
17
namespace
Quartz
{
18
19
//______________________________________________________________________________
20
CGStateGuard::CGStateGuard
(
MacOSX::Util::CFScopeGuard<CGContextRef>
&ctx)
21
: fCtx(ctx.Get())
22
{
23
assert(
fCtx
!= 0 &&
"CGStateGuard, ctx parameter is null"
);
24
CGContextSaveGState(
fCtx
);
25
}
26
27
//______________________________________________________________________________
28
CGStateGuard::CGStateGuard
(CGContextRef ctx)
29
:
fCtx
(ctx)
30
{
31
assert(ctx != 0 &&
"CGStateGuard, ctx parameter is null"
);
32
CGContextSaveGState(ctx);
33
}
34
35
//______________________________________________________________________________
36
CGStateGuard::~CGStateGuard
()
37
{
38
CGContextRestoreGState(
fCtx
);
39
}
40
41
//Actually, this class does any work only if you disable anti-aliasing, by default I have it on
42
//and there is nothing to do for a guard if you want it on.
43
44
//______________________________________________________________________________
45
CGAAStateGuard::CGAAStateGuard
(CGContextRef ctx,
bool
enable)
46
:
fCtx
(ctx),
47
fEnable(enable)
48
{
49
assert(ctx != 0 &&
"CGAAStateGuard, ctx parameter is null"
);
50
51
if
(!enable)
52
CGContextSetAllowsAntialiasing(ctx,
false
);
53
}
54
55
//______________________________________________________________________________
56
CGAAStateGuard::~CGAAStateGuard
()
57
{
58
//Enable it back:
59
if
(!
fEnable
)
60
CGContextSetAllowsAntialiasing(
fCtx
,
true
);
61
}
62
63
}
//Quartz
64
}
//ROOT
ROOT::Quartz::CGAAStateGuard::~CGAAStateGuard
~CGAAStateGuard()
Definition:
QuartzUtils.mm:56
ROOT
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition:
StringConv.hxx:21
ROOT::Quartz::CGStateGuard::CGStateGuard
CGStateGuard(MacOSX::Util::CFScopeGuard< CGContextRef > &ctx)
Definition:
QuartzUtils.mm:20
ROOT::MacOSX::Util::CFScopeGuard< CGContextRef >
QuartzUtils.h
ROOT::Quartz::CGStateGuard::fCtx
CGContextRef fCtx
Definition:
QuartzUtils.h:32
ROOT::Quartz::CGStateGuard::~CGStateGuard
~CGStateGuard()
Definition:
QuartzUtils.mm:36
ROOT::Quartz::CGAAStateGuard::fCtx
CGContextRef fCtx
Definition:
QuartzUtils.h:46
ROOT::Quartz::CGAAStateGuard::fEnable
bool fEnable
Definition:
QuartzUtils.h:47
ROOT::Quartz::CGAAStateGuard::CGAAStateGuard
CGAAStateGuard(CGContextRef ctx, bool enable)
Definition:
QuartzUtils.mm:45
ROOT::Quartz
Definition:
QuartzFillArea.h:41