[cairo] Draw a rectangle with dash lines

ken carlino ken.carlino at gmail.com
Fri Feb 2 22:27:18 PST 2007


Hi,
I am using cairo 1.0.2 and i am trying to draw a rect wiht dash lines
(not solid lines).

It works in some cases, but in some cases, I see a rect with dash
lines and a filled triangle which covers half of the rect (from one
top corner to another bottom corner).

Here is my code, I appreciate if you can tell me what am I missing or
give me some pointers:

	  double dashes[] = {4.0,  /* ink */
                   4.0,  /* skip */
                   4.0,  /* ink */
                   4.0   /* skip*/
                  };

	  int    ndash  = sizeof (dashes)/sizeof(dashes[0]);
	
	  double offset = -4.0;
	  cairo_set_dash (cr2, dashes, ndash, offset);
            cairo_rectangle(cr2, x2, y2 , w2, h2);
            cairo_set_source_rgb(cr2, 1.0, 0.0, 0.0);
            cairo_stroke(cr2);

Thank you for any help.


More information about the cairo mailing list