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

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

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

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



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

示例1: convert_to_path

void scene_renderer_t::convert_to_path( const shape_t& s, agg::path_storage& path, const Imath::V2i& offset, int subsample) const
{
	path.remove_all();
	
	Imath::V2f p0, p1, p2;
	Imath::V2f shape_offset = s.offset();

	Imath::M33f m( s.global_xform());
	
	p0 = transform_point( s.triples()[0].p1(), shape_offset, m, subsample, offset);
	path.move_to( p0.x, p0.y);
	
	for( int i = 0; i < s.triples().size() - 1; ++i)
	{
		p2 = transform_point( s.triples()[i].p2(), shape_offset, m, subsample, offset);
		p0 = transform_point( s.triples()[i+1].p0(), shape_offset, m, subsample, offset);
		p1 = transform_point( s.triples()[i+1].p1(), shape_offset, m, subsample, offset);
		path.curve4( p2.x, p2.y, p0.x, p0.y, p1.x, p1.y);
	}

	// last segment
	p2 = transform_point( s.triples()[s.triples().size()-1].p2(), shape_offset, m, subsample, offset);
	p0 = transform_point( s.triples()[0].p0(), shape_offset, m, subsample, offset);
	p1 = transform_point( s.triples()[0].p1(), shape_offset, m, subsample, offset);
	path.curve4( p2.x, p2.y, p0.x, p0.y, p1.x, p1.y);
	path.close_polygon();
}
开发者ID:devernay,项目名称:ramen-1,代码行数:27,代码来源:scene_renderer.cpp


示例2: create_star

    //------------------------------------------------------------------------
    void create_star(agg::path_storage& ps)
    {
        double r = initial_width();
        if(initial_height() < r) r = initial_height();

        double r1 = r / 3 - 8.0;
        double r2 = r1 / 1.45;
        unsigned nr = 14;

        unsigned i;
        for(i = 0; i < nr; i++)
        {
            double a = agg::pi * 2.0 * i / nr - agg::pi / 2.0;
            double dx = cos(a);
            double dy = sin(a);

            if(i & 1)
            {
                ps.line_to(m_polygon_cx + dx * r1, m_polygon_cy + dy * r1);
            }
            else
            {
                if(i) ps.line_to(m_polygon_cx + dx * r2, m_polygon_cy + dy * r2);
                else  ps.move_to(m_polygon_cx + dx * r2, m_polygon_cy + dy * r2);
            }
        }
    }
开发者ID:4nakin,项目名称:CorsixTH-Android,代码行数:28,代码来源:image_transforms.cpp


示例3: get_path_storage

bool
get_path_storage(agg::path_storage& path, const control_point* points,
	int32 count, bool closed)
{
	if (count > 1) {
		path.move_to(points[0].point.x, points[0].point.y);

		for (int32 i = 1; i < count; i++) {
			path.curve4(points[i - 1].point_out.x, points[i - 1].point_out.y,
				points[i].point_in.x, points[i].point_in.y,
				points[i].point.x, points[i].point.y);
		}
		if (closed) {
			// curve from last to first control point
			path.curve4(
				points[count - 1].point_out.x, points[count - 1].point_out.y,
				points[0].point_in.x, points[0].point_in.y,
				points[0].point.x, points[0].point.y);
			path.close_polygon();
		}

		return true;
	}
	return false;
}
开发者ID:mmanley,项目名称:Antares,代码行数:25,代码来源:VectorPath.cpp


示例4: generate_circles

void generate_circles(agg::path_storage& ps, 
                      const double* quad, 
                      unsigned num_circles, 
                      double radius)
{
    ps.remove_all();
    unsigned i;
    for(i = 0; i < 4; ++i)
    {
        unsigned n1 = i * 2;
        unsigned n2 = (i < 3) ? i * 2 + 2 : 0; 
        unsigned j;
        for(j = 0; j < num_circles; j++)
        {
            agg::ellipse ell(quad[n1]     + (quad[n2]     - quad[n1])     * j / num_circles, 
                             quad[n1 + 1] + (quad[n2 + 1] - quad[n1 + 1]) * j / num_circles, 
                             radius, radius, 100);
            ps.concat_path(ell);
        }
    }
}
开发者ID:zshipko,项目名称:libtwombly,代码行数:21,代码来源:scanline_boolean.cpp


示例5: parse_lion

