author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年07月03日 23:12:30 +0200 |
---|---|---|
committer | unknown <Maria@abbate-95206d9a.(none)> | 2012年07月03日 23:12:30 +0200 |
commit | 639c8880bab5c8ea792c773c5aa11216802411a6 (patch) | |
tree | 4e2c4bb65e8d209fefe724e51a07353a59cc1e3d /agg-plot/canvas.h | |
parent | 54816985901c2bfc286a33cd549c3aa20cd556bd (diff) | |
download | gsl-shell-639c8880bab5c8ea792c773c5aa11216802411a6.tar.gz |
-rw-r--r-- | agg-plot/canvas.h | 43 |
diff --git a/agg-plot/canvas.h b/agg-plot/canvas.h index 27fe7725..6b780e7d 100644 --- a/agg-plot/canvas.h +++ b/agg-plot/canvas.h @@ -66,23 +66,31 @@ public: void reset_clipping() { this->rb.reset_clipping(true); }; + template <class VertexSource> + void draw_solid(VertexSource& vs, agg::rgba8 c) + { + this->ras.add_path(vs); + this->rs.color(c); + agg::render_scanlines(this->ras, this->sl, this->rs); + } + + template <class VertexSource> + void draw_solid_subpixel(VertexSource& vs, agg::rgba8 c) + { + agg::trans_affine_scaling subpixel_mtx(double(subpixel_scale), 1.0); + agg::conv_transform<VertexSource> trans(vs, subpixel_mtx); + this->ras.add_path(trans); + this->rs_subpixel.color(c); + agg::render_scanlines(this->ras, this->sl, this->rs_subpixel); + } + void draw(sg_object& vs, agg::rgba8 c) { if (vs.use_subpixel()) - { - agg::trans_affine_scaling subpixel_mtx(double(subpixel_scale), 1.0); - agg::conv_transform<sg_object> trans(vs, subpixel_mtx); - this->ras.add_path(trans); - this->rs_subpixel.color(c); - agg::render_scanlines(this->ras, this->sl, this->rs_subpixel); - } + draw_solid_subpixel(vs, c); else - { - this->ras.add_path(vs); - this->rs.color(c); - agg::render_scanlines(this->ras, this->sl, this->rs); - } - }; + draw_solid(vs, c); + } void draw_outline(sg_object& vs, agg::rgba8 c) { @@ -90,10 +98,11 @@ public: line.width(Pixel::line_width / 100.0); line.line_cap(agg::round_cap); - this->ras.add_path(line); - this->rs.color(c); - agg::render_scanlines(this->ras, this->sl, this->rs); - }; + if (vs.use_subpixel()) + draw_solid_subpixel(line, c); + else + draw_solid(line, c); + } }; struct virtual_canvas { |