当前位置: 首页>>代码示例>>C++>>正文


C++ RefPtr::line_to方法代码示例

本文整理汇总了C++中cairo::RefPtr::line_to方法的典型用法代码示例。如果您正苦于以下问题:C++ RefPtr::line_to方法的具体用法?C++ RefPtr::line_to怎么用?C++ RefPtr::line_to使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cairo::RefPtr的用法示例。


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

示例1: line_to__

	void line_to__(Glib::ustring& d1,Glib::ustring& d2){
		cr_->line_to(s2f__(d1),s2f__(d2));
	}
开发者ID:BGCX261,项目名称:zhscript-svn-to-git,代码行数:3,代码来源:huitu___.cpp

示例2: pw

void
Renderer_Ducks::render_vfunc(
	const Glib::RefPtr<Gdk::Drawable>& drawable,
	const Gdk::Rectangle& /*expose_area*/
)
{
	assert(get_work_area());
	if(!get_work_area())
		return;

	const synfig::Point window_start(get_work_area()->get_window_tl());
	const float pw(get_pw()),ph(get_ph());

	const bool solid_lines(get_work_area()->solid_lines);
	bool alternative = get_work_area()->get_alternative_mode();

	const std::list<etl::handle<Duckmatic::Bezier> >& bezier_list(get_work_area()->bezier_list());
	const std::list<handle<Duckmatic::Stroke> >& stroke_list(get_work_area()->stroke_list());
	Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_work_area()->get_pango_context()));

	Cairo::RefPtr<Cairo::Context> cr = drawable->create_cairo_context();

	cr->save();
	cr->set_line_cap(Cairo::LINE_CAP_BUTT);
	cr->set_line_join(Cairo::LINE_JOIN_MITER);

	// Render the strokes
	for(std::list<handle<Duckmatic::Stroke> >::const_iterator iter=stroke_list.begin();iter!=stroke_list.end();++iter)
	{
		cr->save();

		std::list<synfig::Point>::iterator iter2;
		for(iter2=(*iter)->stroke_data->begin();iter2!=(*iter)->stroke_data->end();++iter2)
		{
			cr->line_to(
				((*iter2)[0]-window_start[0])/pw,
				((*iter2)[1]-window_start[1])/ph
				);
		}

		cr->set_line_width(1.0);
		cr->set_source_rgb(
			colorconv_synfig2gdk((*iter)->color).get_red_p(),
			colorconv_synfig2gdk((*iter)->color).get_green_p(),
			colorconv_synfig2gdk((*iter)->color).get_blue_p()
			);
		cr->stroke();

		cr->restore();
	}



	// Render the beziers
	for(std::list<handle<Duckmatic::Bezier> >::const_iterator iter=bezier_list.begin();iter!=bezier_list.end();++iter)
	{
		Point p1((*iter)->p1->get_trans_point()-window_start);
		Point p2((*iter)->p2->get_trans_point()-window_start);
		Point c1((*iter)->c1->get_trans_point()-window_start);
		Point c2((*iter)->c2->get_trans_point()-window_start);
		p1[0]/=pw;p1[1]/=ph;
		p2[0]/=pw;p2[1]/=ph;
		c1[0]/=pw;c1[1]/=ph;
		c2[0]/=pw;c2[1]/=ph;

		cr->save();

		cr->move_to(p1[0], p1[1]);
		cr->curve_to(c1[0], c1[1], c2[0], c2[1], p2[0], p2[1]);

/*
		if (solid_lines)
		{
			cr->set_source_rgb(0,0,0); // DUCK_COLOR_BEZIER_1
			cr->set_line_width(3.0);
			cr->stroke_preserve();

			cr->set_source_rgb(175.0/255.0,175.0/255.0,175.0/255.0); //DUCK_COLOR_BEZIER_2
			cr->set_line_width(1.0);
			cr->stroke();
		}
		else
*/
		{
			//Solid line background
			cr->set_line_width(1.0);
			cr->set_source_rgb(0,0,0); // DUCK_COLOR_BEZIER_1
			cr->stroke_preserve();

			//Dashes
			cr->set_source_rgb(175.0/255.0,175.0/255.0,175.0/255.0); //DUCK_COLOR_BEZIER_2
			std::valarray<double> dashes(2);
			dashes[0]=5.0;
			dashes[1]=5.0;
			cr->set_dash(dashes, 0);
			cr->stroke();
		}
		cr->restore();
	}

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

