• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ agg::trans_affine类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中agg::trans_affine的典型用法代码示例。如果您正苦于以下问题:C++ trans_affine类的具体用法?C++ trans_affine怎么用?C++ trans_affine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了trans_affine类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: render_raster_marker

void render_raster_marker(RendererType ren,
                          RasterizerType & ras,
                          image_data_rgba8 & src,
                          mapnik::feature_impl const& feature,
                          agg::trans_affine const& marker_tr,
                          double opacity)
{
    using color_type = typename RendererType::color_type;
    agg::scanline_bin sl;
    double width  = src.width();
    double height = src.height();
    double p[8];
    p[0] = 0;     p[1] = 0;
    p[2] = width; p[3] = 0;
    p[4] = width; p[5] = height;
    p[6] = 0;     p[7] = height;
    marker_tr.transform(&p[0], &p[1]);
    marker_tr.transform(&p[2], &p[3]);
    marker_tr.transform(&p[4], &p[5]);
    marker_tr.transform(&p[6], &p[7]);
    ras.move_to_d(p[0],p[1]);
    ras.line_to_d(p[2],p[3]);
    ras.line_to_d(p[4],p[5]);
    ras.line_to_d(p[6],p[7]);
    ren.color(color_type(feature.id()));
    agg::render_scanlines(ras, sl, ren);
}
开发者ID:NavtechInc,项目名称:mapnik,代码行数:27,代码来源:grid_render_marker.hpp


示例2: init

box2d<T>::box2d(const box2d_type &rhs, const agg::trans_affine& tr)
{
    double x0 = rhs.minx_, y0 = rhs.miny_;
    double x1 = rhs.maxx_, y1 = rhs.miny_;
    double x2 = rhs.maxx_, y2 = rhs.maxy_;
    double x3 = rhs.minx_, y3 = rhs.maxy_;
    tr.transform(&x0, &y0);
    tr.transform(&x1, &y1);
    tr.transform(&x2, &y2);
    tr.transform(&x3, &y3);
    init(x0, y0, x2, y2);
    expand_to_include(x1, y1);
    expand_to_include(x3, y3);
}
开发者ID:chillycher,项目名称:mapnik,代码行数:14,代码来源:box2d.cpp


示例3: only_translation

    bool only_translation(agg::trans_affine& mat, double epsilon)
    {
        double temp[6];
        mat.store_to(temp);
		return (f_eq(temp[0], 1.0) && f_eq(temp[1], 0.0) &&
				f_eq(temp[2], 0.0) && f_eq(temp[3], 1.0));
    }
开发者ID:pib,项目名称:enable,代码行数:7,代码来源:kiva_affine_helpers.cpp


示例4: get_translation

 void get_translation(agg::trans_affine& m, double* tx, double* ty)
 {
     double temp[6];
     m.store_to(temp);
     *tx = temp[4];
     *ty = temp[5];
 }
开发者ID:pib,项目名称:enable,代码行数:7,代码来源:kiva_affine_helpers.cpp


示例5: add_image

void cairo_context::add_image(agg::trans_affine const& tr, image_rgba8 const& data, double opacity)
{
    cairo_pattern pattern(data);
    if (!tr.is_identity())
    {
        double m[6];
        tr.store_to(m);
        cairo_matrix_t cairo_matrix;
        cairo_matrix_init(&cairo_matrix,m[0],m[1],m[2],m[3],m[4],m[5]);
        cairo_matrix_invert(&cairo_matrix);
        pattern.set_matrix(cairo_matrix);
    }
    cairo_save(cairo_.get());
    cairo_set_source(cairo_.get(), const_cast<cairo_pattern_t*>(pattern.pattern()));
    cairo_paint_with_alpha(cairo_.get(), opacity);
    cairo_restore(cairo_.get());
    check_object_status_and_throw_exception(*this);
}
开发者ID:lightmare,项目名称:mapnik,代码行数:18,代码来源:cairo_context.cpp


