void CEllipseContainer::Render(agg::rendering_buffer &buffer) { if (!m_vec.size()) { return; } agg::pixfmt_bgr24 pixfmt(buffer); typedef agg::renderer_base<agg::pixfmt_bgr24> renbase; typedef agg::renderer_scanline_aa_solid<renbase> render_solid; renbase rbase(pixfmt); render_solid renderSolid(rbase); rbase.clear(agg::rgba8(255, 255, 255)); agg::rasterizer_scanline_aa<> ras; for (EllipseIterator first = m_vec.begin(); first != m_vec.end(); ++first) { ras.add_path(*(*first)); } agg::path_storage line; CEllipseCtrl *ell = m_vec[0]; line.move_to(ell->GetBase().m_x, ell->GetBase().m_y); for(unsigned int i = 1; i < m_vec.size(); ++i) { ell = m_vec[i]; line.line_to(ell->GetBase().m_x, ell->GetBase().m_y); } agg::conv_stroke<agg::path_storage> strokeLine(line); strokeLine.width(1.0); ras.add_path(strokeLine); renderSolid.color(agg::rgba8(255, 0, 0)); agg::scanline_u8 sl; agg::render_scanlines(ras, sl, renderSolid); }
void SelectionScanlineSweeper::DrawImpl_rgb(agg::rect_d rect, RenderingData *data, unsigned int width, unsigned int height, int stride, agg::trans_affine const &mtx, agg::trans_affine const &viewport_mtx) { //ScanlineSource source(data); typedef agg::pixfmt_alpha_blend_rgb<agg::blender_rgb<agg::rgba8, agg::order_rgb>, agg::scanline_accessor> pixfmt_type; typedef pixfmt_type::color_type color_type; typedef color_type::value_type value_type; typedef agg::renderer_base<pixfmt_type> renderer_base; typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid; agg::rasterizer_scanline_aa<> l_rasterizer; agg::scanline_u8 l_scanline; //pixfmt_type pixfmt(agg::scanline_accessor(&source, ScanlineSource::get_scanline, width, height, stride)); pixfmt_type pixfmt((agg::scanline_accessor(data))); renderer_base rb(pixfmt); l_rasterizer.clip_box(0.0, 0.0, width, height); l_rasterizer.filling_rule(agg::fill_non_zero); if (flip_y) { mtx.transform(&rect.x1, &rect.y1); mtx.transform(&rect.x2, &rect.y2); } double vertexes[] = { rect.x1, rect.y2, rect.x1, rect.y1, rect.x2, rect.y1, rect.x2, rect.y2 }; agg::test_vertex_source vertex_source(vertexes, 4); agg::conv_transform<agg::test_vertex_source> vertex_source_converted(vertex_source, viewport_mtx); l_rasterizer.add_path(vertex_source_converted); renderer_solid r(rb); { r.color(color); agg::render_scanlines(l_rasterizer, l_scanline, r); } }
grid_vertex_adapter(PathType & path, T dx, T dy, box2d<T> box) : dx_(dx), dy_(dy), img_(create_bitmap(box)), vt_(img_.width(), img_.height(), box), si_(box.width() / dx, box.height() / dy) { transform_path<PathType, coord_type, view_transform> tp(path, vt_); tp.rewind(0); agg::rasterizer_scanline_aa<> ras; ras.add_path(tp); agg::rendering_buffer buf(img_.data(), img_.width(), img_.height(), img_.row_size()); agg::pixfmt_gray8 pixfmt(buf); using renderer_base = agg::renderer_base<agg::pixfmt_gray8>; using renderer_bin = agg::renderer_scanline_bin_solid<renderer_base>; renderer_base rb(pixfmt); renderer_bin ren_bin(rb); ren_bin.color(agg::gray8(1)); agg::scanline_bin sl_bin; agg::render_scanlines(ras, sl_bin, ren_bin); }
void ClipBuffer::intersectClipRect(transform_t const & transform, number_t x, number_t y, number_t width, number_t height) { #if defined(RENDERER_AGG) typedef agg::renderer_scanline_aa_solid<renderer_base_t> renderer_t; agg::rendering_buffer rbuf(&buffer_[0], width_, height_, width_); pixfmt_t pixfmt(rbuf); renderer_base_t renderer_base(pixfmt); agg::scanline_p8 scanline; agg::rasterizer_scanline_aa<> rasterizer; rasterizer.filling_rule(agg::fill_even_odd); rasterizer.move_to_d(0, 0); rasterizer.line_to_d(pixfmt.width(), 0); rasterizer.line_to_d(pixfmt.width(), pixfmt.height()); rasterizer.line_to_d(0, pixfmt.height()); rasterizer.close_polygon(); number_t px = x, py = y; transform.transform(&px, &py); rasterizer.move_to_d(px, py); px = x + width; py = y; transform.transform(&px, &py); rasterizer.line_to_d(px, py); px = x + width; py = y + height; transform.transform(&px, &py); rasterizer.line_to_d(px, py); px = x; py = y + height; transform.transform(&px, &py); rasterizer.line_to_d(px, py); rasterizer.close_polygon(); agg::render_scanlines_aa_solid(rasterizer, scanline, renderer_base, agg::gray8(0)); #elif defined(RENDERER_GDIPLUS) #endif }