示例3: dsc

static void
draw_text (Cairo::RefPtr<Cairo::Context> cr, int wdh, int hgt)
{
    RefPtr<Pango::Layout> layout = Pango::Layout::create(cr);
    //layout->set_single_paragraph_mode(true);
    layout->set_text("MTextTextM\nAbc\nff");


    Pango::FontDescription dsc(FONT);
    layout->set_font_description(dsc);

    int t_wdh, t_hgt;
    layout->get_size(t_wdh, t_hgt);

    double t_sz = (double)dsc.get_size()/t_wdh;
    double new_sz = wdh * t_sz ;

    io::cout << "new_sz " << new_sz << io::endl;
    io::cout << "wdh " << wdh << io::endl;

    dsc.set_size( int(new_sz*PANGO_SCALE) );
    layout->set_font_description(dsc);

    layout->get_size(t_wdh, t_hgt);
    io::cout << "t_wdh " << t_wdh/(double)PANGO_SCALE << io::endl;

    // для наглядности
    cr->set_line_width(1.0);
    cr->rectangle(0, 0, wdh, hgt);
    cr->stroke();


    cr->save();

    cr->move_to(0, 0);
    cr->scale( 1.0, hgt / ((double)t_hgt/PANGO_SCALE) );
    //cr->scale( wdh / ((double)t_wdh/PANGO_SCALE), hgt / ((double)t_hgt/PANGO_SCALE) );

    layout->update_from_cairo_context(cr);

    pango_cairo_show_layout(cr->cobj(), layout->gobj());

    {
        Pango::Rectangle w_rct, s_rct;
        int cur_pos;

        cur_pos = 1;
        layout->get_cursor_pos(cur_pos, w_rct, s_rct);
        pango_extents_to_pixels(0, w_rct.gobj());

        io::cout << "curs - x, y, hgt " << w_rct.get_x() << " " << w_rct.get_y() << " " << w_rct.get_height() << io::endl;
        cr->move_to(w_rct.get_x()+5, w_rct.get_y());
        cr->line_to(w_rct.get_x()+5, w_rct.get_y()+w_rct.get_height());
        cr->stroke();


        cur_pos = 11;
        layout->get_cursor_pos(cur_pos, w_rct, s_rct);
        pango_extents_to_pixels(0, w_rct.gobj());

        io::cout << "curs - x, y, hgt " << w_rct.get_x() << " " << w_rct.get_y() << " " << w_rct.get_height() << io::endl;
        cr->move_to(w_rct.get_x()+5, w_rct.get_y());
        cr->line_to(w_rct.get_x()+5, w_rct.get_y()+w_rct.get_height());
        cr->stroke();

    }


    cr->restore();
}
开发者ID:cargabsj175,项目名称:bombono-dvd,代码行数:70,代码来源:test_text.cpp

示例4: test__