示例6: get_scale

 void get_scale(agg::trans_affine& m, double* dx, double* dy)
 {
     {
         double temp[6];
         m.store_to(temp);
         *dx = temp[0];
         *dy = temp[3];
     }
 }
开发者ID:pib,项目名称:enable,代码行数:9,代码来源:kiva_affine_helpers.cpp


示例7: trans_affine_compose

void
trans_affine_compose(agg::trans_affine& a, const agg::trans_affine& b)
{
    double a_tx = a.tx, a_ty = a.ty;

    a.premultiply(b);

    a.tx = b.sx  * a_tx + b.shx * a_ty + b.tx;
    a.ty = b.shy * a_tx + b.sy  * a_ty + b.ty;
}
开发者ID:franko,项目名称:regress-pro,代码行数:10,代码来源:utils.cpp


示例8: is_identity

    bool is_identity(agg::trans_affine& mat, double epsilon)
    {
        double temp[6];
        mat.store_to(temp);
		return (f_eq(temp[0], 1.0) && f_eq(temp[1], 0.0) &&
				f_eq(temp[2], 0.0) && f_eq(temp[3], 1.0) &&
				f_eq(temp[4], 0.0) && f_eq(temp[5], 0.0));
//        return (temp[0] == 1.0 && temp[1] == 0.0 &&
//                temp[2] == 0.0 && temp[3] == 1.0 &&
//                temp[4] == 0.0 && temp[5] == 0.0);

    }
开发者ID:pib,项目名称:enable,代码行数:12,代码来源:kiva_affine_helpers.cpp


示例9: render_raster_marker

 void render_raster_marker(agg::trans_affine const& marker_tr)
 {
     double width  = src_.width();
     double height = src_.height();
     double p[8];
     p[0] = 0;     p[1] = 0;
     p[2] = width; p[3] = 0;
     p[4] = width; p[5] = height;
     p[6] = 0;     p[7] = height;
     marker_tr.transform(&p[0], &p[1]);
     marker_tr.transform(&p[2], &p[3]);
     marker_tr.transform(&p[4], &p[5]);
     marker_tr.transform(&p[6], &p[7]);
     ras_.move_to_d(p[0],p[1]);
     ras_.line_to_d(p[2],p[3]);
     ras_.line_to_d(p[4],p[5]);
     ras_.line_to_d(p[6],p[7]);
     RendererType ren(renb_);
     ren.color(color_type(feature_.id()));
     agg::render_scanlines(ras_, sl_, ren);
 }
开发者ID:Jeff885,项目名称:mapnik,代码行数:21,代码来源:grid_marker_helpers.hpp


示例10: render_raster_marker

 void render_raster_marker(agg::trans_affine const& marker_tr,
                           double opacity)
 {
     double width  = src_.width();
     double height = src_.height();
     double p[8];
     p[0] = 0;     p[1] = 0;
     p[2] = width; p[3] = 0;
     p[4] = width; p[5] = height;
     p[6] = 0;     p[7] = height;
     marker_tr.transform(&p[0], &p[1]);
     marker_tr.transform(&p[2], &p[3]);
     marker_tr.transform(&p[4], &p[5]);
     marker_tr.transform(&p[6], &p[7]);
     ras_.move_to_d(p[0],p[1]);
     ras_.line_to_d(p[2],p[3]);
     ras_.line_to_d(p[4],p[5]);
     ras_.line_to_d(p[6],p[7]);
     agg::span_allocator<color_type> sa;
     agg::image_filter_bilinear filter_kernel;
     agg::image_filter_lut filter(filter_kernel, false);
     agg::rendering_buffer marker_buf((unsigned char *)src_.getBytes(),
                                      src_.width(),
                                      src_.height(),
                                      src_.width()*4);
     agg::pixfmt_rgba32_pre pixf(marker_buf);
     typedef agg::image_accessor_clone<agg::pixfmt_rgba32_pre> img_accessor_type;
     typedef agg::span_interpolator_linear<agg::trans_affine> interpolator_type;
     typedef agg::span_image_filter_rgba_2x2<img_accessor_type,
                                             interpolator_type> span_gen_type;
     typedef agg::renderer_scanline_aa_alpha<renderer_base,
             agg::span_allocator<color_type>,
             span_gen_type> renderer_type;
     img_accessor_type ia(pixf);
     interpolator_type interpolator(agg::trans_affine(p, 0, 0, width, height) );
     span_gen_type sg(ia, interpolator, filter);
     renderer_type rp(renb_,sa, sg, unsigned(opacity*255));
     agg::render_scanlines(ras_, sl_, rp);
 }