unsigned parse_lion(agg::path_storage& path, agg::rgba8* colors, unsigned* path_idx)
{
    // Parse the lion and then detect its bounding
    // box and arrange polygons orientations (make all polygons
    // oriented clockwise or counterclockwise)

    const char* ptr = g_lion;
    unsigned npaths = 0;

    while(*ptr)
    {
        if(*ptr != 'M' && isalnum(*ptr))
        {
            unsigned c = 0;
            sscanf(ptr, "%x", &c);

            // New color. Every new color creates new path in the path object.
            path.close_polygon();
            colors[npaths] = agg::rgb8_packed(c);
            path_idx[npaths] = path.start_new_path();
            npaths++;
            while(*ptr && *ptr != '\n') ptr++;
            if(*ptr == '\n') ptr++;
        }
        else
        {
            float x = 0.0;
            float y = 0.0;

            while(*ptr && *ptr != '\n')
            {
                int c = *ptr;

                while(*ptr && !isdigit(*ptr)) ptr++;
                x = atof(ptr);

                while(*ptr &&  isdigit(*ptr)) ptr++;
                while(*ptr && !isdigit(*ptr)) ptr++;
                y = atof(ptr);

                if(c == 'M')
                {
                    path.close_polygon();
                    path.move_to(x, y);
                }
                else
                {
                    path.line_to(x, y);
                }

                while(*ptr &&  isdigit(*ptr)) ptr++;
                while(*ptr && *ptr != '\n' && !isalpha(*ptr)) ptr++;
            }
            if(*ptr == '\n') ptr++;
        }
    }
    path.arrange_orientations_all_paths(agg::path_flags_cw);
    return npaths;
}
开发者ID:colinporth,项目名称:radioPlus,代码行数:59,代码来源:parse_lion.cpp


示例6: e

void roadmap_canvas_draw_multiple_circles
        (int count, RoadMapGuiPoint *centers, int *radius, int filled,
         int fast_draw) {

   int i;

   static agg::path_storage path;

   for (i = 0; i < count; ++i) {

      int r = radius[i];

      int x = centers[i].x;
      int y = centers[i].y;

      agg::ellipse e( x, y, r, r);
      path.concat_path(e);

      if (filled) {

         ras.reset();
         ras.add_path(path);
         ren_solid.color(CurrentPen->color);
         agg::render_scanlines( ras, sl, ren_solid);

/*      } else if (fast_draw) {
         renderer_pr ren_pr(agg_renb);
         agg::rasterizer_outline<renderer_pr> ras_line(ren_pr);
         ren_pr.line_color(CurrentPen->color);
         ras_line.add_path(path);
*/
      } else {

         raso.add_path(path);
      }

      path.remove_all ();
   }
}
开发者ID:GitPicz,项目名称:waze,代码行数:39,代码来源:roadmap_canvas.cpp


示例7: make_gb_poly

void make_gb_poly(agg::path_storage& ps)
{
    ps.remove_all();
    unsigned i;
    const double* p = poly1;
    ps.move_to(p[0], p[1]);
    p += 2;
    for(i = 1; i < sizeof(poly1) / sizeof(double) / 2; i++)
    {
        ps.line_to(p[0], p[1]);
        p += 2;
    }
    ps.close_polygon();

    p = poly2;
    ps.move_to(p[0], p[1]);
    p += 2;
    for(i = 1; i < sizeof(poly2) / sizeof(double) / 2; i++)
    {
        ps.line_to(p[0], p[1]);
        p += 2;
    }
    ps.close_polygon();
}
开发者ID:4nakin,项目名称:CorsixTH-Android,代码行数:24,代码来源:make_gb_poly.cpp


示例8: switch

void ASSDrawEngine::AddDrawCmdToAGGPathStorage(DrawCmd* cmd, agg::path_storage& path, DRAWCMDMODE mode)
{
	if (mode == HILITE && cmd->prev)
		path.move_to(cmd->prev->m_point->x(), cmd->prev->m_point->y());

	switch(cmd->type)
	{
	case M:
		path.move_to(cmd->m_point->x(),cmd->m_point->y());
		break;

	case B:
		if (cmd->initialized)
		{
			//path.move_to(cmd->prev->m_point->x(),cmd->prev->m_point->y());
			PointList::iterator iterate = cmd->controlpoints.begin();
			int x[2], y[2];
			x[0] = (*iterate)->x();
			y[0] = (*iterate)->y();
			iterate++;
			x[1] = (*iterate)->x();
			y[1] = (*iterate)->y();
			path.curve4(x[0], y[0], x[1], y[1], cmd->m_point->x(),cmd->m_point->y());
    		break;
		}

	case L:
		if (mode == CTRL_LN)
			path.move_to(cmd->m_point->x(),cmd->m_point->y());
		else
			path.line_to(cmd->m_point->x(),cmd->m_point->y());
		break;
		
	case S:
		unsigned np = cmd->controlpoints.size();
        agg::pod_array<double> m_polygon(np * 2);
        unsigned _pn = 0;
		PointList::iterator iterate = cmd->controlpoints.begin();
		while (iterate != cmd->controlpoints.end())
		{
	        m_polygon[_pn] = (*iterate)->x(); _pn++;
	        m_polygon[_pn] = (*iterate)->y(); _pn++;
	        iterate++;
		}
        //m_polygon[_pn++] = cmd->m_point->x();
        //m_polygon[_pn++] = cmd->m_point->y();
		//path.move_to(cmd->prev->m_point->x(),cmd->prev->m_point->y());
		if (mode == CTRL_LN)
		{
			_pn = 0;
			while (_pn < np * 2)
			{
				path.line_to((int) m_polygon[_pn],(int) m_polygon[_pn + 1]);
				_pn += 2;
			}
	        path.line_to(cmd->m_point->x(), cmd->m_point->y());
		}	
		else
		{	
			//path.line_to((int) m_polygon[0],(int) m_polygon[1]);
	        aggpolygon poly(&m_polygon[0], np, false, false);
	        agg::conv_bcspline<agg::simple_polygon_vertex_source>  bspline(poly);
	        bspline.interpolation_step(0.01);
	        agg::path_storage npath;
	        npath.join_path(bspline);
	        path.join_path(npath);
	        if (mode == HILITE)
	        	path.move_to((int) m_polygon[np * 2 - 2], (int) m_polygon[np * 2 - 1] );
	        path.line_to(cmd->m_point->x(), cmd->m_point->y());
		}
		break;
	}	

}
开发者ID:,项目名称:,代码行数:74,代码来源:


示例9: roadmap_canvas_draw_multiple_lines

void roadmap_canvas_draw_multiple_lines (int count, int *lines,
      RoadMapGuiPoint *points, int fast_draw) {

   int i;
   int count_of_points;


   dbg_time_start(DBG_TIME_DRAW_LINES);
#ifdef WIN32_PROFILE
   ResumeCAPAll();
#endif

#ifdef _WIN32_
   if (fast_draw) {
      roadmap_canvas_native_draw_multiple_lines (count, lines, points,
         CurrentPen->color.r, CurrentPen->color.g, CurrentPen->color.b,
         CurrentPen->thickness);
      return;
   }
#endif

   if (!fast_draw) {
      raso.round_cap(true);
      raso.line_join(agg::outline_miter_accurate_join);
   } else {
      raso.round_cap(false);
      raso.line_join(agg::outline_no_join);
   }

//   raso.accurate_join(true);

   static agg::path_storage path;

   for (i = 0; i < count; ++i) {

      int first = 1;

      count_of_points = *lines;

      if (count_of_points < 2) continue;

      dbg_time_start(DBG_TIME_CREATE_PATH);

      for (int j=0; j<count_of_points; j++) {

         if (first) {
            first = 0;
            path.move_to(points->x, points->y);
         } else {
            path.line_to(points->x, points->y);
         }

         points++;
      }

      dbg_time_end(DBG_TIME_CREATE_PATH);
      dbg_time_start(DBG_TIME_ADD_PATH);

#if 0
      if (fast_draw) {
         renderer_pr ren_pr(agg_renb);
         agg::rasterizer_outline<renderer_pr> ras_line(ren_pr);
         ren_pr.line_color(CurrentPen->color);
         ras_line.add_path(path);

      } else {
     #endif
         raso.add_path(path);
      //}

      path.remove_all ();
      dbg_time_end(DBG_TIME_ADD_PATH);

      lines += 1;
   }


#ifdef WIN32_PROFILE
   SuspendCAPAll();
#endif



	return;


   dbg_time_end(DBG_TIME_DRAW_LINES);
}

void roadmap_canvas_draw_multiple_polygons
         (int count, int *polygons, RoadMapGuiPoint *points, int filled,
          int fast_draw) {

   int i;
   int count_of_points;

   static agg::path_storage path;

   for (i = 0; i < count; ++i) {

//.........这里部分代码省略.........
开发者ID:GitPicz,项目名称:waze,代码行数:101,代码来源:roadmap_canvas.cpp


示例10: Lines

void CAggMemoryDC::Lines(
    const PointFVector& pts,
    const Color& clr,
    const REAL width/*=1.0*/)
{
    if (m_buf==0)
        return;

    unsigned count=pts.size()/2;
    ATLASSERT(count>0);
    ATLASSERT((float)count/2.0f>0);

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

    m_path.remove_all();

    for(unsigned i=0; i<count; ++i)
    {
        m_path.move_to(pts[i*2].x, pts[i*2].y);
        m_path.line_to(pts[i*2+1].x, pts[i*2+1].y);
    }

    typedef agg::conv_stroke<conv_path_trans_type> conv_stroke_outline;
    conv_stroke_outline stroke(m_transpath);
    stroke.width(width);

    m_ras_aa.add_path(stroke);

    ren_solid.color(agg::rgba8(clr.GetR(), clr.GetG(), clr.GetB(), clr.GetA()));
    agg::render_scanlines(m_ras_aa, m_sl, ren_solid);
}
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:33,代码来源:AggMemoryDC.cpp


示例11: create_star

    //------------------------------------------------------------------------
    void create_star(double xc, double yc,
                     double r1, double r2, 
                     unsigned n, double start_angle = 0.0)
    {
        m_ps.remove_all();
        unsigned i;
        start_angle *= agg::pi / 180.0;
        for(i = 0; i < n; i++)
        {
            double a = agg::pi * 2.0 * i / n - agg::pi / 2.0;
            double dx = cos(a + start_angle);
            double dy = sin(a + start_angle);

            if(i & 1)
            {
                m_ps.line_to(xc + dx * r1, yc + dy * r1);
            }
            else
            {
                if(i) m_ps.line_to(xc + dx * r2, yc + dy * r2);
                else  m_ps.move_to(xc + dx * r2, yc + dy * r2);
            }
        }
        m_ps.close_polygon();
    }
开发者ID:Bashakov,项目名称:agg,代码行数:26,代码来源:pattern_fill.cpp


示例12: parse_lion

void parse_lion()
{
    g_npaths = parse_lion(g_path, g_colors, g_path_idx);
    agg::pod_array_adaptor<unsigned> path_idx(g_path_idx, 100);
    agg::bounding_rect(g_path, path_idx, 0, g_npaths, &g_x1, &g_y1, &g_x2, &g_y2);
    g_base_dx = (g_x2 - g_x1) / 2.0;
    g_base_dy = (g_y2 - g_y1) / 2.0;
    g_path.flip_x(g_x1, g_x2);
    g_path.flip_y(g_y1, g_y2);
}
开发者ID:Bashakov,项目名称:agg,代码行数:10,代码来源:perspective.cpp


示例13: LollyPop

void CAggMemoryDC::LollyPop(
    const GraphTypes::RectF& rc, 
    const GraphTypes::Color& clr,
    const GraphTypes::Color& clroutline,
    bool bLeft)
{
    if (m_buf==0)
        return;

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

    agg::line_profile_aa lnprof;
    lnprof.width(1.0);

    solid_renderer ren_solid(renb);
    outline_renderer outline_rd(renb, lnprof);

    outline_rasterizer_aa outline_rt(outline_rd);
    outline_rd.color(agg::rgba8(clroutline.GetR(),
        clroutline.GetG(), clroutline.GetB(), clroutline.GetA()));

    REAL radius=rc.Height/2;
    REAL split=rc.Width-rc.Height;
    REAL xcenter=bLeft? (rc.x+radius) : (rc.x+rc.Width-radius);
    REAL ycenter=rc.y+radius;

    agg::ellipse circle(xcenter, ycenter, radius, radius, 10);
    typedef agg::conv_transform<agg::ellipse, agg::trans_affine> conv_ellipse_trans_type;
    conv_ellipse_trans_type m_transcircle(circle, m_mtx);

    // connector line
    PointF p1, p2;
    p1.x=bLeft ? (rc.x+rc.Width-split) : rc.x; 
    p1.y=rc.y+radius; 

    p2.x=bLeft ? (rc.x+rc.Width) : (rc.x+split); 
    p2.y=p1.y; 

    m_path.remove_all();
    m_path.move_to(p1.x, p1.y);
    m_path.line_to(p2.x, p2.y);

    m_ras_aa.reset();

    m_ras_aa.add_path(m_transcircle);

    outline_rt.add_path(m_transcircle);
    outline_rt.add_path(m_transpath);

    ren_solid.color(agg::rgba8(clr.GetR(), clr.GetG(), clr.GetB(), clr.GetA()));
    agg::render_scanlines(m_ras_aa, m_sl, ren_solid);
    outline_rt.render(true);
}
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:54,代码来源:AggMemoryDC.cpp


示例14:

    the_application(agg::pix_format_e format, bool flip_y) :
        agg::platform_support(format, flip_y),
        m_rotate(10,  3, "Rotate", !flip_y),
        m_even_odd(60, 3, "Even-Odd", !flip_y),
        m_draft(130, 3, "Draft", !flip_y),
        m_roundoff(175, 3, "Roundoff", !flip_y),
        m_angle_delta(10, 21, 250-10, 27, !flip_y),
        m_redraw_flag(true)
    {
        m_angle_delta.label("Step=%4.3f degree");

        g_attr[g_npaths++] = path_attributes(g_path.start_new_path(),
                                             agg::rgba8(255, 255, 0),
                                             agg::rgba8(0,   0,   0),
                                             1.0);

        g_path.concat_poly(g_poly_bulb, AGG_POLY_SIZE(g_poly_bulb), true);

        g_attr[g_npaths++] = path_attributes(g_path.start_new_path(),
                                             agg::rgba8(255,  255, 200),
                                             agg::rgba8(90,   0,   0),
                                             0.7);

        g_path.concat_poly(g_poly_beam1, AGG_POLY_SIZE(g_poly_beam1), true); 
        g_path.concat_poly(g_poly_beam2, AGG_POLY_SIZE(g_poly_beam2), true); 
        g_path.concat_poly(g_poly_beam3, AGG_POLY_SIZE(g_poly_beam3), true); 
        g_path.concat_poly(g_poly_beam4, AGG_POLY_SIZE(g_poly_beam4), true); 

        g_attr[g_npaths++] = path_attributes(g_path.start_new_path(),
                                             agg::rgba8(0, 0, 0),
                                             agg::rgba8(0, 0, 0),
                                             0.0);

        g_path.concat_poly(g_poly_fig1, AGG_POLY_SIZE(g_poly_fig1), true); 
        g_path.concat_poly(g_poly_fig2, AGG_POLY_SIZE(g_poly_fig2), true); 
        g_path.concat_poly(g_poly_fig3, AGG_POLY_SIZE(g_poly_fig3), true); 
        g_path.concat_poly(g_poly_fig4, AGG_POLY_SIZE(g_poly_fig4), true); 
        g_path.concat_poly(g_poly_fig5, AGG_POLY_SIZE(g_poly_fig5), true); 
        g_path.concat_poly(g_poly_fig6, AGG_POLY_SIZE(g_poly_fig6), true); 

        m_rotate.text_size(7);
        m_even_odd.text_size(7);
        m_draft.text_size(7);
        m_roundoff.text_size(7);
        add_ctrl(m_rotate);
        add_ctrl(m_even_odd);
        add_ctrl(m_draft);
        add_ctrl(m_roundoff);
        add_ctrl(m_angle_delta);
        m_angle_delta.value(0.01);
    }
开发者ID:Rodeo314,项目名称:vasFMC,代码行数:51,代码来源:idea.cpp


示例15: SolidPolygon

void CAggMemoryDC::SolidPolygon(
    const PointF* points, 
    const Color& clr,
    unsigned point_count,
    REAL widthoutline,
    const Color& clroutline )
{
    if (m_buf==0)
        return;

    ATLASSERT(point_count>0);

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

    solid_renderer ren_solid(renb);
    m_ras_aa.reset();

    m_path.remove_all();
    m_path.move_to(points->x, points->y);
    while(--point_count>0)
    {
        points++;
        m_path.line_to(points->x, points->y);
    }
    m_path.close_polygon();

    m_ras_aa.add_path(m_transpath);
    ren_solid.color(agg::rgba8(clr.GetR(), clr.GetG(), clr.GetB(), clr.GetA()));
    agg::render_scanlines(m_ras_aa, m_sl, ren_solid);

    if(widthoutline>REAL(0))
    {
        typedef agg::conv_stroke<conv_path_trans_type> conv_trans_stroke_outline;
        ren_solid.color(agg::rgba8(clroutline.GetR(),
            clroutline.GetG(), clroutline.GetB(), clroutline.GetA()));
        conv_trans_stroke_outline stroke(m_transpath);
        stroke.width(widthoutline);
        m_ras_aa.add_path(stroke);
        agg::render_scanlines(m_ras_aa, m_sl, ren_solid);
    }
}
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:42,代码来源:AggMemoryDC.cpp


示例16:

    the_application(agg::pix_format_e format, bool flip_y) :
        agg::platform_support(format, flip_y),
        m_method     (10.0, 10.0, 130.0, 70.0, !flip_y),
        m_radius     (130 + 10.0, 10.0 + 4.0, 130 + 300.0, 10.0 + 8.0 + 4.0, !flip_y),
        m_shadow_ctrl(4),
        m_channel_r  (10.0, 80.0,  "Red", !flip_y),
        m_channel_g  (10.0, 95.0,  "Green", !flip_y),
        m_channel_b  (10.0, 110.0, "Blue", !flip_y),
        m_shape(m_path)
    {
        add_ctrl(m_method);
        m_method.text_size(8);
        m_method.add_item("Stack Blur");
        m_method.add_item("Recursive Blur");
        m_method.add_item("Channels");
        m_method.cur_item(0);

        add_ctrl(m_radius);
        m_radius.range(0.0, 40.0);
        m_radius.value(15.0);
        m_radius.label("Blur Radius=%1.2f");

        add_ctrl(m_shadow_ctrl);

        add_ctrl(m_channel_r);
        add_ctrl(m_channel_g);
        add_ctrl(m_channel_b);
        m_channel_g.status(true);

        m_path.remove_all();
        m_path.move_to(28.47, 6.45);
        m_path.curve3(21.58, 1.12, 19.82, 0.29);
        m_path.curve3(17.19, -0.93, 14.21, -0.93);
        m_path.curve3(9.57, -0.93, 6.57, 2.25);
        m_path.curve3(3.56, 5.42, 3.56, 10.60);
        m_path.curve3(3.56, 13.87, 5.03, 16.26);
        m_path.curve3(7.03, 19.58, 11.99, 22.51);
        m_path.curve3(16.94, 25.44, 28.47, 29.64);
        m_path.line_to(28.47, 31.40);
        m_path.curve3(28.47, 38.09, 26.34, 40.58);
        m_path.curve3(24.22, 43.07, 20.17, 43.07);
        m_path.curve3(17.09, 43.07, 15.28, 41.41);
        m_path.curve3(13.43, 39.75, 13.43, 37.60);
        m_path.line_to(13.53, 34.77);
        m_path.curve3(13.53, 32.52, 12.38, 31.30);
        m_path.curve3(11.23, 30.08, 9.38, 30.08);
        m_path.curve3(7.57, 30.08, 6.42, 31.35);
        m_path.curve3(5.27, 32.62, 5.27, 34.81);
        m_path.curve3(5.27, 39.01, 9.57, 42.53);
        m_path.curve3(13.87, 46.04, 21.63, 46.04);
        m_path.curve3(27.59, 46.04, 31.40, 44.04);
        m_path.curve3(34.28, 42.53, 35.64, 39.31);
        m_path.curve3(36.52, 37.21, 36.52, 30.71);
        m_path.line_to(36.52, 15.53);
        m_path.curve3(36.52, 9.13, 36.77, 7.69);
        m_path.curve3(37.01, 6.25, 37.57, 5.76);
        m_path.curve3(38.13, 5.27, 38.87, 5.27);
        m_path.curve3(39.65, 5.27, 40.23, 5.62);
        m_path.curve3(41.26, 6.25, 44.19, 9.18);
        m_path.line_to(44.19, 6.45);
        m_path.curve3(38.72, -0.88, 33.74, -0.88);
        m_path.curve3(31.35, -0.88, 29.93, 0.78);
        m_path.curve3(28.52, 2.44, 28.47, 6.45);
        m_path.close_polygon();

        m_path.move_to(28.47, 9.62);
        m_path.line_to(28.47, 26.66);
        m_path.curve3(21.09, 23.73, 18.95, 22.51);
        m_path.curve3(15.09, 20.36, 13.43, 18.02);
        m_path.curve3(11.77, 15.67, 11.77, 12.89);
        m_path.curve3(11.77, 9.38, 13.87, 7.06);
        m_path.curve3(15.97, 4.74, 18.70, 4.74);
        m_path.curve3(22.41, 4.74, 28.47, 9.62);
        m_path.close_polygon();

        agg::trans_affine shape_mtx;
        shape_mtx *= agg::trans_affine_scaling(4.0);
        shape_mtx *= agg::trans_affine_translation(150, 100);
        m_path.transform(shape_mtx);

        agg::bounding_rect_single(m_shape, 0, 
                                  &m_shape_bounds.x1, &m_shape_bounds.y1, 
                                  &m_shape_bounds.x2, &m_shape_bounds.y2);

        m_shadow_ctrl.xn(0) = m_shape_bounds.x1;
        m_shadow_ctrl.yn(0) = m_shape_bounds.y1;
        m_shadow_ctrl.xn(1) = m_shape_bounds.x2;
        m_shadow_ctrl.yn(1) = m_shape_bounds.y1;
        m_shadow_ctrl.xn(2) = m_shape_bounds.x2;
        m_shadow_ctrl.yn(2) = m_shape_bounds.y2;
        m_shadow_ctrl.xn(3) = m_shape_bounds.x1;
        m_shadow_ctrl.yn(3) = m_shape_bounds.y2;
        m_shadow_ctrl.line_color(agg::rgba(0, 0.3, 0.5, 0.3));
    }
开发者ID:4nakin,项目名称:CorsixTH-Android,代码行数:94,代码来源:blur.cpp


示例17: compose_path

    void compose_path()
    {
        m_path.remove_all();
        m_path.move_to(28.47, 6.45);
        m_path.curve3(21.58, 1.12, 19.82, 0.29);
        m_path.curve3(17.19, -0.93, 14.21, -0.93);
        m_path.curve3(9.57, -0.93, 6.57, 2.25);
        m_path.curve3(3.56, 5.42, 3.56, 10.60);
        m_path.curve3(3.56, 13.87, 5.03, 16.26);
        m_path.curve3(7.03, 19.58, 11.99, 22.51);
        m_path.curve3(16.94, 25.44, 28.47, 29.64);
        m_path.line_to(28.47, 31.40);
        m_path.curve3(28.47, 38.09, 26.34, 40.58);
        m_path.curve3(24.22, 43.07, 20.17, 43.07);
        m_path.curve3(17.09, 43.07, 15.28, 41.41);
        m_path.curve3(13.43, 39.75, 13.43, 37.60);
        m_path.line_to(13.53, 34.77);
        m_path.curve3(13.53, 32.52, 12.38, 31.30);
        m_path.curve3(11.23, 30.08, 9.38, 30.08);
        m_path.curve3(7.57, 30.08, 6.42, 31.35);
        m_path.curve3(5.27, 32.62, 5.27, 34.81);
        m_path.curve3(5.27, 39.01, 9.57, 42.53);
        m_path.curve3(13.87, 46.04, 21.63, 46.04);
        m_path.curve3(27.59, 46.04, 31.40, 44.04);
        m_path.curve3(34.28, 42.53, 35.64, 39.31);
        m_path.curve3(36.52, 37.21, 36.52, 30.71);
        m_path.line_to(36.52, 15.53);
        m_path.curve3(36.52, 9.13, 36.77, 7.69);
        m_path.curve3(37.01, 6.25, 37.57, 5.76);
        m_path.curve3(38.13, 5.27, 38.87, 5.27);
        m_path.curve3(39.65, 5.27, 40.23, 5.62);
        m_path.curve3(41.26, 6.25, 44.19, 9.18);
        m_path.line_to(44.19, 6.45);
        m_path.curve3(38.72, -0.88, 33.74, -0.88);
        m_path.curve3(31.35, -0.88, 29.93, 0.78);
        m_path.curve3(28.52, 2.44, 28.47, 6.45);
        m_path.close_polygon();

        m_path.move_to(28.47, 9.62);
        m_path.line_to(28.47, 26.66);
        m_path.curve3(21.09, 23.73, 18.95, 22.51);
        m_path.curve3(15.09, 20.36, 13.43, 18.02);
        m_path.curve3(11.77, 15.67, 11.77, 12.89);
        m_path.curve3(11.77, 9.38, 13.87, 7.06);
        m_path.curve3(15.97, 4.74, 18.70, 4.74);
        m_path.curve3(22.41, 4.74, 28.47, 9.62);
        m_path.close_polygon();
    }
开发者ID:zshipko,项目名称:libtwombly,代码行数:48,代码来源:rasterizer_compound.cpp


示例18: LinearGradientRect

void CAggMemoryDC::LinearGradientRect(
    const RectF& rc,
    const Color& clrstart,
    const Color& clrend,
    bool bHorizontal/*=true*/)
{
  // The gradient color array
    typedef agg::pod_auto_array<agg::rgba8, 256> color_array_type;

    // Gradient shape function (linear, radial, custom, etc)
    //-----------------
    typedef agg::gradient_xy gradient_func_type;   


    // Span interpolator. This object is used in all span generators 
    // that operate with transformations during iterating of the spans,
    // for example, image transformers use the interpolator too.
    //-----------------
    typedef agg::span_interpolator_linear<> interpolator_type;


    // Span allocator is an object that allocates memory for 
    // the array of colors that will be used to render the 
    // color spans. One object can be shared between different 
    // span generators.
    //-----------------
    typedef agg::span_allocator<agg::rgba8> span_allocator_type;


    // Finally, the gradient span generator working with the agg::rgba8 
    // color type. 
    // The 4-th argument is the color function that should have 
    // the [] operator returning the color in range of [0...255].
    // In our case it will be a simple look-up table of 256 colors.
    //-----------------
    typedef agg::span_gradient<agg::rgba8, 
                               interpolator_type, 
                               gradient_func_type, 
                               color_array_type> span_gradient_type;


    // The gradient scanline renderer type
    //-----------------
    typedef agg::renderer_scanline_aa<ren_base, 
                                    span_allocator_type,	
                                    span_gradient_type> renderer_gradient_type;


    // Common declarations (pixel format and basic renderer).
    //----------------
    pixel_format pixf(m_rbuf);
    ren_base renb(pixf);

    // The gradient objects declarations
    //----------------
    gradient_func_type  gradient_func;                   // The gradient function
    agg::trans_affine   gradient_mtx;                    // Affine transformer
    interpolator_type   span_interpolator(gradient_mtx); // Span interpolator
    span_allocator_type span_allocator;                  // Span Allocator
    color_array_type    color_array;                     // Gradient colors


    // Declare the gradient span itself. 
    // The last two arguments are so called "d1" and "d2" 
    // defining two distances in pixels, where the gradient starts
    // and where it ends. The actual meaning of "d1" and "d2" depands
    // on the gradient function.
    //----------------
    span_gradient_type span_gradient(span_interpolator, 
                                     gradient_func, 
                                     color_array, 
                                     bHorizontal ? rc.x : rc.y,
                                     bHorizontal ? rc.x+rc.Width : rc.y+rc.Height);

    // The gradient renderer
    //----------------
    renderer_gradient_type ren_gradient(renb, span_allocator, span_gradient);

    fill_color_array(color_array, 
                     agg::rgba8(clrstart.GetR(), clrstart.GetG(), clrstart.GetB(), clrstart.GetA()),
                     agg::rgba8(clrend.GetR(), clrend.GetG(), clrend.GetB(), clrend.GetA()));

    m_path.remove_all();
    m_path.move_to(rc.x, rc.y);
    m_path.line_to(rc.x+rc.Width, rc.y);
    m_path.line_to(rc.x+rc.Width, rc.y+rc.Height);
    m_path.line_to(rc.x, rc.y+rc.Height);
    m_path.close_polygon();

    m_ras_aa.reset();
    m_ras_aa.clip_box(0, 0, m_rcUpdate.Width(), m_rcUpdate.Height()); 
    m_ras_aa.add_path(m_transpath);
    agg::render_scanlines(m_ras_aa, m_sl, ren_gradient);
}
开发者ID:dehilsterlexis,项目名称:eclide-1,代码行数:94,代码来源:AggMemoryDC.cpp


示例19:

    the_application(agg::pix_format_e format, bool flip_y) :
        agg::platform_support(format, flip_y),
        m_method     (10.0, 10.0, 130.0, 55.0, !flip_y),
        m_radius     (130 + 10.0, 10.0 + 4.0, 130 + 300.0, 10.0 + 8.0 + 4.0, !flip_y),
        m_shadow_ctrl(4),
        m_shape(m_path)
    {
        add_ctrl(m_method);
        m_method.text_size(8);
        m_method.add_item("Single Color");
        m_method.add_item("Color LUT");
        m_method.cur_item(1);

        add_ctrl(m_radius);
        m_radius.range(0.0, 40.0);
        m_radius.value(15.0);
        m_radius.label("Blur Radius=%1.2f");

        add_ctrl(m_shadow_ctrl);

        m_path.remove_all();
        m_path.move_to(28.47, 6.45);
        m_path.curve3(21.58, 1.12, 19.82, 0.29);
        m_path.curve3(17.19, -0.93, 14.21, -0.93);
        m_path.curve3(9.57, -0.93, 6.57, 2.25);
        m_path.curve3(3.56, 5.42, 3.56, 10.60);
        m_path.curve3(3.56, 13.87, 5.03, 16.26);
        m_path.curve3(7.03, 19.58, 11.99, 22.51);
        m_path.curve3(16.94, 25.44, 28.47, 29.64);
        m_path.line_to(28.47, 31.40);
        m_path.curve3(28.47, 38.09, 26.34, 40.58);
        m_path.curve3(24.22, 43.07, 20.17, 43.07);
        m_path.curve3(17.09, 43.07, 15.28, 41.41);
        m_path.curve3(13.43, 39.75, 13.43, 37.60);
        m_path.line_to(13.53, 34.77);
        m_path.curve3(13.53, 32.52, 12.38, 31.30);
        m_path.curve3(11.23, 30.08, 9.38, 30.08);
        m_path.curve3(7.57, 30.08, 6.42, 31.35);
        m_path.curve3(5.27, 32.62, 5.27, 34.81);
        m_path.curve3(5.27, 39.01, 9.57, 42.53);
        m_path.curve3(13.87, 46.04, 21.63, 46.04);
        m_path.curve3(27.59, 46.04, 31.40, 44.04);
        m_path.curve3(34.28, 42.53, 35.64, 39.31);
        m_path.curve3(36.52, 37.21, 36.52, 30.71);
        m_path.line_to(36.52, 15.53);
        m_path.curve3(36.52, 9.13, 36.77, 7.69);
        m_path.curve3(37.01, 6.25, 37.57, 5.76);
        m_path.curve3(38.13, 5.27, 38.87, 5.27);
        m_path.curve3(39.65, 5.27, 40.23, 5.62);
        m_path.curve3(41.26, 6.25, 44.19, 9.18);
        m_path.line_to(44.19, 6.45);
        m_path.curve3(38.72, -0.88, 33.74, -0.88);
        m_path.curve3(31.35, -0.88, 29.93, 0.78);
        m_path.curve3(28.52, 2.44, 28.47, 6.45);
        m_path.close_polygon();

        m_path.move_to(28.47, 9.62);
        m_path.line_to(28.47, 26.66);
        m_path.curve3(21.09, 23.73, 18.95, 22.51);
        m_path.curve3(15.09, 20.36, 13.43, 18.02);
        m_path.curve3(11.77, 15.67, 11.77, 12.89);
        m_path.curve3(11.77, 9.38, 13.87, 7.06);
        m_path.curve3(15.97, 4.74, 18.70, 4.74);
        m_path.curve3(22.41, 4.74, 28.47, 9.62);
        m_path.close_polygon();

        agg::trans_affine shape_mtx;
        shape_mtx *= agg::trans_affine_scaling(4.0);
        shape_mtx *= agg::trans_affine_translation(150, 100);
        m_path.transform(shape_mtx);

        agg::bounding_rect_single(m_shape, 0, 
                                  &m_shape_bounds.x1, &m_shape_bounds.y1, 
                                  &m_shape_bounds.x2, &m_shape_bounds.y2);

        m_shadow_ctrl.xn(0) = m_shape_bounds.x1;
        m_shadow_ctrl.yn(0) = m_shape_bounds.y1;
        m_shadow_ctrl.xn(1) = m_shape_bounds.x2;
        m_shadow_ctrl.yn(1) = m_shape_bounds.y1;
        m_shadow_ctrl.xn(2) = m_shape_bounds.x2;
        m_shadow_ctrl.yn(2) = m_shape_bounds.y2;
        m_shadow_ctrl.xn(3) = m_shape_bounds.x1;
        m_shadow_ctrl.yn(3) = m_shape_bounds.y2;
        m_shadow_ctrl.line_color(agg::rgba(0, 0.3, 0.5, 0.3));


        m_color_lut.resize(256);
        unsigned i;
        const agg::int8u* p = g_gradient_colors;
        for(i = 0; i < 256; i++)
        {
            m_color_lut[i] = agg::rgba8(p[0], p[1], p[2], (i > 63) ? 255 : i * 4);//p[3]);
            //m_color_lut[i].premultiply();
            p += 4;
        }
    }
开发者ID:Rodeo314,项目名称:vasFMC,代码行数:96,代码来源:blend_color.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ agg::rasterizer_scanline_aa类代码示例发布时间:2022-05-31
下一篇:
C++ agg::interactive_polygon类代码示例发布时间: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