void area___::test__(){
	int width, height;
	width=da_->get_allocation().get_width();
	height=da_->get_allocation().get_height();

	double m_radius=0.42;
	double m_line_width=0.05;

	// scale to unit square and translate (0, 0) to be (0.5, 0.5), i.e.
	// the center of the window
	cr_->scale(width, height);
	cr_->translate(0.5, 0.5);
	cr_->set_line_width(m_line_width);

	cr_->save();
	cr_->set_source_rgba(0.337, 0.612, 0.117, 0.9);   // green
	cr_->paint();
	cr_->restore();
	cr_->arc(0, 0, m_radius, 0, 2 * M_PI);
	cr_->save();
	cr_->set_source_rgba(1.0, 1.0, 1.0, 0.8);
	cr_->fill_preserve();
	cr_->restore();
	cr_->stroke_preserve();
	cr_->clip();

	//clock ticks
	for (int i = 0; i < 12; i++)
	{
		double inset = 0.05;

		cr_->save();
		cr_->set_line_cap(Cairo::LINE_CAP_ROUND);

		if(i % 3 != 0)
		{
			inset *= 0.8;
			cr_->set_line_width(0.03);
		}

		cr_->move_to(
				(m_radius - inset) * cos (i * M_PI / 6),
				(m_radius - inset) * sin (i * M_PI / 6));
		cr_->line_to (
				m_radius * cos (i * M_PI / 6),
				m_radius * sin (i * M_PI / 6));
		cr_->stroke();
		cr_->restore(); // stack-pen-size
	}

	// store the current time
	time_t rawtime;
	time(&rawtime);
	struct tm * timeinfo = localtime (&rawtime);

	// compute the angles of the indicators of our clock
	double minutes = timeinfo->tm_min * M_PI / 30;
	double hours = timeinfo->tm_hour * M_PI / 6;
	double seconds= timeinfo->tm_sec * M_PI / 30;
	cout<<timeinfo->tm_min<<","<<timeinfo->tm_hour<<","<<timeinfo->tm_sec<<endl;

	cr_->save();
	cr_->set_line_cap(Cairo::LINE_CAP_ROUND);

	// draw the seconds hand
	cr_->save();
	cr_->set_line_width(m_line_width / 3);
	cr_->set_source_rgba(0.7, 0.7, 0.7, 0.8); // gray
	cr_->move_to(0, 0);
	cr_->line_to(sin(seconds) * (m_radius * 0.9),
			-cos(seconds) * (m_radius * 0.9));
	cr_->stroke();
	cr_->restore();

	// draw the minutes hand
	cr_->set_source_rgba(0.117, 0.337, 0.612, 0.9);   // blue
	cr_->move_to(0, 0);
	cr_->line_to(sin(minutes + seconds / 60) * (m_radius * 0.8),
			-cos(minutes + seconds / 60) * (m_radius * 0.8));
	cr_->stroke();

	// draw the hours hand
	cr_->set_source_rgba(0.337, 0.612, 0.117, 0.9);   // green
	cr_->move_to(0, 0);
	cr_->line_to(sin(hours + minutes / 12.0) * (m_radius * 0.5),
			-cos(hours + minutes / 12.0) * (m_radius * 0.5));
	cr_->stroke();
	cr_->restore();

	// draw a little dot in the middle
	cr_->arc(0, 0, m_line_width / 3.0, 0, 2 * M_PI);
	cr_->fill();
}
开发者ID:BGCX261,项目名称:zhscript-svn-to-git,代码行数:93,代码来源:huitu___.cpp

示例5: render_png

