Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
7d4aed10
Commit
7d4aed10
authored
Sep 11, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed COLOR4D( EDA_COLOR_T aColor ) and added asserts.
parent
6d151312
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
color4d.cpp
common/gal/color4d.cpp
+3
-3
color4d.h
include/gal/color4d.h
+13
-0
No files found.
common/gal/color4d.cpp
View file @
7d4aed10
...
@@ -30,9 +30,9 @@ using namespace KiGfx;
...
@@ -30,9 +30,9 @@ using namespace KiGfx;
COLOR4D
::
COLOR4D
(
EDA_COLOR_T
aColor
)
COLOR4D
::
COLOR4D
(
EDA_COLOR_T
aColor
)
{
{
r
=
g_ColorRefs
[
aColor
].
m_Red
;
r
=
g_ColorRefs
[
aColor
].
m_Red
/
255.0
;
g
=
g_ColorRefs
[
aColor
].
m_Green
;
g
=
g_ColorRefs
[
aColor
].
m_Green
/
255.0
;
b
=
g_ColorRefs
[
aColor
].
m_Blue
;
b
=
g_ColorRefs
[
aColor
].
m_Blue
/
255.0
;
a
=
1.0
;
a
=
1.0
;
}
}
...
...
include/gal/color4d.h
View file @
7d4aed10
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#define COLOR4D_H_
#define COLOR4D_H_
#include <colors.h>
#include <colors.h>
#include <cassert>
namespace
KiGfx
namespace
KiGfx
{
{
...
@@ -55,6 +56,10 @@ public:
...
@@ -55,6 +56,10 @@ public:
COLOR4D
(
double
aRed
,
double
aGreen
,
double
aBlue
,
double
aAlpha
)
:
COLOR4D
(
double
aRed
,
double
aGreen
,
double
aBlue
,
double
aAlpha
)
:
r
(
aRed
),
g
(
aGreen
),
b
(
aBlue
),
a
(
aAlpha
)
r
(
aRed
),
g
(
aGreen
),
b
(
aBlue
),
a
(
aAlpha
)
{
{
assert
(
r
>=
0
.
0
&&
r
<=
1
.
0
);
assert
(
g
>=
0
.
0
&&
g
<=
1
.
0
);
assert
(
b
>=
0
.
0
&&
b
<=
1
.
0
);
assert
(
a
>=
0
.
0
&&
a
<=
1
.
0
);
}
}
/**
/**
...
@@ -82,6 +87,8 @@ public:
...
@@ -82,6 +87,8 @@ public:
*/
*/
COLOR4D
&
Brighten
(
double
aFactor
)
COLOR4D
&
Brighten
(
double
aFactor
)
{
{
assert
(
aFactor
>=
0
.
0
&&
aFactor
<=
1
.
0
);
r
=
r
*
(
1
.
0
-
aFactor
)
+
aFactor
;
r
=
r
*
(
1
.
0
-
aFactor
)
+
aFactor
;
g
=
g
*
(
1
.
0
-
aFactor
)
+
aFactor
;
g
=
g
*
(
1
.
0
-
aFactor
)
+
aFactor
;
b
=
b
*
(
1
.
0
-
aFactor
)
+
aFactor
;
b
=
b
*
(
1
.
0
-
aFactor
)
+
aFactor
;
...
@@ -97,6 +104,8 @@ public:
...
@@ -97,6 +104,8 @@ public:
*/
*/
COLOR4D
&
Darken
(
double
aFactor
)
COLOR4D
&
Darken
(
double
aFactor
)
{
{
assert
(
aFactor
>=
0
.
0
&&
aFactor
<=
1
.
0
);
r
=
r
*
(
1
.
0
-
aFactor
);
r
=
r
*
(
1
.
0
-
aFactor
);
g
=
g
*
(
1
.
0
-
aFactor
);
g
=
g
*
(
1
.
0
-
aFactor
);
b
=
b
*
(
1
.
0
-
aFactor
);
b
=
b
*
(
1
.
0
-
aFactor
);
...
@@ -126,6 +135,8 @@ public:
...
@@ -126,6 +135,8 @@ public:
*/
*/
COLOR4D
Brightened
(
double
aFactor
)
const
COLOR4D
Brightened
(
double
aFactor
)
const
{
{
assert
(
aFactor
>=
0
.
0
&&
aFactor
<=
1
.
0
);
return
COLOR4D
(
r
*
(
1
.
0
-
aFactor
)
+
aFactor
,
return
COLOR4D
(
r
*
(
1
.
0
-
aFactor
)
+
aFactor
,
g
*
(
1
.
0
-
aFactor
)
+
aFactor
,
g
*
(
1
.
0
-
aFactor
)
+
aFactor
,
b
*
(
1
.
0
-
aFactor
)
+
aFactor
,
b
*
(
1
.
0
-
aFactor
)
+
aFactor
,
...
@@ -140,6 +151,8 @@ public:
...
@@ -140,6 +151,8 @@ public:
*/
*/
COLOR4D
Darkened
(
double
aFactor
)
const
COLOR4D
Darkened
(
double
aFactor
)
const
{
{
assert
(
aFactor
>=
0
.
0
&&
aFactor
<=
1
.
0
);
return
COLOR4D
(
r
*
(
1
.
0
-
aFactor
),
return
COLOR4D
(
r
*
(
1
.
0
-
aFactor
),
g
*
(
1
.
0
-
aFactor
),
g
*
(
1
.
0
-
aFactor
),
b
*
(
1
.
0
-
aFactor
),
b
*
(
1
.
0
-
aFactor
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment