Example #1
0
    void GraphAggRenderer::fillRect(Point *ulCorner, Point *lrCorner, 
            Color *color)
    {
        //qDebug() << QString("%1").arg(__PRETTY_FUNCTION__);
        agg::path_storage &ps = m_data->ps;
        unsigned idx = ps.start_new_path();

        ps.move_to(ulCorner->x(), ulCorner->y());
        ps.line_to(lrCorner->x(), ulCorner->y());
        ps.line_to(lrCorner->x(), lrCorner->y());
        ps.line_to(ulCorner->x(), lrCorner->y());
        ps.line_to(ulCorner->x(), ulCorner->y());
        ps.end_poly();


        // 保存属性
        push_attr();
        m_data->as.add(path_attributes(cur_attr(), idx));

        //保存idx值
        path_attributes attr = cur_attr();
        attr.stroke_flag = false;
        attr.fill_flag = true;
        attr.fill_color = agg::rgba8(color->red(), 
                color->green(), color->blue(), color->alpha());
        attr.index = idx;
        m_data->as[m_data->as.size() -1] = attr;
        pop_attr();

        updateBbox();
    }
Example #2
0
    void GraphAggRenderer::fillPolygon(Point *points, int pointCount,
            Color *color)
    {
        //qDebug() << QString("%1").arg(__PRETTY_FUNCTION__);

        agg::path_storage &ps = m_data->ps;
        unsigned idx = ps.start_new_path();

        ps.move_to(points[0].x(), points[0].y());
        for (int i = 1; i < pointCount; ++i) {
            ps.line_to(points[i].x(), points[i].y());
        }
        ps.end_poly(agg::path_flags_close);


        // 保存属性
        push_attr();
        m_data->as.add(path_attributes(cur_attr(), idx));

        //保存idx值
        path_attributes attr = cur_attr();
        attr.stroke_flag = false;
        attr.fill_flag = true;
        attr.fill_color = agg::rgba8(color->red(), 
                color->green(), color->blue(), color->alpha());
        attr.index = idx;
        m_data->as[m_data->as.size() -1] = attr;
        pop_attr();

        updateBbox();
    }
Example #3
0
    void GraphAggRenderer::fillEllipse(Point *center, 
            float width, float height, 
            Color *color)
    {
        //qDebug() << QString("%1").arg(__PRETTY_FUNCTION__);

        agg::ellipse e1;
        e1.init(center->x(), center->y(),
                width, height, 100);

        agg::path_storage &ps = m_data->ps;
        unsigned idx = ps.start_new_path();
        ps.concat_path(e1);

        // 保存属性
        push_attr();
        m_data->as.add(path_attributes(cur_attr(), idx));

        //保存idx值
        path_attributes attr = cur_attr();
        attr.stroke_flag = false;
        attr.fill_flag = true;
        attr.fill_color = agg::rgba8(color->red(), 
                color->green(), color->blue(), color->alpha());
        attr.index = idx;
        m_data->as[m_data->as.size() -1] = attr;
        pop_attr();

        updateBbox();
    }
Example #4
0
 void stroke(agg::rgba8 const& s)
 {
     path_attributes& attr = cur_attr();
     double a = attr.stroke_color.opacity();
     attr.stroke_color = s;
     attr.stroke_color.opacity(a * s.opacity());
     attr.stroke_flag = true;
 }
Example #5
0
 // Attribute setting functions.
 void fill(agg::rgba8 const& f)
 {
     path_attributes& attr = cur_attr();
     double a = attr.fill_color.opacity();
     attr.fill_color = f;
     attr.fill_color.opacity(a * f.opacity());
     attr.fill_flag = true;
 }
//------------------------------------------------------------------------
void path_renderer::fill_gradient(svg_gradient& gradient)
{
    path_attributes& cur = cur_attr();
    if (cur.gradient != nullptr) {
        delete cur.gradient;
    }

    cur.gradient = gradient.clone();
}
//------------------------------------------------------------------------
void path_renderer::fill(const rgba8& f)
{
    path_attributes& attr = cur_attr();
    int32u alpha = (f.a * attr.fill_color.a ) / 255;

    attr.fill_color = f;
    attr.fill_color.a = alpha;

    attr.fill_flag = true;
}
Example #8
0
 void end_path()
 {
     if(attributes_.size() == 0)
     {
         throw std::runtime_error("end_path : The path was not begun");
     }
     path_attributes attr = cur_attr();
     unsigned idx = attributes_[attributes_.size() - 1].index;
     attr.index = idx;
     attributes_[attributes_.size() - 1] = attr;
 }
