@@ -279,6 +279,36 @@ namespace CPPAGGRenderer{
279279 agg::render_scanlines (m_ras, m_sl_p8, ren_aa);
280280 }
281281
282+ void draw_solid_rect_with_border (const float *x, const float *y, float thickness, float r_fill, float g_fill, float b_fill, float a_fill, float r_stroke, float g_stroke, float b_stroke, float a_stroke){
283+ agg::rendering_buffer rbuf = agg::rendering_buffer (buffer, frame_width, frame_height, -frame_width*3 );
284+ pixfmt pixf = pixfmt (rbuf);
285+ renderer_base rb = renderer_base (pixf);
286+ ren_aa = renderer_aa (rb);
287+ pixfmt_pre pixf_pre (rbuf);
288+ renderer_base_pre rb_pre (pixf_pre);
289+ agg::path_storage rect_path;
290+ rect_path.move_to (*x, *y);
291+ for (int i = 1 ; i < 4 ; i++) {
292+ rect_path.line_to (*(x+i),*(y+i));
293+ }
294+ rect_path.close_polygon ();
295+ agg::trans_affine matrix;
296+ matrix *= agg::trans_affine_translation (0 , 0 );
297+ agg::conv_transform<agg::path_storage, agg::trans_affine> trans (rect_path, matrix);
298+ Color c1 (r_fill, g_fill, b_fill, a_fill);
299+ m_ras.add_path (trans);
300+ ren_aa.color (c1);
301+ agg::render_scanlines (m_ras, m_sl_p8, ren_aa);
302+ agg::conv_curve<agg::conv_transform<agg::path_storage, agg::trans_affine>> curve (trans);
303+ agg::conv_stroke<agg::conv_curve<agg::conv_transform<agg::path_storage, agg::trans_affine>>> stroke (curve);
304+ stroke.width (thickness);
305+ m_ras.add_path (stroke);
306+ Color c2 (r_stroke, g_stroke, b_stroke, a_stroke);
307+ ren_aa.color (c2);
308+ agg::render_scanlines (m_ras, m_sl_p8, ren_aa);
309+
310+ }
311+
282312 void draw_solid_circle (float cx, float cy, float radius, float r, float g, float b, float a) {
283313 agg::rendering_buffer rbuf = agg::rendering_buffer (buffer, frame_width, frame_height, -frame_width*3 );
284314 pixfmt pixf = pixfmt (rbuf);
@@ -499,6 +529,11 @@ namespace CPPAGGRenderer{
499529 plot -> draw_solid_rect (x, y, r, g, b, a, hatch_pattern);
500530 }
501531
532+ void draw_solid_rect_with_border (const float *x, const float *y, float thickness, float r_fill, float g_fill, float b_fill, float a_fill, float r_stroke, float g_stroke, float b_stroke, float a_stroke, const void *object){
533+ Plot *plot = (Plot *)object;
534+ plot -> draw_solid_rect_with_border (x, y, thickness, r_fill, g_fill, b_fill, a_fill, r_stroke, g_stroke, b_stroke, a_stroke);
535+ }
536+
502537 void draw_solid_circle (float cx, float cy, float radius, float r, float g, float b, float a, const void *object){
503538 Plot *plot = (Plot *)object;
504539 plot -> draw_solid_circle (cx, cy, radius, r, g, b, a);
0 commit comments