Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
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
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
3d9fa924
Commit
3d9fa924
authored
13 years ago
by
Corentin Carton De Wiart
Browse files
Options
Downloads
Patches
Plain Diff
New colormap
parent
4b35d709
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Post/ColorTable.cpp
+38
-16
38 additions, 16 deletions
Post/ColorTable.cpp
with
38 additions
and
16 deletions
Post/ColorTable.cpp
+
38
−
16
View file @
3d9fa924
...
@@ -95,15 +95,15 @@ void ColorTable_Recompute(GmshColorTable * ct)
...
@@ -95,15 +95,15 @@ void ColorTable_Recompute(GmshColorTable * ct)
double
ii
=
(
double
)(
s
-
bias
)
*
128.
;
double
ii
=
(
double
)(
s
-
bias
)
*
128.
;
if
(
ii
<
0
)
ii
=
0
;
if
(
ii
<
0
)
ii
=
0
;
if
(
ii
>
128
)
ii
=
128
;
if
(
ii
>
128
)
ii
=
128
;
double
rr
=
double
rr
=
ii
<=
46
?
0.
:
ii
<=
46
?
0.
:
ii
>=
111
?
-
0.03125
*
(
ii
-
111
)
+
1.
:
ii
>=
111
?
-
0.03125
*
(
ii
-
111
)
+
1.
:
ii
>=
78
?
1.
:
ii
>=
78
?
1.
:
0.03125
*
(
ii
-
46
);
0.03125
*
(
ii
-
46
);
double
gg
=
double
gg
=
ii
<=
14
||
ii
>=
111
?
0.
:
ii
<=
14
||
ii
>=
111
?
0.
:
ii
>=
79
?
-
0.03125
*
(
ii
-
111
)
:
ii
>=
79
?
-
0.03125
*
(
ii
-
111
)
:
ii
<=
46
?
0.03125
*
(
ii
-
14
)
:
ii
<=
46
?
0.03125
*
(
ii
-
14
)
:
1.
;
1.
;
double
bb
=
double
bb
=
ii
>=
79
?
0.
:
ii
>=
79
?
0.
:
...
@@ -246,8 +246,30 @@ void ColorTable_Recompute(GmshColorTable * ct)
...
@@ -246,8 +246,30 @@ void ColorTable_Recompute(GmshColorTable * ct)
r
=
g
=
b
=
(
int
)(
255
*
(
1.
-
curvature
));
r
=
g
=
b
=
(
int
)(
255
*
(
1.
-
curvature
));
}
}
break
;
break
;
case
10
:
// all white
case
10
:
// "french flag"
r
=
g
=
b
=
255
;
{
double
ii
=
(
double
)(
s
-
bias
);
if
(
ii
<
0
)
ii
=
0
;
if
(
ii
>
1
)
ii
=
1
;
double
rr
=
ii
>=
.75
?
2
*
(
0.75
-
ii
)
+
1.
:
ii
>=
.5
?
1.
:
ii
>=
.25
?
4.
*
(
ii
-
0.25
)
:
0.
;
double
gg
=
ii
<=
.25
?
1.33333
*
ii
:
ii
<=
.5
?
0.33333
+
2.66667
*
(
ii
-
0.25
)
:
ii
<=
.75
?
1
-
2.66667
*
(
ii
-
0.5
)
:
1.33333
*
(
1.
-
ii
);
double
bb
=
ii
<=
0.25
?
2
*
ii
+
0.5
:
ii
<=
0.5
?
1.
:
ii
<=
0.75
?
4
*
(
0.75
-
ii
)
:
0.
;
r
=
(
int
)(
rr
*
255.
);
g
=
(
int
)(
gg
*
255.
);
b
=
(
int
)(
bb
*
255.
);
}
break
;
break
;
case
11
:
// matlab "hsv"
case
11
:
// matlab "hsv"
{
{
...
@@ -321,7 +343,7 @@ void ColorTable_Recompute(GmshColorTable * ct)
...
@@ -321,7 +343,7 @@ void ColorTable_Recompute(GmshColorTable * ct)
g
=
(
int
)(
255.
*
pow
((
double
)
g
/
255.
,
gamma
));
g
=
(
int
)(
255.
*
pow
((
double
)
g
/
255.
,
gamma
));
b
=
(
int
)(
255.
*
pow
((
double
)
b
/
255.
,
gamma
));
b
=
(
int
)(
255.
*
pow
((
double
)
b
/
255.
,
gamma
));
}
}
if
(
ct
->
ipar
[
COLORTABLE_INVERT
])
{
if
(
ct
->
ipar
[
COLORTABLE_INVERT
])
{
r
=
255
-
r
;
r
=
255
-
r
;
g
=
255
-
g
;
g
=
255
-
g
;
...
@@ -333,7 +355,7 @@ void ColorTable_Recompute(GmshColorTable * ct)
...
@@ -333,7 +355,7 @@ void ColorTable_Recompute(GmshColorTable * ct)
g
=
g
<
0
?
0
:
(
g
>
255
?
255
:
g
);
g
=
g
<
0
?
0
:
(
g
>
255
?
255
:
g
);
b
=
b
<
0
?
0
:
(
b
>
255
?
255
:
b
);
b
=
b
<
0
?
0
:
(
b
>
255
?
255
:
b
);
a
=
a
<
0
?
0
:
(
a
>
255
?
255
:
a
);
a
=
a
<
0
?
0
:
(
a
>
255
?
255
:
a
);
ct
->
table
[
i
]
=
CTX
::
instance
()
->
packColor
(
r
,
g
,
b
,
a
);
ct
->
table
[
i
]
=
CTX
::
instance
()
->
packColor
(
r
,
g
,
b
,
a
);
}
}
...
@@ -407,14 +429,14 @@ int ColorTable_IsAlpha(GmshColorTable * ct)
...
@@ -407,14 +429,14 @@ int ColorTable_IsAlpha(GmshColorTable * ct)
// HSV/RBG conversion routines
// HSV/RBG conversion routines
void
HSV_to_RGB
(
double
H
,
double
S
,
double
V
,
void
HSV_to_RGB
(
double
H
,
double
S
,
double
V
,
double
*
R
,
double
*
G
,
double
*
B
)
double
*
R
,
double
*
G
,
double
*
B
)
{
{
if
(
S
<
5.0e-6
)
{
if
(
S
<
5.0e-6
)
{
*
R
=
*
G
=
*
B
=
V
;
*
R
=
*
G
=
*
B
=
V
;
}
}
else
{
else
{
int
i
=
(
int
)
H
;
int
i
=
(
int
)
H
;
double
f
=
H
-
(
float
)
i
;
double
f
=
H
-
(
float
)
i
;
double
p1
=
V
*
(
1.0
-
S
);
double
p1
=
V
*
(
1.0
-
S
);
double
p2
=
V
*
(
1.0
-
S
*
f
);
double
p2
=
V
*
(
1.0
-
S
*
f
);
...
@@ -430,8 +452,8 @@ void HSV_to_RGB(double H, double S, double V,
...
@@ -430,8 +452,8 @@ void HSV_to_RGB(double H, double S, double V,
}
}
}
}
void
RGB_to_HSV
(
double
R
,
double
G
,
double
B
,
void
RGB_to_HSV
(
double
R
,
double
G
,
double
B
,
double
*
H
,
double
*
S
,
double
*
V
)
double
*
H
,
double
*
S
,
double
*
V
)
{
{
double
maxv
=
R
>
G
?
R
:
G
;
if
(
B
>
maxv
)
maxv
=
B
;
double
maxv
=
R
>
G
?
R
:
G
;
if
(
B
>
maxv
)
maxv
=
B
;
*
V
=
maxv
;
*
V
=
maxv
;
...
...
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