开发者ID:LeadsPlus,项目名称:mapnik,代码行数:39,代码来源:marker_helpers.hpp


示例11: apply

void pathAttr::apply(agg::path_storage* path, const agg::trans_affine& tr, double accuracy)
{
    double scale = sqrt(fabs(tr.determinant()));
    
    if (mCommand == stroke) {
        if (mIsoWidthFlag) {
            trans.attach(*path);
            trans.transformer(tr);
            transCurvedStroked.width(mStrokeWidth * scale);
            transCurvedStroked.line_join(mLineJoin);
            transCurvedStroked.line_cap(mLineCap);
            transCurvedStroked.miter_limit(mMiterLimit);
            transCurvedStroked.inner_join(agg::inner_round);
            transCurvedStroked.approximation_scale(accuracy);
            transCurved.approximation_scale(accuracy);
            
            // If the *visual* line width is considerable we 
            // turn on processing of curve cusps.
            //---------------------
            if (mStrokeWidth * scale > 1.0) {
                transCurved.angle_tolerance(0.2);
            } else {
                transCurved.angle_tolerance(0.0);
            }
        } else {
            curved.attach(*path);
            curvedStrokedTrans.transformer(tr);
            curvedStroked.width(mStrokeWidth);
            curvedStroked.line_join(mLineJoin);
            curvedStroked.line_cap(mLineCap);
            curvedStroked.miter_limit(mMiterLimit);
            curvedStroked.inner_join(agg::inner_round);
            curvedStroked.approximation_scale(accuracy * scale);
            curved.approximation_scale(accuracy * scale);
            
            // If the *visual* line width is considerable we 
            // turn on processing of curve cusps.
            //---------------------
            if (mStrokeWidth * scale > 1.0) {
                curved.angle_tolerance(0.2);
            } else {
                curved.angle_tolerance(0.0);
            }
        }
    } else {
        trans.attach(*path);
        trans.transformer(tr);
        transCurved.approximation_scale(accuracy);
    }
}
开发者ID:burstas,项目名称:context-free.version2,代码行数:50,代码来源:shape.cpp


示例12:

Bounds::Bounds(const agg::trans_affine& trans, 
               agg::path_storage* path, pathAttr* attr, double dilation,
               double scale)
{
    double centx = attr->mCentroid.x;
    double centy = attr->mCentroid.y;
    trans.transform(&centx, &centy);

    mValid = attr->boundingRect(path, trans, mMin_X, mMin_Y, mMax_X, mMax_Y, scale);
    
    if (mValid && mMin_X <= centx && mMax_X >= centx &&
                  mMin_Y <= centy && mMax_Y >= centy && dilation != 1.0)
    {
        mMin_X = dilation * (mMin_X - centx) + centx;
        mMax_X = dilation * (mMax_X - centx) + centx;
        mMin_Y = dilation * (mMin_Y - centy) + centy;
        mMax_Y = dilation * (mMax_Y - centy) + centy;
    }
}
开发者ID:burstas,项目名称:context-free.version2,代码行数:19,代码来源:bounds.cpp


示例13: DrawImpl_rgb

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);
	}
}
开发者ID:hatc,项目名称:ekc,代码行数:42,代码来源:draw_selection.cpp


示例14: pixf

