Re: Rectangle Border Widths

Chris Wilson <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <1334083615_350613@CP5-2952>
On Tue, 10 Apr 2012 14:29:33 -0400 (EDT), [email protected] wrote:
> 
> 
> >> Is it possible to render rectangles whose vertical lines are different in 
> width from the horizontal lines?
> 
> >cairo_rectangle(cr, x, y, width, height);
> >cairo_save(cr);
> >cairo_scale(cr, stroke_width, stroke_height);
> >cairo_set_line_width(cr, 1);
> >cairo_stroke(cr);
> >cairo_restore(cr);
> 
> 
> Thanks Chris!
> Given this solution, what are the resulting dimensions of the rectangles?  Both the rectangle outside the line and the one within the line?  I need to fill the inner rectangle with a color .  I also need to use the inner rectangle for clipping other content which will be rendered on top of it.
> 
It should draw an outline between the two rectangles:
  (x - stroke_width/2, y - stroke_height/2)
  (x + stroke_width/2, y - stroke_height/2)
  (x + stroke_width/2, y + stroke_height/2)
  (x - stroke_width/2, y + stroke_height/2)
and
  (x + stroke_width/2, y + stroke_height/2)
  (x - stroke_width/2, y + stroke_height/2)
  (x - stroke_width/2, y - stroke_height/2)
  (x + stroke_width/2, y - stroke_height/2)

If you need to reuse only part of the stroked path, I'd recommend you
construct the outlines by hand (for the exercise ;).
-Chris

--
Chris Wilson, Intel Open Source Technology Centre
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.