line renderer

This commit is contained in:
p989 2009-07-09 15:11:48 +00:00
parent 7459a4a0db
commit 082b8a1e92
2 changed files with 27 additions and 0 deletions

View File

@ -214,6 +214,8 @@ void AGGDraw() {
aggDraw.target->set_font("verdana18_bold");
aggDraw.target->set_color(255, 0, 255, 255);
aggDraw.target->render_text(60,60, "testing testing testing");
aggDraw.target->line(60, 90, 100, 100, 4);
//
//agg_draw_line_pattern(64, 19, 14, 126, 118, 266, 19, 265, .76, 4.69, "C:\\7.bmp");
}

View File

@ -35,6 +35,9 @@
#include "agg_renderer_scanline.h"
#include "agg_bounding_rect.h"
#include "agg_renderer_mclip.h"
#include "agg_renderer_outline_aa.h"
class AggDrawTarget
{
public:
@ -49,6 +52,7 @@ public:
virtual void solid_ellipse(int x, int y, int rx, int ry) = 0;
virtual void solid_rectangle(int x1, int y1, int x2, int y2) = 0;
virtual void solid_triangle(int x1, int y1, int x2, int y2, int x3, int y3) = 0;
virtual void line(int x1, int y1, int x2, int y2, double w) = 0;
static const agg::int8u* lookupFont(const std::string& name);
};
@ -158,6 +162,27 @@ public:
agg::render_scanlines(m_ras, m_sl_p8, ren_aa);
}
virtual void line(int x1, int y1, int x2, int y2, double w){
agg::line_profile_aa profile;
profile.width(w);
typedef agg::renderer_mclip<pixfmt> base_ren_type;
typedef agg::renderer_outline_aa<base_ren_type> renderer_type;
base_ren_type r(pixf);
renderer_type ren(r, profile);
agg::rasterizer_outline_aa<renderer_type> ras(ren);
ras.round_cap(true);
ren.color(renderState.color);
ras.move_to_d(x1, y1);
ras.line_to_d(x2, y2);
ras.render(false);
}
};