unsigned CAggMemoryDC::DrawScaledText(
        const TCHAR* text,
        const GraphTypes::RectF& rc,
        const GraphTypes::Color& clr,
        const char* font,
        int size,
        const PointF & descsubtract)
{
    if (m_buf==0)
        return 0;

    unsigned len=0;

    pixel_format pixf(m_rbuf);
    ren_base renb(pixf);
    solid_renderer ren_solid(renb);

    ATLASSERT(m_buf);
    conv_font_curve_type fcurves(m_fonts->m_fman.path_adaptor());
    conv_font_segm_type  fsegm(fcurves);
    conv_font_trans_type ftrans(fsegm, m_mtx);
 //   fsegm.approximation_scale(3.0);
 //   fcurves.approximation_scale(2.0);

    m_fonts->m_feng.flip_y(true);
    m_fonts->m_feng.hinting(true);

    if(m_fonts->m_feng.create_font(
        font, 
        agg::glyph_ren_outline,
        size,
        0.0,
        FW_NORMAL,
        false,
        ANSI_CHARSET,
        DEFAULT_PITCH | FF_SWISS
        ))
    {
        double x = 0.0;
        double y = 0.0;
        const TCHAR* p = text;

        TEXTMETRIC tm;
        GetTextMetrics(&tm);

        //double descent=(tm.tmDescent>descsubtract.y)?(tm.tmDescent-descsubtract.y):(tm.tmDescent-1);
        //ATLASSERT(tm.tmDescent>descsubtract.y);
        //ATLASSERT(descent>0);
        //descent *= m_mtx.scale(); 

        //m_mtx *= agg::trans_affine_translation(rc.x-m_rcUpdate.left, rc.y+rc.Height-descent-m_rcUpdate.top);

        double ascent=tm.tmAscent-descsubtract.y;
        ATLASSERT(ascent>0.0f);
        ascent *= m_mtx.scale(); 
        m_mtx *= agg::trans_affine_translation(rc.x-m_rcUpdate.left, rc.y+ascent-m_rcUpdate.top);

        ren_solid.color(agg::rgba8(clr.GetR(), clr.GetG(), clr.GetB(), clr.GetA()));

        while(*p)
        {
            const agg::glyph_cache* glyph = m_fonts->m_fman.glyph(*p);
            if(glyph)
            {
                m_fonts->m_fman.add_kerning(&x, &y);
                m_fonts->m_fman.init_embedded_adaptors(glyph, x, y);

                if(glyph->data_type == agg::glyph_data_outline)
                {
                    m_ras_aa.add_path(ftrans);
                }

                // increment pen position
                x += glyph->advance_x;
                y += glyph->advance_y;
            }
            ++p;
            ++len;
        }

        agg::render_scanlines(m_ras_aa, m_sl, ren_solid);
        ATLASSERT(m_buf);
    }

    return len;
}
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:86,代码来源:AggMemoryDC.cpp


