[cairo] Clipping

alexo at mail333.com alexo at mail333.com
Thu Jan 22 01:39:46 PST 2009


Thank You Travis,
but this code have the same result :(
I'm use cairo binary 1.8.0 in Windows.

void OnPaint(HWND hwnd)
{
	PAINTSTRUCT ps;
	HDC hdc=::BeginPaint(hwnd,&ps);

	cairo_surface_t* surface=cairo_win32_surface_create(hdc);
	cairo_t* cr=cairo_create(surface);

	cairo_rectangle(cr, 100, 300, 200, -200);
	cairo_clip(cr);
	cairo_set_source_rgb(cr, 1, 0, 0);
	cairo_paint(cr);

	cairo_destroy(cr);
	cairo_surface_destroy(surface);

	::EndPaint(hwnd,&ps);
}

What you think about it?
I look at cairo sources(but 1.8.6 version):

void
cairo_rectangle (cairo_t *cr,
		 double x, double y,
		 double width, double height)
{
     if (cr->status)
	return;

     cairo_move_to (cr, x, y);
     cairo_rel_line_to (cr, width, 0);
     cairo_rel_line_to (cr, 0, height);
     cairo_rel_line_to (cr, -width, 0);
     cairo_close_path (cr);
}

I think the sign cannot change clipping.
Direction is unimportant in that case.
What you say?






More information about the cairo mailing list