int render_png(Graph* graph)
{
	int i_side = (graph->side_length - 1) * SPACING + PADDING;

	//Cairo ImageSurface. This one will be saved afterwards as a png file
	Cairo::RefPtr<Cairo::ImageSurface> surface = Cairo::ImageSurface::create(Cairo::FORMAT_ARGB32, i_side + PADDING * 2, i_side + PADDING * 2);
	//Cairo Context.
	Cairo::RefPtr<Cairo::Context> cr = Cairo::Context::create(surface);

	cr->save(); // save the state of the context
	cr->set_source_rgb(1.0, 1.0, 1.0);
	cr->paint(); // fill image with the color
	cr->restore(); // color is back to black now

	//Storing state to start drawing
	cr->save();

	//setting brush color to black
	cr->set_source_rgb(0.0, 0.0, 0.0);

	cr->set_line_width(1.0);

	//drawing lines
	for (int i = 0; i < graph->side_length; i++) {
		for (int j = 0; j < graph->side_length; j++) {
			//for a current node
			Node* current = graph->matrix.at(i).at(j);
			//find all friends
			for (int k = 0; k < current->friends.size(); k++) {
				pair<int, int> current_friend = *std::next(current->friends.begin(), k);
				//Move brush to current node
				cr->move_to(current->coors.first * SPACING + PADDING, current->coors.second * SPACING + PADDING);
				//Draw a line to current friend
				cr->line_to(current_friend.first * SPACING + PADDING, current_friend.second * SPACING + PADDING);
				cr->stroke();
			}
		}
	}

	//setting brush color to red
	cr->set_source_rgb(1.0, 0.0, 0.0);

	//drawing vertices after lines are drawn
	for (int i = 0; i < graph->side_length; i++) {
		for (int j = 0; j < graph->side_length; j++) {
			Node* current = graph->matrix.at(i).at(j);
			cr->arc(current->coors.first * SPACING + PADDING, current->coors.second * SPACING + PADDING, 1.0, 0.0, 2.0 * M_PI);
			cr->stroke();
		}
	}

	cr->restore();

#ifdef CAIRO_HAS_PNG_FUNCTIONS

	std::string filename = build_name("result");
	surface->write_to_png(filename);

	std::cout << "Wrote png file \"" << filename << "\"" << std::endl;

#else

	std::cout << "You must compile cairo with PNG support for this example to work."
	          << std::endl;

#endif
}
开发者ID:roornelas,项目名称:small-world,代码行数:67,代码来源:gui.cpp

示例6: on_expose_event