示例15: render_raster_marker

    void render_raster_marker(agg::trans_affine const& marker_tr,
                              double opacity)
    {
        using pixfmt_pre = agg::pixfmt_rgba32_pre;
        agg::scanline_u8 sl_;
        double width  = src_.width();
        double height = src_.height();
        if (std::fabs(1.0 - scale_factor_) < 0.001
            && (std::fabs(1.0 - marker_tr.sx) < agg::affine_epsilon)
            && (std::fabs(0.0 - marker_tr.shy) < agg::affine_epsilon)
            && (std::fabs(0.0 - marker_tr.shx) < agg::affine_epsilon)
            && (std::fabs(1.0 - marker_tr.sy) < agg::affine_epsilon))
        {
            agg::rendering_buffer src_buffer((unsigned char *)src_.getBytes(),src_.width(),src_.height(),src_.width() * 4);
            pixfmt_pre pixf_mask(src_buffer);
            if (snap_to_pixels_)
            {
                renb_.blend_from(pixf_mask,
                                 0,
                                 std::floor(marker_tr.tx + .5),
                                 std::floor(marker_tr.ty + .5),
                                 unsigned(255*opacity));
            }
            else
            {
                renb_.blend_from(pixf_mask,
                                 0,
                                 marker_tr.tx,
                                 marker_tr.ty,
                                 unsigned(255*opacity));
            }
        }
        else
        {
            using img_accessor_type = agg::image_accessor_clone<pixfmt_pre>;
            using interpolator_type = agg::span_interpolator_linear<>;
            //using span_gen_type = agg::span_image_filter_rgba_2x2<img_accessor_type,interpolator_type>;
            using span_gen_type = agg::span_image_resample_rgba_affine<img_accessor_type>;
            using renderer_type = agg::renderer_scanline_aa_alpha<renderer_base,
                                                                  agg::span_allocator<color_type>,
                                                                  span_gen_type>;

            double p[8];
            p[0] = 0;     p[1] = 0;
            p[2] = width; p[3] = 0;
            p[4] = width; p[5] = height;
            p[6] = 0;     p[7] = height;
            marker_tr.transform(&p[0], &p[1]);
            marker_tr.transform(&p[2], &p[3]);
            marker_tr.transform(&p[4], &p[5]);
            marker_tr.transform(&p[6], &p[7]);
            agg::span_allocator<color_type> sa;
            agg::image_filter_lut filter;
            filter.calculate(agg::image_filter_bilinear(), true);
            agg::rendering_buffer marker_buf((unsigned char *)src_.getBytes(),
                                             src_.width(),
                                             src_.height(),
                                             src_.width()*4);
            pixfmt_pre pixf(marker_buf);
            img_accessor_type ia(pixf);
            agg::trans_affine final_tr(p, 0, 0, width, height);
            if (snap_to_pixels_)
            {
                final_tr.tx = std::floor(final_tr.tx+.5);
                final_tr.ty = std::floor(final_tr.ty+.5);
            }
            interpolator_type interpolator(final_tr);
            span_gen_type sg(ia, interpolator, filter);
            renderer_type rp(renb_,sa, sg, unsigned(opacity*255));
            ras_.move_to_d(p[0],p[1]);
            ras_.line_to_d(p[2],p[3]);
            ras_.line_to_d(p[4],p[5]);
            ras_.line_to_d(p[6],p[7]);
            agg::render_scanlines(ras_, sl_, rp);
        }
    }
开发者ID:eponymous1968,项目名称:mapnik,代码行数:76,代码来源:marker_helpers.hpp


示例16: render_raster_marker

