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
76cf593c
"Tests/vscode:/vscode.git/clone" did not exist on "bd05ecbc09d303b5b23689a7f90c1a5cb110d068"
Commit
76cf593c
authored
Jul 15, 2014
by
tebjan
Browse files
fixed bug in rgb color parsing
parent
2462bf13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/Painting/SvgColourConverter.cs
View file @
76cf593c
...
...
@@ -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