Example #9
0
 //------------------------------------------------------------------------
 void path_renderer::end_path()
 {
     if(m_attr_storage.size() == 0) 
     {
         throw exception("end_path : The path was not begun");
     }
     path_attributes attr = cur_attr();
     unsigned idx = m_attr_storage[m_attr_storage.size() - 1].index;
     attr.index = idx;
     m_attr_storage[m_attr_storage.size() - 1] = attr;
     pop_attr();
 }
Example #10
0
	void path_renderer::set_gradient_brush_to_path(const char* gr_id)
	{
		if(m_all_gradients.size() == 0)
			return;
		path_attributes& attr = cur_attr();
		unsigned cnt = m_all_gradients.size();
		for (unsigned i=0;i<cnt;i++)
		{
			if (strcmp(m_all_gradients[i].id_string, gr_id) == 0)
			{
				attr.gradient_brush = &m_all_gradients[i];
				break;
			}
		}
	}
//------------------------------------------------------------------------
void path_renderer::end_path()
{

    if(m_attr_storage.size() == 0)
    {
        gdx_log_error("gdx","end_path : The path was not begun");
    }
    path_attributes& attr = cur_attr();

    unsigned idx = m_attr_storage[m_attr_storage.size() - 1].index;
    attr.index = idx;
    m_attr_storage[m_attr_storage.size() - 1] = attr;

    if(attr.gradient) {
        if (m_attr_storage[m_attr_storage.size() - 1].gradient) {
            delete m_attr_storage[m_attr_storage.size() - 1].gradient;
        }
        m_attr_storage[m_attr_storage.size() - 1].gradient  = attr.gradient->clone();
    }

    pop_attr();
}
Example #12
0
 void line_cap(agg::line_cap_e cap)
 {
     cur_attr().line_cap = cap;
 }
Example #13
0
 void line_join(agg::line_join_e join)
 {
     cur_attr().line_join = join;
 }
Example #14
0
 void opacity(double op)
 {
     cur_attr().stroke_opacity = op;
     cur_attr().fill_opacity = op;
 }
Example #15
0
 void stroke_opacity(double op)
 {
     cur_attr().stroke_opacity = op;
 }
Example #16
0
 void fill_opacity(double op)
 {
     cur_attr().fill_opacity = op;
 }
Example #17
0
 void add_stroke_gradient(mapnik::gradient const& grad)
 {
     path_attributes& attr = cur_attr();
     attr.stroke_gradient = grad;
 }
Example #18
0
 void begin_path()
 {
     unsigned idx = source_.start_new_path();
     attributes_.add(path_attributes(cur_attr(), idx));
 }
Example #19
0
 void stroke_width(double w)
 {
     cur_attr().stroke_width = w;
 }
Example #20
0
 bool display()
 {
     return cur_attr().display_flag;
 }
Example #21
0
 void display(bool flag)
 {
     cur_attr().display_flag = flag;
 }
//------------------------------------------------------------------------
void path_renderer::begin_path()
{
    push_attr();
    unsigned idx = m_storage.start_new_path();
    m_attr_storage.add(path_attributes(cur_attr(), idx));
}
Example #23
0
 void visibility(bool flag)
 {
     cur_attr().visibility_flag = flag;
 }
Example #24
0
 void even_odd(bool flag)
 {
     cur_attr().even_odd_flag = flag;
 }
Example #25
0
 void miter_limit(double ml)
 {
     cur_attr().miter_limit = ml;
 }
Example #26
0
 void fill_none()
 {
     cur_attr().fill_flag = false;
 }
Example #27
0
 agg::trans_affine& transform()
 {
     return cur_attr().transform;
 }
Example #28
0
 void stroke_none()
 {
     cur_attr().stroke_flag = false;
 }
Example #29
0
 bool visibility()
 {
     return cur_attr().visibility_flag;
 }
Example #30
0
 void add_fill_gradient(mapnik::gradient const& grad)
 {
     path_attributes& attr = cur_attr();
     attr.fill_gradient = grad;
 }