void render_raster_marker(RendererType renb, RasterizerType & ras, image_rgba8 const& src,
                          agg::trans_affine const& tr, double opacity,
                          float scale_factor, bool snap_to_pixels)
{
    using color_type = agg::rgba8;
    using const_rendering_buffer = util::rendering_buffer<image_rgba8>;
    using pixfmt_pre = agg::pixfmt_alpha_blend_rgba<agg::blender_rgba32_pre, const_rendering_buffer, agg::pixel32_type>;

    agg::scanline_u8 sl;
    double width  = src.width();
    double height = src.height();
    if (std::fabs(1.0 - scale_factor) < 0.001
        && (std::fabs(1.0 - tr.sx) < agg::affine_epsilon)
        && (std::fabs(0.0 - tr.shy) < agg::affine_epsilon)
        && (std::fabs(0.0 - tr.shx) < agg::affine_epsilon)
        && (std::fabs(1.0 - tr.sy) < agg::affine_epsilon))
    {
        const_rendering_buffer src_buffer(src);
        pixfmt_pre pixf_mask(src_buffer);
        if (snap_to_pixels)
        {
            renb.blend_from(pixf_mask,
                            0,
                            static_cast<int>(std::floor(tr.tx + .5)),
                            static_cast<int>(std::floor(tr.ty + .5)),
                            unsigned(255*opacity));
        }
        else
        {
            renb.blend_from(pixf_mask,
                            0,
                            static_cast<int>(tr.tx),
                            static_cast<int>(tr.ty),
                            unsigned(255*opacity));
        }
    }
    else
    {
        using img_accessor_type = agg::image_accessor_clone<pixfmt_pre>;
        using interpolator_type = agg::span_interpolator_linear<>;
        //using span_gen_type = agg::span_image_filter_rgba_2x2<img_accessor_type,interpolator_type>;
        using span_gen_type = agg::span_image_resample_rgba_affine<img_accessor_type>;
        using renderer_type = agg::renderer_scanline_aa_alpha<RendererType,
                                                              agg::span_allocator<color_type>,
                                                              span_gen_type>;

        double p[8];
        p[0] = 0;     p[1] = 0;
        p[2] = width; p[3] = 0;
        p[4] = width; p[5] = height;
        p[6] = 0;     p[7] = height;
        tr.transform(&p[0], &p[1]);
        tr.transform(&p[2], &p[3]);
        tr.transform(&p[4], &p[5]);
        tr.transform(&p[6], &p[7]);
        agg::span_allocator<color_type> sa;
        agg::image_filter_lut filter;
        filter.calculate(agg::image_filter_bilinear(), true);
        const_rendering_buffer src_buffer(src);
        pixfmt_pre pixf(src_buffer);
        img_accessor_type ia(pixf);
        agg::trans_affine final_tr(p, 0, 0, width, height);
        if (snap_to_pixels)
        {
            final_tr.tx = std::floor(final_tr.tx+.5);
            final_tr.ty = std::floor(final_tr.ty+.5);
        }
        interpolator_type interpolator(final_tr);
        span_gen_type sg(ia, interpolator, filter);
        renderer_type rp(renb, sa, sg, unsigned(opacity*255));
        ras.move_to_d(p[0],p[1]);
        ras.line_to_d(p[2],p[3]);
        ras.line_to_d(p[4],p[5]);
        ras.line_to_d(p[6],p[7]);
        agg::render_scanlines(ras, sl, rp);
    }
}
开发者ID:CartoDB,项目名称:mapnik,代码行数:77,代码来源:agg_render_marker.hpp


示例17: buf

