Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
4ac4abb1
Commit
4ac4abb1
authored
11 years ago
by
Timur Pocheptsov
Browse files
Options
Downloads
Patches
Plain Diff
Update a grad2.C tutorial to use TLinearGradient.
parent
cf3791ac
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
graf2d/quartz/src/QuartzFillArea.mm
+3
-6
3 additions, 6 deletions
graf2d/quartz/src/QuartzFillArea.mm
tutorials/cocoa/grad2.C
+11
-4
11 additions, 4 deletions
tutorials/cocoa/grad2.C
with
14 additions
and
10 deletions
graf2d/quartz/src/QuartzFillArea.mm
+
3
−
6
View file @
4ac4abb1
...
...
@@ -369,13 +369,10 @@ void CalculateGradientPoints(const TColorGradient *extendedColor, const CGSize &
//TODO: that's stupid, but ... radial can iherit linear to make things easier :)
if
(
const
TLinearGradient
*
const
lGrad
=
dynamic_cast
<
const
TLinearGradient
*>
(
extendedColor
))
{
start
=
CGPointMake
(
lGrad
->
GetStartPoint
().
fX
,
lGrad
->
GetStartPoint
().
fY
);
end
.
x
=
lGrad
->
GetEndPoint
().
fX
;
end
.
y
=
lGrad
->
GetEndPoint
().
fY
;
end
=
CGPointMake
(
lGrad
->
GetEndPoint
().
fX
,
lGrad
->
GetEndPoint
().
fY
);
}
else
if
(
const
TRadialGradient
*
const
rGrad
=
dynamic_cast
<
const
TRadialGradient
*>
(
extendedColor
))
{
start
.
x
=
rGrad
->
GetStartPoint
().
fX
;
start
.
y
=
rGrad
->
GetStartPoint
().
fY
;
end
.
x
=
rGrad
->
GetEndPoint
().
fX
;
end
.
y
=
rGrad
->
GetEndPoint
().
fY
;
start
=
CGPointMake
(
rGrad
->
GetStartPoint
().
fX
,
rGrad
->
GetStartPoint
().
fY
);
end
=
CGPointMake
(
rGrad
->
GetEndPoint
().
fX
,
rGrad
->
GetEndPoint
().
fY
);
}
if
(
mode
==
TColorGradient
::
kObjectBoundingMode
)
{
...
...
This diff is collapsed.
Click to expand it.
tutorials/cocoa/grad2.C
+
11
−
4
View file @
4ac4abb1
...
...
@@ -43,15 +43,22 @@ void grad2()
// b) Gradient (from our semi-transparent red to ROOT's kOrange).
const
Double_t
locations
[]
=
{
0
.,
1
.};
const
Color_t
idx1
[]
=
{
kOrange
,
customRed
};
new
TColorGradient
(
grad1
,
TColorGradient
::
kGDVertical
,
2
,
locations
,
idx1
);
const
Color_t
idx1
[]
=
{
customRed
,
kOrange
};
TLinearGradient
*
const
gradFill1
=
new
TLinearGradient
(
grad1
,
2
,
locations
,
idx1
);
typedef
TColorGradient
::
GradientPoint
point_type
;
//Starting and ending points for a gradient fill (it's a vertical gradient):
gradFill1
->
SetStartEnd
(
point_type
(
0
.,
0
.),
point_type
(
0
.,
1
));
// c) Custom semi-transparent green.
new
TColor
(
customGreen
,
0
.,
1
.,
0
.,
"green"
,
0
.
5
);
// d) Gradient from ROOT's kBlue to our custom green.
const
Color_t
idx2
[]
=
{
kBlue
,
customGreen
};
new
TColorGradient
(
grad2
,
TColorGradient
::
kGDVertical
,
2
,
locations
,
idx2
);
const
Color_t
idx2
[]
=
{
customGreen
,
kBlue
};
TLinearGradient
*
const
gradFill2
=
new
TLinearGradient
(
grad2
,
2
,
locations
,
idx2
);
//Vertical gradient fill.
gradFill2
->
SetStartEnd
(
point_type
(
0
.,
0
),
point_type
(
0
.,
1
.));
TH1F
*
hist
=
new
TH1F
(
"a2"
,
"b2"
,
10
,
-
2
.,
3
.);
TH1F
*
hist2
=
new
TH1F
(
"c3"
,
"d3"
,
10
,
-
3
.,
3
.);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment