+ add dash_offset

This commit is contained in:
Artem Pavlenko 2010-04-09 18:46:41 +00:00
parent ca20f80ea8
commit f776f8cd1e

View file

@ -55,15 +55,17 @@ namespace mapnik
opacity_(1.0),
line_cap_(BUTT_CAP),
line_join_(MITER_JOIN),
dash_() {}
dash_(),
dash_offset_(0) {}
stroke::stroke(color const& c, float width)
stroke::stroke(color const& c, double width)
: c_(c),
width_(width),
opacity_(1.0),
line_cap_(BUTT_CAP),
line_join_(MITER_JOIN),
dash_() {}
dash_(),
dash_offset_(0.0) {}
stroke::stroke(stroke const& other)
: c_(other.c_),
@ -71,7 +73,8 @@ namespace mapnik
opacity_(other.opacity_),
line_cap_(other.line_cap_),
line_join_(other.line_join_),
dash_(other.dash_) {}
dash_(other.dash_),
dash_offset_(other.dash_offset_) {}
stroke & stroke::operator=(const stroke& rhs)
{
@ -90,23 +93,23 @@ namespace mapnik
return c_;
}
float stroke::get_width() const
double stroke::get_width() const
{
return width_;
}
void stroke::set_width(float w)
void stroke::set_width(double w)
{
width_=w;
}
void stroke::set_opacity(float opacity)
void stroke::set_opacity(double opacity)
{
if (opacity > 1.0) opacity_=1.0;
else if (opacity < 0.0) opacity_=0.0;
else opacity_=opacity;
}
float stroke::get_opacity() const
double stroke::get_opacity() const
{
return opacity_;
}
@ -131,15 +134,26 @@ namespace mapnik
return line_join_;
}
void stroke::add_dash(float dash,float gap)
void stroke::add_dash(double dash, double gap)
{
dash_.push_back(std::make_pair(dash,gap));
}
bool stroke::has_dash() const
{
return ! dash_.empty();
}
void stroke::set_dash_offset(double offset)
{
dash_offset_ = offset;
}
double stroke::dash_offset() const
{
return dash_offset_;
}
dash_array const& stroke::get_dash_array() const
{
return dash_;