void agg_renderer<T0,T1>::render_marker(pixel_position const& pos,
                                    marker const& marker,
                                    agg::trans_affine const& tr,
                                    double opacity,
                                    composite_mode_e comp_op)
{
    using color_type = agg::rgba8;
    using order_type = agg::order_rgba;
    using blender_type = agg::comp_op_adaptor_rgba_pre<color_type, order_type>; // comp blender
    using pixfmt_comp_type = agg::pixfmt_custom_blend_rgba<blender_type, agg::rendering_buffer>;
    using renderer_base = agg::renderer_base<pixfmt_comp_type>;
    using renderer_type = agg::renderer_scanline_aa_solid<renderer_base>;
    using svg_attribute_type = agg::pod_bvector<mapnik::svg::path_attributes>;

    ras_ptr->reset();
    if (gamma_method_ != GAMMA_POWER || gamma_ != 1.0)
    {
        ras_ptr->gamma(agg::gamma_power());
        gamma_method_ = GAMMA_POWER;
        gamma_ = 1.0;
    }
    agg::scanline_u8 sl;
    agg::rendering_buffer buf(current_buffer_->raw_data(),
                              current_buffer_->width(),
                              current_buffer_->height(),
                              current_buffer_->width() * 4);
    pixfmt_comp_type pixf(buf);
    pixf.comp_op(static_cast<agg::comp_op_e>(comp_op));
    renderer_base renb(pixf);

    if (marker.is_vector())
    {
        box2d<double> const& bbox = (*marker.get_vector_data())->bounding_box();
        coord<double,2> c = bbox.center();
        // center the svg marker on '0,0'
        agg::trans_affine mtx = agg::trans_affine_translation(-c.x,-c.y);
        // apply symbol transformation to get to map space
        mtx *= tr;
        mtx *= agg::trans_affine_scaling(common_.scale_factor_);
        // render the marker at the center of the marker box
        mtx.translate(pos.x, pos.y);
        using namespace mapnik::svg;
        vertex_stl_adapter<svg_path_storage> stl_storage((*marker.get_vector_data())->source());
        svg_path_adapter svg_path(stl_storage);
        svg_renderer_agg<svg_path_adapter,
            svg_attribute_type,
            renderer_type,
            pixfmt_comp_type> svg_renderer(svg_path,
                                                   (*marker.get_vector_data())->attributes());

        svg_renderer.render(*ras_ptr, sl, renb, mtx, opacity, bbox);
    }
    else
    {
        double width = (*marker.get_bitmap_data())->width();
        double height = (*marker.get_bitmap_data())->height();
        if (std::fabs(1.0 - common_.scale_factor_) < 0.001 && tr.is_identity())
        {
            double cx = 0.5 * width;
            double cy = 0.5 * height;
            composite(current_buffer_->data(), **marker.get_bitmap_data(),
                      comp_op, opacity,
                      boost::math::iround(pos.x - cx),
                      boost::math::iround(pos.y - cy),
                      false);
        }
        else
        {

            double p[8];
            double x0 = pos.x - 0.5 * width;
            double y0 = pos.y - 0.5 * height;
            p[0] = x0;         p[1] = y0;
            p[2] = x0 + width; p[3] = y0;
            p[4] = x0 + width; p[5] = y0 + height;
            p[6] = x0;         p[7] = y0 + height;

            agg::trans_affine marker_tr;

            marker_tr *= agg::trans_affine_translation(-pos.x,-pos.y);
            marker_tr *= tr;
            marker_tr *= agg::trans_affine_scaling(common_.scale_factor_);
            marker_tr *= agg::trans_affine_translation(pos.x,pos.y);

            marker_tr.transform(&p[0], &p[1]);
            marker_tr.transform(&p[2], &p[3]);
            marker_tr.transform(&p[4], &p[5]);
            marker_tr.transform(&p[6], &p[7]);

            ras_ptr->move_to_d(p[0],p[1]);
            ras_ptr->line_to_d(p[2],p[3]);
            ras_ptr->line_to_d(p[4],p[5]);
            ras_ptr->line_to_d(p[6],p[7]);


            agg::span_allocator<color_type> sa;
            agg::image_filter_bilinear filter_kernel;
            agg::image_filter_lut filter(filter_kernel, false);

            image_data_32 const& src = **marker.get_bitmap_data();
//.........这里部分代码省略.........
开发者ID:Jiangyangyang,项目名称:mapnik,代码行数:101,代码来源:agg_renderer.cpp


示例18: buf

void grid_renderer<T>::render_marker(mapnik::feature_impl & feature, unsigned int step, pixel_position const& pos, marker const& marker, agg::trans_affine const& tr, double opacity, composite_mode_e comp_op)
{
    if (marker.is_vector())
    {
        typedef coord_transform<CoordTransform,geometry_type> path_type;
        typedef agg::renderer_base<mapnik::pixfmt_gray32> ren_base;
        typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
        agg::scanline_bin sl;

        grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_);
        mapnik::pixfmt_gray32 pixf(buf);

        ren_base renb(pixf);
        renderer ren(renb);

        ras_ptr->reset();

        box2d<double> const& bbox = (*marker.get_vector_data())->bounding_box();
        coord<double,2> c = bbox.center();
        // center the svg marker on '0,0'
        agg::trans_affine mtx = agg::trans_affine_translation(-c.x,-c.y);
        // apply symbol transformation to get to map space
        mtx *= tr;
        mtx *= agg::trans_affine_scaling(scale_factor_*(1.0/step));
        // render the marker at the center of the marker box
        mtx.translate(pos.x, pos.y);
        using namespace mapnik::svg;
        vertex_stl_adapter<svg_path_storage> stl_storage((*marker.get_vector_data())->source());
        svg_path_adapter svg_path(stl_storage);
        svg_renderer_agg<svg_path_adapter,
            agg::pod_bvector<path_attributes>,
            renderer,
            mapnik::pixfmt_gray32> svg_renderer(svg_path,
                                                (*marker.get_vector_data())->attributes());

        svg_renderer.render_id(*ras_ptr, sl, renb, feature.id(), mtx, opacity, bbox);

    }
    else
    {
        image_data_32 const& data = **marker.get_bitmap_data();
        double width = data.width();
        double height = data.height();
        double cx = 0.5 * width;
        double cy = 0.5 * height;
        if (step == 1 && (std::fabs(1.0 - scale_factor_) < 0.001 && tr.is_identity()))
        {
            // TODO - support opacity
            pixmap_.set_rectangle(feature.id(), data,
                                  boost::math::iround(pos.x - cx),
                                  boost::math::iround(pos.y - cy));
        }
        else
        {
            // TODO - remove support for step != or add support for agg scaling with opacity
            double ratio = (1.0/step);
            image_data_32 target(ratio * data.width(), ratio * data.height());
            mapnik::scale_image_agg<image_data_32>(target,data, SCALING_NEAR,
                                                   scale_factor_, 0.0, 0.0, 1.0, ratio);
            pixmap_.set_rectangle(feature.id(), target,
                                  boost::math::iround(pos.x - cx),
                                  boost::math::iround(pos.y - cy));
        }
    }
    pixmap_.add_feature(feature);
}
开发者ID:LeadsPlus,项目名称:mapnik,代码行数:66,代码来源:grid_renderer.cpp


示例19: Rect

void CAggMemoryDC::Rect(
    const GraphTypes::PointF& tl, 
    const GraphTypes::PointF& br,
    const GraphTypes::Color& clrfill,
    const GraphTypes::Color& clroutline,
    GraphTypes::REAL outline_width/*=1.0*/,
    bool bAA/*=false*/)
{
    if (m_buf==0)
        return;

    if(bAA)
    {
        PointF points[4];
        points[0].x=tl.x;
        points[0].y=tl.y;
        points[1].x=br.x;
        points[1].y=tl.y;
        points[2].x=br.x;
        points[2].y=br.y;
        points[3].x=tl.x;
        points[3].y=br.y;

        SolidPolygon(points, clrfill, 4, outline_width, clroutline); 
    }
    else
    {
        pixel_format pixf(m_rbuf);
        ren_base renb(pixf);

        primitive_renderer pren(renb);

        pren.fill_color(agg::rgba8(
            clrfill.GetR(),
            clrfill.GetG(),
            clrfill.GetB(),
            clrfill.GetA()));
        pren.line_color(agg::rgba8(
            clroutline.GetR(),
            clroutline.GetG(),
            clroutline.GetB(),
            clroutline.GetA()));

        double topx(tl.x), topy(tl.y), bottomx(br.x), bottomy(br.y);
        m_mtx.transform(&topx,&topy);
        m_mtx.transform(&bottomx,&bottomy);
        int x1=round_int(topx); 
        int y1=round_int(topy); 
        int x2=round_int(bottomx); 
        int y2=round_int(bottomy); 

        pren.solid_rectangle(x1, y1, x2, y2);
        pren.rectangle(x1, y1, x2, y2);
    }
}
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:55,代码来源:AggMemoryDC.cpp


示例20: on_mouse_button_down

 void on_mouse_button_down(int x, int y, unsigned flags) 
 {
     if(flags & 1)
     {
         double xd = x;
         double yd = y;
         double r = 4.0 / m_scale.scale();
         m_scale.inverse_transform(&xd, &yd);
         m_point_idx = m_shape.hit_test(xd, yd, r);
         force_redraw();
     }
 }
开发者ID:Bashakov,项目名称:agg,代码行数:12,代码来源:flash_rasterizer2.cpp



注:本文中的agg::trans_affine类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ aggregation::Aggregate类代码示例发布时间:2022-05-31
下一篇:
C++ agg::slider_ctrl类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap