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
20f834ba
Commit
20f834ba
authored
Jul 22, 2014
by
Dan Backes
Browse files
Merge pull request #2 from articulate/ColorFix
Colors Fix, Perf Improvement, Thread Safety
parents
efd6005f
837e0963
Changes
3
Hide whitespace changes
Inline
Side-by-side
Source/Painting/SvgColourConverter.cs
View file @
20f834ba
...
...
@@ -115,7 +115,7 @@ namespace Svg
if
(
destinationType
==
typeof
(
string
))
{
var
colour
=
(
Color
)
value
;
return
ColorTranslator
.
ToHtml
(
colour
);
return
"#"
+
colour
.
R
.
ToString
(
"X2"
,
null
)
+
colour
.
G
.
ToString
(
"X2"
,
null
)
+
colour
.
B
.
ToString
(
"X2"
,
null
);
}
return
base
.
ConvertTo
(
context
,
culture
,
value
,
destinationType
);
...
...
Source/Paths/SvgPathBuilder.cs
View file @
20f834ba
...
...
@@ -276,7 +276,7 @@ namespace Svg
private
static
IEnumerable
<
float
>
ParseCoordinates
(
string
coords
)
{
var
parts
=
Regex
.
Split
(
coords
.
Remove
(
0
,
1
),
@"[\s,]|(?=(?<!e)-)"
);
var
parts
=
Regex
.
Split
(
coords
.
Remove
(
0
,
1
),
@"[\s,]|(?=(?<!e)-)"
,
RegexOptions
.
Compiled
);
for
(
int
i
=
0
;
i
<
parts
.
Length
;
i
++)
{
...
...
Source/SvgElementFactory.cs
View file @
20f834ba
...
...
@@ -157,30 +157,34 @@ namespace Svg
}
private
static
Dictionary
<
Type
,
Dictionary
<
string
,
PropertyDescriptorCollection
>>
_propertyDescriptors
=
new
Dictionary
<
Type
,
Dictionary
<
string
,
PropertyDescriptorCollection
>>();
private
static
object
syncLock
=
new
object
();
private
static
void
SetPropertyValue
(
SvgElement
element
,
string
attributeName
,
string
attributeValue
,
SvgDocument
document
)
{
var
elementType
=
element
.
GetType
();
PropertyDescriptorCollection
properties
;
if
(
_propertyDescriptors
.
Keys
.
Contains
(
elementType
)
)
lock
(
syncLock
)
{
if
(
_propertyDescriptors
[
elementType
]
.
Keys
.
Contains
(
attributeNam
e
))
if
(
_propertyDescriptors
.
Keys
.
Contains
(
elementTyp
e
))
{
properties
=
_propertyDescriptors
[
elementType
][
attributeName
];
if
(
_propertyDescriptors
[
elementType
].
Keys
.
Contains
(
attributeName
))
{
properties
=
_propertyDescriptors
[
elementType
][
attributeName
];
}
else
{
properties
=
TypeDescriptor
.
GetProperties
(
elementType
,
new
[]
{
new
SvgAttributeAttribute
(
attributeName
)
});
_propertyDescriptors
[
elementType
].
Add
(
attributeName
,
properties
);
}
}
else
{
properties
=
TypeDescriptor
.
GetProperties
(
elementType
,
new
[]
{
new
SvgAttributeAttribute
(
attributeName
)
});
_propertyDescriptors
[
elementType
].
Add
(
attributeName
,
properties
);
}
}
else
{
properties
=
TypeDescriptor
.
GetProperties
(
elementType
,
new
[]
{
new
SvgAttributeAttribute
(
attributeName
)
});
_propertyDescriptors
.
Add
(
elementType
,
new
Dictionary
<
string
,
PropertyDescriptorCollection
>());
_propertyDescriptors
.
Add
(
elementType
,
new
Dictionary
<
string
,
PropertyDescriptorCollection
>());
_propertyDescriptors
[
elementType
].
Add
(
attributeName
,
properties
);
_propertyDescriptors
[
elementType
].
Add
(
attributeName
,
properties
);
}
}
if
(
properties
.
Count
>
0
)
...
...
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