SVG : add support for stroke-dashoffset
This commit is contained in:
parent
d3fc7f8fed
commit
0a5f006bb9
4 changed files with 17 additions and 3 deletions
|
@ -229,6 +229,10 @@ public:
|
|||
path_attributes& attr = cur_attr();
|
||||
attr.dash = std::move(dash);
|
||||
}
|
||||
void dash_offset(double offset)
|
||||
{
|
||||
cur_attr().dash_offset = offset;
|
||||
}
|
||||
void even_odd(bool flag)
|
||||
{
|
||||
cur_attr().even_odd_flag = flag;
|
||||
|
|
|
@ -58,6 +58,7 @@ struct path_attributes
|
|||
bool visibility_flag;
|
||||
bool display_flag;
|
||||
dash_array dash;
|
||||
double dash_offset;
|
||||
// Empty constructor
|
||||
path_attributes() :
|
||||
fill_gradient(),
|
||||
|
@ -80,7 +81,8 @@ struct path_attributes
|
|||
even_odd_flag(false),
|
||||
visibility_flag(true),
|
||||
display_flag(true),
|
||||
dash()
|
||||
dash(),
|
||||
dash_offset(0.0)
|
||||
{}
|
||||
|
||||
// Copy constructor
|
||||
|
@ -105,7 +107,8 @@ struct path_attributes
|
|||
even_odd_flag(attr.even_odd_flag),
|
||||
visibility_flag(attr.visibility_flag),
|
||||
display_flag(attr.display_flag),
|
||||
dash(attr.dash)
|
||||
dash(attr.dash),
|
||||
dash_offset(attr.dash_offset)
|
||||
{}
|
||||
// Copy constructor with new index value
|
||||
path_attributes(path_attributes const& attr, unsigned idx)
|
||||
|
@ -129,7 +132,8 @@ struct path_attributes
|
|||
even_odd_flag(attr.even_odd_flag),
|
||||
visibility_flag(attr.visibility_flag),
|
||||
display_flag(attr.display_flag),
|
||||
dash(attr.dash)
|
||||
dash(attr.dash),
|
||||
dash_offset(attr.dash_offset)
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
@ -335,6 +335,7 @@ public:
|
|||
{
|
||||
curved_dashed_.add_dash(std::get<0>(d),std::get<1>(d));
|
||||
}
|
||||
curved_dashed_.dash_start(attr.dash_offset);
|
||||
ras.add_path(curved_dashed_stroked_trans, attr.index);
|
||||
if (attr.stroke_gradient.get_gradient_type() != NO_GRADIENT)
|
||||
{
|
||||
|
|
|
@ -448,6 +448,11 @@ void parse_attr(svg_parser & parser, char const* name, char const* value )
|
|||
parser.path_.dash_array(std::move(dash));
|
||||
}
|
||||
}
|
||||
else if (std::strcmp(name,"stroke-dashoffset") == 0)
|
||||
{
|
||||
double offset = parse_double(parser.error_messages_, value);
|
||||
parser.path_.dash_offset(offset);
|
||||
}
|
||||
else if(std::strcmp(name, "opacity") == 0)
|
||||
{
|
||||
double opacity = parse_double(parser.error_messages_, value);
|
||||
|
|
Loading…
Reference in a new issue