Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
31b085c6
Commit
31b085c6
authored
Jul 15, 2014
by
tebjan
Committed by
Eric Domke
Jul 24, 2014
Browse files
fixed bug in rgb color parsing
parent
9e269139
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Painting/SvgColourConverter.cs
View file @
31b085c6
...
...
@@ -48,7 +48,22 @@ namespace Svg
{
//the alpha portion of the rgba is not an int 0-255 it is a decimal between 0 and 1
//so we have to determine the corosponding byte value
alphaValue
=
(
int
)(
decimal
.
Parse
(
values
[
3
])
*
255
);
var
alphastring
=
values
[
3
];
if
(
alphastring
.
StartsWith
(
"."
))
{
alphastring
=
"0"
+
alphastring
;
}
var
alphaDecimal
=
decimal
.
Parse
(
alphastring
);
if
(
alphaDecimal
<=
1
)
{
alphaValue
=
(
int
)(
alphaDecimal
*
255
);
}
else
{
alphaValue
=
(
int
)
alphaDecimal
;
}
}
Color
colorpart
=
System
.
Drawing
.
Color
.
FromArgb
(
alphaValue
,
int
.
Parse
(
values
[
0
]),
int
.
Parse
(
values
[
1
]),
int
.
Parse
(
values
[
2
]));
...
...
Write
Preview
Supports
Markdown
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