bool SamplerWidget::on_expose_event(GdkEventExpose* event)
{
	// This is where we draw on the window
	Glib::RefPtr<Gdk::Window> window = get_window();
	
	if(window)    // Only run if Window does exist
	{
		allocation = get_allocation();
		int width = allocation.get_width();
		int height = allocation.get_height();
		
		//std::cout << "Width: " << width << std::endl;
		//std::cout << "Height: " << height << std::endl;
		//std::cout << "Height / 12: " << height /12.0 << std::endl;
		
		// coordinates for the center of the window
		int xc, yc;
		xc = width / 2;
		yc = height / 2;
		
		Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
		
		// clip to the area indicated by the expose event so that we only redraw
		// the portion of the window that needs to be redrawn
		//cr -> set_source_rgba(0 , 0, 0 , 1);
		cr->rectangle(event->area.x, event->area.y,
		        event->area.width, event->area.height);
		//cr->rectangle(0,0,event->area.x,event->area.y);
		//cr->stroke_preserve();
		cr->clip();
		
		cr -> set_line_join (Cairo::LINE_JOIN_ROUND);
		
		cr -> move_to( 7, 7);
		cr -> line_to( width-7, 7);
		cr -> line_to( width-7, height-7);
		cr -> line_to( 7, height-7);
		cr -> close_path();
		
		// Draw outline shape
		cr -> set_source_rgb (0.1,0.1,0.1);
		cr -> fill_preserve();
		
		if (!padOnBool)
		{
			cr->set_source_rgba( 0.6, 0.6, 0.6, 0.5);
			cr->set_line_width ( 10.0);
			cr->stroke();
		}
		else
		{
			cr->set_source_rgba( 1.0,0.4,0.0, 0.8);
			cr->set_line_width ( 10.4);
			cr->stroke();
		}
		
		/* Pan functionality Not yet implemented in sampler.
		
		// Draw Pan line: pixel pan = width * pan
		cr -> set_line_cap (Cairo::LINE_CAP_ROUND);
		cr -> set_line_width ( 4.8);
		cr -> set_source_rgba( 1.0,0.8,0.8,0.8);
		cr -> move_to ( width/2 + ((width*pan)/2) , height - (height*volume) + 20);
		cr -> line_to ( width/2 + ((width*pan)/2) , height - (height*volume) - 20);
		cr -> stroke();
		*/
		
		// Draw Volume line: pixel vol = height * volume
		cr -> set_line_width ( 5.1);
		cr -> set_source_rgb( 0.2,0.2,0.2);
		cr -> move_to ( 10      , (height - ((height-20)*volume))-8 );
		cr -> line_to ( width-10, (height - ((height-20)*volume))-8 );
		cr -> line_to ( width-10, height-10);
		cr -> line_to ( 10, height-10);
		cr -> close_path();
		cr -> fill();
		
		// Draw Mode: Loop/Hit
		
		if ( !loopSampleBool)
		{
			cr->set_line_width ( 2.2);
			cr->set_source_rgb(0.2,0.2,0.2);
			cr->move_to(width/5,(height/5)*2);
			cr->line_to((width/5)*3,(height/5)*2);
			cr->line_to((width/5)*3,(height/5)*1);
			cr->line_to((width/5)*4,height/2);		// point of arrow
			cr->line_to((width/5)*3,(height/5)*4);
			cr->line_to((width/5)*3,(height/5)*3);
			cr->line_to(width/5,(height/5)*3);
			cr->close_path();
			cr->fill_preserve();
			
			cr->set_source_rgb(0.0,0.9,0.0);
			cr->stroke();
		}
		else // Loop Sample
		{
			cr -> set_source_rgb(0.2,0.2,0.2);
			cr -> arc_negative	(width/2, height/2, ((height  + width)/8)-5 , 6.0, 0.6); 	// inner curve
//.........这里部分代码省略.........
开发者ID:harryhaaren,项目名称:Gtkmm-Custom-Widgets,代码行数:101,代码来源:samplerwidget.cpp

示例7: h


//.........这里部分代码省略.........
	cr->stroke();

	// This try to find a valid canvas to show the keyframes of those
	// valuenodes. If not canvas found then no keyframes marks are shown.
	synfig::Canvas::Handle canvas=0;
	for(curve_iter=curve_list_.begin();curve_iter!=curve_list_.end();++curve_iter)
	{
		canvas=curve_iter->value_desc.get_canvas();
		if(canvas)
			break;
	}

	if(canvas)
	{
	// Draw vertical lines for the keyframes marks.
		const synfig::KeyframeList& keyframe_list(canvas->keyframe_list());
		synfig::KeyframeList::const_iterator iter;

		for(iter=keyframe_list.begin();iter!=keyframe_list.end();++iter)
		{
			if(!iter->get_time().is_valid())
				continue;

			const int x((int)((float)w/(t_end-t_begin)*(iter->get_time()-t_begin)));
			if(iter->get_time()>=t_begin && iter->get_time()<t_end)
			{
				cr->set_source_rgb(0.63, 0.5, 0.5);
				cr->rectangle(x, 0, 1, h);
				cr->fill();
			}
		}
	}

	// Draw current time
	cr->set_source_rgb(0, 0, 1);
	cr->rectangle(round_to_int((time_adjustment_->get_value()-t_begin)/dt), 0, 0, h);
	cr->stroke();

	// Draw curves for the valuenodes stored in the curve list
	for(curve_iter=curve_list_.begin();curve_iter!=curve_list_.end();++curve_iter)
	{
		Real t;
		int i;
		int channels(curve_iter->channels.size());
		for(i=0;i<channels;i++)
			points[i].clear();

		for(i=0,t=t_begin;i<w;i++,t+=dt)
		{
			for(int chan=0;chan<channels;chan++)
			{
				Real x(curve_iter->get_value(chan,t,dt));
				r_max=max(r_max,x);
				r_min=min(r_min,x);
				points[chan].push_back(
					Gdk::Point(
						i,
						round_to_int(
							(
								x-r_bottom
							)/dr
						)
					)
				);
			}
		}

		// Draw the graph curves with 0.5 width
		cr->set_line_width(0.5);
		for(int chan=0;chan<channels;chan++)
		{
			// Draw the curve
			std::vector<Gdk::Point> &p = points[chan];
			for(std::vector<Gdk::Point>::iterator i = p.begin(); i != p.end(); ++i)
			{
				if (i == p.begin())
					cr->move_to(i->get_x(), i->get_y());
				else
					cr->line_to(i->get_x(), i->get_y());
			}
			const Gdk::Color &color = curve_iter->channels[chan].color;
			cr->set_source_rgb(color.get_red_p(), color.get_green_p(), color.get_blue_p());
			cr->stroke();

			Glib::RefPtr<Pango::Layout> layout(Pango::Layout::create(get_pango_context()));
			layout->set_text(curve_iter->channels[chan].name);

			cr->move_to(1, points[chan][0].get_y()+1);
			layout->show_in_cairo_context(cr);
		}
	}

	if(!curve_list_.empty())
	{
		range_adjustment_->set_upper(r_max+range_adjustment_->get_page_size()/2);
		range_adjustment_->set_lower(r_min-range_adjustment_->get_page_size()/2);
	}

	return true;
}
开发者ID:Permutatrix,项目名称:synfig,代码行数:101,代码来源:widget_curves.cpp

示例8: draw_regions

void RegionChooser::draw_regions(const Cairo::RefPtr<Cairo::Context>& cr,
                                 int clip_low, int clip_high) {
    const int w = get_width() - 1;

    Gdk::Cairo::set_source_rgba(cr, black);
    gig::Region* next_region;
    int x3 = -1;
    for (gig::Region* r = regions.first() ; r ; r = next_region) {
        next_region = regions.next();

        if (x3 < 0) {
            x3 = key_to_x(r->KeyRange.low, w);
            if (x3 >= clip_high) break;
        }
        if (!next_region ||
            r->KeyRange.high + 1 != next_region->KeyRange.low ||
            r == region || next_region == region) {

            int x2 = key_to_x(r->KeyRange.high + 1, w);
            if (x2 >= clip_low) {
                cr->move_to(x3, 0.5);
                cr->line_to(x2 + 0.5, 0.5);
                cr->line_to(x2 + 0.5, h1 - 0.5);
                cr->line_to(x3, h1 - 0.5);
                cr->stroke();

                Gdk::Cairo::set_source_rgba(cr, region == r ? red : white);
                cr->rectangle(x3 + 1, 1, x2 - x3 - 1, h1 - 2);
                cr->fill();
                Gdk::Cairo::set_source_rgba(cr, black);
            }
            x3 = -1;
        }
    }

    for (gig::Region* r = regions.first() ; r ; r = regions.next()) {
        int x = key_to_x(r->KeyRange.low, w);

        if (x < clip_low) continue;
        if (x >= clip_high) break;

        cr->move_to(x + 0.5, 1);
        cr->line_to(x + 0.5, h1 - 1);
        cr->stroke();
    }

    // if there is no region yet, show the user some hint text that he may
    // right click on this area to create a new region
    if (!regions.first()) {
        Glib::RefPtr<Pango::Context> context = get_pango_context();
        Glib::RefPtr<Pango::Layout> layout = Pango::Layout::create(context);
        layout->set_alignment(Pango::ALIGN_CENTER);
        layout->set_text(Glib::ustring("*** ") + _("Right click here to create a region.") + " ***");
        layout->set_width(get_width() * Pango::SCALE);
        //layout->set_height(get_height() * Pango::SCALE);
        layout->set_spacing(10);
        Gdk::Cairo::set_source_rgba(cr, red);        
        // get the text dimensions
        int text_width, text_height;
        layout->get_pixel_size(text_width, text_height);
        cr->move_to(0, (REGION_BLOCK_HEIGHT - text_height) / 2);
#if (GTKMM_MAJOR_VERSION == 2 && GTKMM_MINOR_VERSION < 16) || GTKMM_MAJOR_VERSION < 2
        pango_cairo_show_layout(cr->cobj(), layout->gobj());
#else
        layout->show_in_cairo_context(cr);
#endif
    }
}
开发者ID:lxlxlo,项目名称:LS-gigedit,代码行数:68,代码来源:regionchooser.cpp

示例9: on_expose_event

bool GHighPass::on_expose_event(GdkEventExpose* event)
{
  // This is where we draw on the window
  Glib::RefPtr<Gdk::Window> window = get_window();
  
  if(window)    // Only run if Window does exist
  {
    Gtk::Allocation allocation = get_allocation();
    int width = allocation.get_width();
    int height = allocation.get_height();
    
    // clip to the area indicated by the expose event so that we only redraw
    // the portion of the window that needs to be redrawn
    Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
    cr->rectangle(event->area.x, event->area.y,
            event->area.width, event->area.height);
    cr->clip();
    
    cr->rectangle(event->area.x, event->area.y,
        event->area.width, event->area.height);
    setColour(cr, COLOUR_GREY_3 );
    cr->fill();
    
    //cout << "HighPass getting state ID " << ID << endl; 
    float cutoffRangeZeroOne = stateStore->effectState.at(ID).values[0];
    
    cutoff = cutoffRangeZeroOne;
    
    bool active = stateStore->effectState.at(ID).active;
    bool globalUnit = stateStore->effectState.at(ID).globalUnit;
    
    int x = 0;
    int y = 0;
    xSize = 73;
    ySize = 37;
    
    // works but a bit simple
    cr -> move_to( x        , y         );
    cr -> line_to( x + xSize, y         );
    cr -> line_to( x + xSize, y + ySize );
    cr -> line_to( x        , y + ySize );
    cr -> close_path();
    
    // Draw outline shape
    cr -> set_source_rgb (0.1,0.1,0.1);
    cr -> fill();
    
    // draw "frequency guides"
    std::valarray< double > dashes(2);
    dashes[0] = 2.0;
    dashes[1] = 2.0;
    cr->set_dash (dashes, 0.0);
    cr->set_line_width(1.0);
    cr->set_source_rgb (0.4,0.4,0.4);
    for ( int i = 0; i < 3; i++ )
    {
      cr->move_to( x + ((xSize / 3.f)*i), y );
      cr->line_to( x + ((xSize / 3.f)*i), y + ySize );
    }
    for ( int i = 0; i < 3; i++ )
    {
      cr->move_to( x       , y + ((ySize / 3.f)*i) );
      cr->line_to( x +xSize, y + ((ySize / 3.f)*i) );
    }
    cr->stroke();
    cr->unset_dash();
    
    // move to bottom left, draw line to middle left
    cr->move_to( x + xSize-2 , y + ySize );
    cr->line_to( x + xSize-2 , y + (ySize/2));
    
    
    int startHorizontalLine = xSize* (cutoff + 0.4);
    if ( startHorizontalLine > 75 )
      startHorizontalLine = 75;
      
    cr->line_to( startHorizontalLine, y + (ySize/2) ); // horizontal line to start of curve
    
    int xSize1CP1 = xSize* (cutoff +0.1);
    int xSize1CP2 = xSize* (cutoff +0.08);
    int xSize1End = xSize* cutoff;
    
    if ( xSize1CP1 > 75 )
      xSize1CP1 = 75;
    if ( xSize1CP2 > 75 )
      xSize1CP2 = 75;
    if ( xSize1End > 75 )
      xSize1End = 75;
    
    cr->curve_to( xSize1CP1, y+(ySize*0.5),   // control point 1
                  xSize1CP2, y+(ySize*0.3),   // control point 2
                  xSize1End, y+(ySize*0.3));  // end of curve 1, start curve 2
    
    int xSize2CP1 = xSize* (cutoff - 0.03);
    int xSize2CP2 = xSize* (cutoff - 0.08);
    int xSize2End = xSize* (cutoff - 0.15);
    
    if ( xSize2CP1 > 75 )
      xSize2CP1 = 75;
    if ( xSize2CP2 > 75 )
//.........这里部分代码省略.........
开发者ID:harryhaaren,项目名称:oldLuppp2012,代码行数:101,代码来源:g_highpass.cpp


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