[cairo] Rectangle Border Widths

robertk54 at aol.com robertk54 at aol.com
Tue Apr 10 07:40:23 PDT 2012

Is it possible to render rectangles whose vertical lines are different in width from the horizontal lines?  I have tried drawing separate lines for each side adjusting the line width for as needed.  The result is a rectangle but there is a very slight gap where the lines meet.  The gap is more noticeable as the color is made more transparent.  Overlapping the lines works well for opaque colors but not for transparent.  This is what I am currently doing . . . 

      cairo_new_sub_path (m_pCairo);
      cairo_move_to (m_pCairo, m_dXPos+l_dBorderWidthV, m_dYPos+l_dBorderOffsetH);
      cairo_line_to (m_pCairo, m_dXPos+m_dWidth-l_dBorderWidthV, m_dYPos+l_dBorderOffsetH);
      cairo_move_to (m_pCairo, m_dXPos+l_dBorderWidthV, m_dYPos+m_dHeight-l_dBorderOffsetH);
      cairo_line_to (m_pCairo, m_dXPos+m_dWidth-l_dBorderWidthV, m_dYPos+m_dHeight-l_dBorderOffsetH);
      cairo_set_line_width (m_pCairo, l_dBorderWidthH);
      cairo_set_line_width (m_pCairo, l_dBorderWidthV);
      cairo_move_to (m_pCairo, m_dXPos+l_dBorderOffsetV, m_dYPos);
      cairo_line_to (m_pCairo, m_dXPos+l_dBorderOffsetV, m_dYPos+m_dHeight);
      cairo_move_to (m_pCairo, m_dXPos+m_dWidth-l_dBorderOffsetV, m_dYPos);
      cairo_line_to (m_pCairo, m_dXPos+m_dWidth-l_dBorderOffsetV, m_dYPos+m_dHeight);
      cairo_close_path (m_pCairo);
      cairo_set_line_width (m_pCairo, l_dBorderWidthH);

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120410/aaed1c49/attachment.htm>

More information about the cairo mailing list